Subversion Repositories filter_foundry

Rev

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

Rev 192 Rev 194
Line 51... Line 51...
51
        }else if( readobfusc && (resinfo = FindResource(hm,MAKEINTRESOURCE(OBFUSCDATA_ID),RT_RCDATA)) ){
51
        }else if( readobfusc && (resinfo = FindResource(hm,MAKEINTRESOURCE(OBFUSCDATA_ID),RT_RCDATA)) ){
52
                if( (h = LoadResource(hm,resinfo)) && (pparm = LockResource(h)) ){
52
                if( (h = LoadResource(hm,resinfo)) && (pparm = LockResource(h)) ){
53
                        // Fix by DM, 18 Dec 2018:
53
                        // Fix by DM, 18 Dec 2018:
54
                        // We need to copy the information, because the resource data is read-only
54
                        // We need to copy the information, because the resource data is read-only
55
                        DWORD resSize = SizeofResource(hm,resinfo);
55
                        DWORD resSize = SizeofResource(hm,resinfo);
56
                        char* copy = malloc(resSize);
56
                        char* copy = (char*)malloc(resSize);
57
                        memcpy(copy, pparm, resSize);
57
                        memcpy(copy, pparm, resSize);
58
                        obfusc((unsigned char*)copy, resSize);
58
                        obfusc((unsigned char*)copy, resSize);
59
                        res = readPARM(copy,&gdata->parm,reason,1);
59
                        res = readPARM(copy,&gdata->parm,reason,1);
60
                        free(copy);
60
                        free(copy);
61
                }
61
                }
Line 66... Line 66...
66
Boolean loadfile(StandardFileReply *sfr,char **reason){
66
Boolean loadfile(StandardFileReply *sfr,char **reason){
67
        Boolean readok = false;
67
        Boolean readok = false;
68
        HMODULE hm;
68
        HMODULE hm;
69
 
69
 
70
        // First, try to read the file as AFS/PFF/TXT file
70
        // First, try to read the file as AFS/PFF/TXT file
71
        if (readok = readfile(sfr,reason)) {
71
        if( (readok = readfile(sfr,reason)) ){
72
                gdata->parmloaded = false;
72
                gdata->parmloaded = false;
73
        }
73
        }
74
 
74
 
75
        // If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
75
        // If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
76
        if (!readok) {
76
        if (!readok) {
Line 90... Line 90...
90
                }
90
                }
91
        }
91
        }
92
 
92
 
93
        // If nothing worked, we will try to find a PARM resource (MacOS plugin, or NE executable on Win64)
93
        // If nothing worked, we will try to find a PARM resource (MacOS plugin, or NE executable on Win64)
94
        if (!readok) {
94
        if (!readok) {
95
                if (readok = read8bfplugin(sfr, reason)) {
95
                if( (readok = read8bfplugin(sfr, reason)) ){
96
                        gdata->parmloaded = true;
96
                        gdata->parmloaded = true;
97
                } else {
97
                } else {
98
                        *reason = "PARM resource was not found in this plugin file, or this is not a standalone plugin.";
98
                        *reason = "PARM resource was not found in this plugin file, or this is not a standalone plugin.";
99
                }
99
                }
100
        }
100
        }