Subversion Repositories filter_foundry

Rev

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

Rev 492 Rev 496
Line 67... Line 67...
67
                                if (!copy) return false;
67
                                if (!copy) return false;
68
                                memcpy(copy, pparm, resSize);
68
                                memcpy(copy, pparm, resSize);
69
                                deobfusc(copy);
69
                                deobfusc(copy);
70
                                res = readPARM(&gdata->parm, (Ptr)copy);
70
                                res = readPARM(&gdata->parm, (Ptr)copy);
71
                                if (!res) {
71
                                if (!res) {
72
                                        *reason = FF_GetMsg_Cpy(MSG_INCOMPATIBLE_OBFUSCATION_ID);
72
                                        *reason = FF_GetMsg_Cpy(MSG_INCOMPATIBLE_OBFUSCATION_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()...
73
                                }
73
                                }
74
                                free(copy);
74
                                free(copy);
75
                                gdata->obfusc = true;
75
                                gdata->obfusc = true;
76
                                return res;
76
                                return res;
77
                        }
77
                        }
Line 105... Line 105...
105
        // If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
105
        // If that didn't work, try to load as Windows image file (Resource API for 8BF/PRM files)
106
        if (*reason == NULL) {
106
        if (*reason == NULL) {
107
                if (hm = LoadLibraryEx(sfr->sfFile.szName, NULL, LOAD_LIBRARY_AS_DATAFILE)) {
107
                if (hm = LoadLibraryEx(sfr->sfFile.szName, NULL, LOAD_LIBRARY_AS_DATAFILE)) {
108
                        if (readPARMresource(hm, reason)) {
108
                        if (readPARMresource(hm, reason)) {
109
                                if (gdata->parm.iProtected) {
109
                                if (gdata->parm.iProtected) {
110
                                        *reason = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID);
110
                                        *reason = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()...
111
                                        //gdata->parmloaded = false;
111
                                        //gdata->parmloaded = false;
112
                                }
112
                                }
113
                                else {
113
                                else {
114
                                        gdata->parmloaded = true;
114
                                        gdata->parmloaded = true;
115
                                        FreeLibrary(hm);
115
                                        FreeLibrary(hm);
Line 140... Line 140...
140
        // Note that we cannot detect obfuscated filters here!
140
        // Note that we cannot detect obfuscated filters here!
141
        if (*reason == NULL) {
141
        if (*reason == NULL) {
142
                if (readfile_8bf(sfr, reason)) {
142
                if (readfile_8bf(sfr, reason)) {
143
                        if (gdata->parm.iProtected) {
143
                        if (gdata->parm.iProtected) {
144
                                // This is for purely protected filters before the time when obfuscation and protection was merged
144
                                // This is for purely protected filters before the time when obfuscation and protection was merged
145
                                *reason = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID);
145
                                *reason = FF_GetMsg_Cpy(MSG_FILTER_PROTECTED_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()...
146
                        }
146
                        }
147
                        else {
147
                        else {
148
                                gdata->parmloaded = true;
148
                                gdata->parmloaded = true;
149
                                return true;
149
                                return true;
150
                        }
150
                        }
Line 152... Line 152...
152
        }
152
        }
153
 
153
 
154
        // We didn't had success. If we have a clear reason, return false and the reason.
154
        // We didn't had success. If we have a clear reason, return false and the reason.
155
        // If we don't have a clear reason, set a generic reason and return false.
155
        // If we don't have a clear reason, set a generic reason and return false.
156
        if (*reason == NULL) {
156
        if (*reason == NULL) {
157
                *reason = FF_GetMsg_Cpy(MSG_LOADFILE_UNKNOWN_FORMAT_ID);
157
                *reason = FF_GetMsg_Cpy(MSG_LOADFILE_UNKNOWN_FORMAT_ID); // TODO: This leaks memory! Needs FF_GetMsg_Free()...
158
        }
158
        }
159
        return false;
159
        return false;
160
}
160
}