Subversion Repositories filter_foundry

Rev

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

Rev 554 Rev 558
Line 31... Line 31...
31
        if( (h = Get1Resource(PARM_TYPE,PARM_ID_NEW)) ||
31
        if( (h = Get1Resource(PARM_TYPE,PARM_ID_NEW)) ||
32
            (h = Get1Resource(PARM_TYPE,PARM_ID_OLD)) )
32
            (h = Get1Resource(PARM_TYPE,PARM_ID_OLD)) )
33
        {
33
        {
34
                HLock(h);
34
                HLock(h);
35
                if(GetHandleSize(h) == sizeof(PARM_T)) {
35
                if(GetHandleSize(h) == sizeof(PARM_T)) {
36
                        res = readPARM(&gdata->parm, *h, 0 /*Mac format resource*/);
36
                        res = readPARM(&gdata->parm, *h);
37
                        gdata->obfusc = false;
37
                        gdata->obfusc = false;
38
                        ReleaseResource(h);
38
                        ReleaseResource(h);
39
                } else {
39
                } else {
40
                        // PARM has wrong size. Should not happen
40
                        // PARM has wrong size. Should not happen
41
                        gdata->obfusc = false;
41
                        gdata->obfusc = false;
Line 47... Line 47...
47
                  (h = Get1Resource(OBFUSCDATA_TYPE_OLD,OBFUSCDATA_ID_OLD))) )
47
                  (h = Get1Resource(OBFUSCDATA_TYPE_OLD,OBFUSCDATA_ID_OLD))) )
48
        {
48
        {
49
                HLock(h);
49
                HLock(h);
50
                if(GetHandleSize(h) == sizeof(PARM_T)) {
50
                if(GetHandleSize(h) == sizeof(PARM_T)) {
51
                        deobfusc((PARM_T*)*h);
51
                        deobfusc((PARM_T*)*h);
52
                        res = readPARM(&gdata->parm, *h, 0 /*Mac format resource*/);
52
                        res = readPARM(&gdata->parm, *h);
53
                        gdata->obfusc = true;
53
                        gdata->obfusc = true;
54
                        ReleaseResource(h);
54
                        ReleaseResource(h);
55
                } else {
55
                } else {
56
                        // Obfuscated PARM has wrong size. Should not happen
56
                        // Obfuscated PARM has wrong size. Should not happen
57
                        gdata->obfusc = false;
57
                        gdata->obfusc = false;
Line 84... Line 84...
84
        FFLoadingResult res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
84
        FFLoadingResult res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
85
 
85
 
86
        if(FSpGetFInfo(&sfr->sfFile,&fndrInfo) == noErr){
86
        if(FSpGetFInfo(&sfr->sfFile,&fndrInfo) == noErr){
87
                // first try to read text parameters (AFS, TXT, PFF)
87
                // first try to read text parameters (AFS, TXT, PFF)
88
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
88
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
89
                        if (0 == (res = readfile_afs_pff(sfr))) {
89
                        if (LOADING_OK == (res = readfile_afs_pff(sfr))) {
90
                                parm_reset(true, false, true, false);
90
                                parm_reset(true, false, true, false);
91
                                gdata->obfusc = false;
91
                                gdata->obfusc = false;
92
                                return 0;
92
                                return LOADING_OK;
93
                        }
93
                        }
94
                        if (res == MSG_INVALID_FILE_SIGNATURE_ID) res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
94
                        if (res == MSG_INVALID_FILE_SIGNATURE_ID) res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
95
                }
95
                }
96
 
96
 
97
                // Try to read the file as FFL file
97
                // Try to read the file as FFL file
98
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
98
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
99
                        if (0 == (res = (readfile_ffl(sfr)))) {
99
                        if (LOADING_OK == (res = (readfile_ffl(sfr)))) {
100
                                parm_reset(true, true, true, true);
100
                                parm_reset(true, true, true, true);
101
                                gdata->obfusc = false;
101
                                gdata->obfusc = false;
102
                                return 0;
102
                                return LOADING_OK;
103
                        }
103
                        }
104
                        if (res == MSG_INVALID_FILE_SIGNATURE_ID) res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
104
                        if (res == MSG_INVALID_FILE_SIGNATURE_ID) res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
105
                }
105
                }
106
 
106
 
107
                // then try "Filters Unlimited" file (FFX)
107
                // then try "Filters Unlimited" file (FFX)
108
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
108
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
109
                        if (0 == (res = (readfile_ffx(sfr)))) {
109
                        if (LOADING_OK == (res = (readfile_ffx(sfr)))) {
110
                                gdata->obfusc = false;
110
                                gdata->obfusc = false;
111
                                return 0;
111
                                return LOADING_OK;
112
                        }
112
                        }
113
                        if (res == MSG_INVALID_FILE_SIGNATURE_ID) res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
113
                        if (res == MSG_INVALID_FILE_SIGNATURE_ID) res = MSG_LOADFILE_UNKNOWN_FORMAT_ID;
114
                }
114
                }
115
 
115
 
116
                // then try "PluginCommander TXT" file (TXT)
116
                // then try "PluginCommander TXT" file (TXT)
117
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
117
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
118
                        if (0 == (res = (readfile_picotxt(sfr)))) {
118
                        if (LOADING_OK == (res = (readfile_picotxt(sfr)))) {
119
                                gdata->obfusc = false;
119
                                gdata->obfusc = false;
120
                                return 0;
120
                                return LOADING_OK;
121
                        }
121
                        }
122
                }
122
                }
123
 
123
 
124
                // Is it a "GIMP UserFilter (GUF)" file? (Only partially compatible with Filter Factory!!!)
124
                // Is it a "GIMP UserFilter (GUF)" file? (Only partially compatible with Filter Factory!!!)
125
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
125
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
126
                        if (0 == (res = (readfile_guf(sfr)))) {
126
                        if (LOADING_OK == (res = (readfile_guf(sfr)))) {
127
                                return 0;
127
                                return LOADING_OK;
128
                        }
128
                        }
129
                }
129
                }
130
 
130
 
131
                // Try Mac plugin resource
131
                // Try Mac plugin resource
132
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
132
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
133
                        if (0 == (res = (readmacplugin(sfr)))) {
133
                        if (LOADING_OK == (res = (readmacplugin(sfr)))) {
134
                                if (gdata->parm.iProtected) {
134
                                if (gdata->parm.iProtected) {
135
                                        parm_reset(true, true, true, true);
135
                                        parm_reset(true, true, true, true);
136
                                        res = MSG_FILTER_PROTECTED_ID;
136
                                        res = MSG_FILTER_PROTECTED_ID;
137
                                } else {
137
                                } else {
138
                                        return 0;
138
                                        return LOADING_OK;
139
                                }
139
                                }
140
                        }
140
                        }
141
                }
141
                }
142
 
142
 
143
                // Try Windows resources (we need to do a binary scan)
143
                // Try Windows resources (we need to do a binary scan)
144
                // Note that we cannot detect obfuscated filters here!
144
                // Note that we cannot detect obfuscated filters here!
145
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
145
                if (res == MSG_LOADFILE_UNKNOWN_FORMAT_ID) {
146
                        if (0 == (res = (readfile_8bf(sfr)))) {
146
                        if (LOADING_OK == (res = (readfile_8bf(sfr)))) {
147
                                if (gdata->parm.iProtected) {
147
                                if (gdata->parm.iProtected) {
148
                                        parm_reset(true, true, true, true);
148
                                        parm_reset(true, true, true, true);
149
                                        res = MSG_FILTER_PROTECTED_ID;
149
                                        res = MSG_FILTER_PROTECTED_ID;
150
                                } else {
150
                                } else {
151
                                        return 0;
151
                                        return LOADING_OK;
152
                                }
152
                                }
153
                        }
153
                        }
154
                }
154
                }
155
 
155
 
156
                return res;
156
                return res;