Rev 506 | Rev 509 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 506 | Rev 508 | ||
---|---|---|---|
Line 283... | Line 283... | ||
283 | if (FSpOpenDF(dst, fsRdWrPerm, &fptr) != noErr) return -1; |
283 | if (FSpOpenDF(dst, fsRdWrPerm, &fptr) != noErr) return -1; |
284 | 284 | ||
285 | cnt = sizeof(srecord); |
285 | cnt = sizeof(srecord); |
286 | while (FSRead(fptr, &cnt, &srecord) == noErr) |
286 | while (FSRead(fptr, &cnt, &srecord) == noErr) |
287 | { |
287 | { |
- | 288 | if (cnt != sizeof(srecord)) break; // EOF reached |
|
288 | if (srecord == search) { |
289 | if (srecord == search) { |
289 | srecord = replace; |
290 | srecord = replace; |
290 | SetFPos(fptr, fsFromMark, -1 * (long)sizeof(srecord)); |
291 | SetFPos(fptr, fsFromMark, -1 * (long)sizeof(srecord)); |
291 | cnt = (int)sizeof(srecord); |
292 | cnt = (int)sizeof(srecord); |
292 | FSWrite(fptr, &cnt, &srecord); |
293 | FSWrite(fptr, &cnt, &srecord); |
Line 425... | Line 426... | ||
425 | size_t piplsize,aetesize,origsize; |
426 | size_t piplsize,aetesize,origsize; |
426 | char title[256]; |
427 | char title[256]; |
427 | LPCTSTR parm_type; |
428 | LPCTSTR parm_type; |
428 | LPCTSTR parm_id; |
429 | LPCTSTR parm_id; |
429 | Boolean discard = true; |
430 | Boolean discard = true; |
430 | uint64_t obfuscseed = 0; |
431 | uint64_t obfuscseed = 0, obfuscseed2 = 0; |
431 | long event_id; |
432 | long event_id; |
432 | 433 | ||
433 | memset(&dummy_oper, 0, sizeof(operdef_t)); |
434 | memset(&dummy_oper, 0, sizeof(operdef_t)); |
434 | memset(&dummy_func, 0, sizeof(funcdef_t)); |
435 | memset(&dummy_func, 0, sizeof(funcdef_t)); |
435 | memset(&dummy_symn, 0, sizeof(symndef_t)); |
436 | memset(&dummy_symn, 0, sizeof(symndef_t)); |
Line 495... | Line 496... | ||
495 | if (gdata->obfusc) { |
496 | if (gdata->obfusc) { |
496 | parm_type = OBFUSCDATA_TYPE_NEW; |
497 | parm_type = OBFUSCDATA_TYPE_NEW; |
497 | parm_id = OBFUSCDATA_ID_NEW; |
498 | parm_id = OBFUSCDATA_ID_NEW; |
498 | 499 | ||
499 | // Note: After we have finished updating the resources, we will write <obfuscseed> into the binary code of the 8BF file |
500 | // Note: After we have finished updating the resources, we will write <obfuscseed> into the binary code of the 8BF file |
500 | obfuscseed = obfusc(pparm); |
501 | obfusc(pparm, &obfuscseed, &obfuscseed2); |
501 | }else{ |
502 | }else{ |
502 | parm_type = PARM_TYPE; |
503 | parm_type = PARM_TYPE; |
503 | parm_id = PARM_ID_NEW; |
504 | parm_id = PARM_ID_NEW; |
504 | } |
505 | } |
505 | 506 | ||
Line 544... | Line 545... | ||
544 | 545 | ||
545 | // First try with alignment "4" (this should be the usual case), |
546 | // First try with alignment "4" (this should be the usual case), |
546 | // and if that failed, try without alignment ("1"). |
547 | // and if that failed, try without alignment ("1"). |
547 | // We only need to set maxamount to "1", because "const volatile" makes sure that |
548 | // We only need to set maxamount to "1", because "const volatile" makes sure that |
548 | // the compiler won't place (inline) it at several locations in the code. |
549 | // the compiler won't place (inline) it at several locations in the code. |
549 | if (//(binary_replace_file(dst, GetObfuscSeed(), obfuscseed, /*align to 4*/1, /*maxamount=*/1) == 0) && |
550 | if ((binary_replace_file(dst, GetObfuscSeed(), obfuscseed, /*align to 1*/0, /*maxamount=*/1) == 0) || |
550 | (binary_replace_file(dst, GetObfuscSeed(), obfuscseed, /*align to 1*/0, /*maxamount=*/1) == 0)) |
551 | (binary_replace_file(dst, GetObfuscSeed2(), obfuscseed2, /*align to 1*/0, /*maxamount=*/1) == 0)) |
551 | { |
552 | { |
552 | simplewarning((TCHAR*)TEXT("binary_replace_file failed")); // TODO (Not so important): TRANSLATE |
553 | simplewarning((TCHAR*)TEXT("binary_replace_file failed")); // TODO (Not so important): TRANSLATE |
553 | discard = true; |
554 | discard = true; |
554 | } |
555 | } |
555 | } |
556 | } |