Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To test path redirections:
- // struct for 3 paths
- typedef struct
- {
- path_open_entry entries[4];
- char arena[0x2000];
- } path_open_table;
- path_open_table open_table;
- uint64_t dest_table_addr;
- ..................................................
- // disable table
- printf(" last table %llx\n", sys8_path_table(0ULL));
- // calculate dest_table addr from payload start to back
- dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15);
- // fix the start addresses
- open_table.entries[0].compare_addr= ((uint64_t) &open_table.arena[0]) - ((uint64_t) &open_table) + dest_table_addr;
- open_table.entries[0].replace_addr= ((uint64_t) &open_table.arena[0x800])- ((uint64_t) &open_table) + dest_table_addr;
- open_table.entries[1].compare_addr= ((uint64_t) &open_table.arena[0x100]) - ((uint64_t) &open_table) + dest_table_addr;
- open_table.entries[1].replace_addr= ((uint64_t) &open_table.arena[0x1000])- ((uint64_t) &open_table) + dest_table_addr;
- open_table.entries[2].compare_addr= ((uint64_t) &open_table.arena[0x200]) - ((uint64_t) &open_table) + dest_table_addr;
- open_table.entries[2].replace_addr= ((uint64_t) &open_table.arena[0x1800])- ((uint64_t) &open_table) + dest_table_addr;
- open_table.entries[3].compare_addr= 0ULL; // the last entry always 0
- // copy the paths
- strncpy(&open_table.arena[0], "/app_home/PS3_GAME/USRDIR", 0x100); // compare 1
- strncpy(&open_table.arena[0x800], "/dev_usb000/PS3_GAME/USRDIR", 0x800); // replace 1: replaces all content or USRDIR
- strncpy(&open_table.arena[0x100], "/app_home/PS3_GAME/ICON0.PNG", 0x100); // compare 2
- strncpy(&open_table.arena[0x1000], "/dev_usb000/PS3_GAME/ICON0.PNG", 0x800); // replace 2: replace only ICON0.PNG
- strncpy(&open_table.arena[0x200], "/app_home/PS3_GAME/ICO", 0x100); // compare 3
- strncpy(&open_table.arena[0x1800], "/dev_usb000/PS3_GAME/ICON0.PNG", 0x800); // replace 3: // replace all ICONxxxx by ICON0.PNG
- // fix the string len
- open_table.entries[0].compare_len= strlen(&open_table.arena[0]); // 1
- open_table.entries[0].replace_len= strlen(&open_table.arena[0x800]);
- open_table.entries[1].compare_len= strlen(&open_table.arena[0x100]); // 2
- open_table.entries[1].replace_len= strlen(&open_table.arena[0x1000]);
- open_table.entries[2].compare_len= strlen(&open_table.arena[0x200]); // 3
- open_table.entries[2].replace_len= strlen(&open_table.arena[0x1800]) +1; // truncate the name because it skip '\0'
- // copy the datas to the destination address
- sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table));
- // set the path table
- sys8_path_table( dest_table_addr));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement