Subversion Repositories filter_foundry

Rev

Rev 506 | Rev 508 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 506 Rev 507
Line 256... Line 256...
256
 
256
 
257
 
257
 
258
int obfuscation_version(PARM_T* pparm) {
258
int obfuscation_version(PARM_T* pparm) {
259
        uint32_t obfusc_info = pparm->unknown2;
259
        uint32_t obfusc_info = pparm->unknown2;
260
 
260
 
261
        if (obfusc_info == 0x00000000) { // 00 00 00 00
261
        if (obfusc_info == 0x00000001) { // 01 00 00 00
262
                // Photoshop FilterFactory default initialization of field "unknown2"
262
                // Photoshop FilterFactory default initialization of field "unknown2" (no obfuscation)
263
                // (no obfuscation)
-
 
264
                return 0;
263
                return 0;
265
        }
264
        }
266
        else if (obfusc_info == 0x00000001) { // 01 00 00 00
265
        else if (obfusc_info == 0x00000000) { // 00 00 00 00
267
                // Premiere FilterFactory default initialization of field "unknown1" (it is at the offset of Photoshop's "unknown2")
266
                // Premiere FilterFactory default initialization of field "unknown1" (no obfuscation)
268
                // (no obfuscation)
267
                // (Premiere Field "unknown1" has the offset of Photoshop's "unknown2" field)
269
                return 0;
268
                return 0;
270
        }
269
        }
271
        else if (obfusc_info == 0x90E364A3) { // A3 64 E3 90
270
        else if (obfusc_info == 0x90E364A3) { // A3 64 E3 90
272
                // Version 1 obfuscation (Filter Foundry 1.4b8,9,10)
271
                // Version 1 obfuscation (Filter Foundry 1.4b8,9,10)
273
                return 1;
272
                return 1;
Line 393... Line 392...
393
                        p = (unsigned char*)pparm;
392
                        p = (unsigned char*)pparm;
394
                        for (i = 0; i < seed_position; i++) {
393
                        for (i = 0; i < seed_position; i++) {
395
                                *p++ ^= (int)(rand() * 1.0 / ((double)RAND_MAX + 1) * 256);
394
                                *p++ ^= (int)(rand() * 1.0 / ((double)RAND_MAX + 1) * 256);
396
                        }
395
                        }
397
                        *((uint32_t*)p) = 0; // here was the seed. Fill it with 0x00000000
396
                        *((uint32_t*)p) = 0; // here was the seed. Fill it with 0x00000000
398
                        p += 4;
397
                        p += 4; // jump to the next DWORD
399
                        for (i = 0; i < size - seed_position - 4; i++) {
398
                        for (i = 0; i < size - seed_position - 4; i++) {
400
                                *p++ ^= (int)(rand() * 1.0 / ((double)RAND_MAX + 1) * 256);
399
                                *p++ ^= (int)(rand() * 1.0 / ((double)RAND_MAX + 1) * 256);
401
                        }
400
                        }
402
 
401
 
403
                        break;
402
                        break;
Line 425... Line 424...
425
                                seed ^= 0xFFFFFFFF;
424
                                seed ^= 0xFFFFFFFF;
426
                        }
425
                        }
427
 
426
 
428
                        p = (unsigned char*)pparm;
427
                        p = (unsigned char*)pparm;
429
                        xorshift(&p, &seed, seed_position);
428
                        xorshift(&p, &seed, seed_position);
430
                        *((uint32_t*)p) = 0; // here was the version info. Fill it with 0x00000000
429
                        *((uint32_t*)p) = 0; // here was the version info (4 or 5). Fill it with 0x00000000
431
                        p += 4; // obfusc info was 4 or 5
430
                        p += 4; // jump to the next DWORD
432
                        xorshift(&p, &seed, size - seed_position - 4);
431
                        xorshift(&p, &seed, size - seed_position - 4);
433
 
432
 
434
                        if (obfusc_version == 5) {
433
                        if (obfusc_version == 5) {
435
                                pparm->unknown2 = 0; // make sure crc32b matches always
434
                                pparm->unknown2 = 0; // make sure crc32b matches always
436
                                if (crc32b((char*)pparm, sizeof(PARM_T)) != initial_seed) {
435
                                if (crc32b((char*)pparm, sizeof(PARM_T)) != initial_seed) {