Subversion Repositories filter_foundry

Rev

Rev 557 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 557 Rev 559
Line 79... Line 79...
79
        for (i = 0; i < 4; i++) hash += djb2(parm->szFormula[i]);
79
        for (i = 0; i < 4; i++) hash += djb2(parm->szFormula[i]);
80
 
80
 
81
        return hash;
81
        return hash;
82
}
82
}
83
 
83
 
84
size_t get_temp_afs(LPTSTR outfilename, Boolean isStandalone, PARM_T *parm) {
84
size_t get_temp_afs(TCHAR* outfilename, Boolean isStandalone, PARM_T *parm) {
85
        char* atempdir;
85
        char* atempdir;
86
        int hash;
86
        int hash;
87
        size_t i, j;
87
        size_t i, j;
88
        TCHAR out[MAX_PATH + 1];
88
        TCHAR out[MAX_PATH + 1];
89
        char ahash[20];
89
        char ahash[20];
Line 131... Line 131...
131
                free(sors);
131
                free(sors);
132
        }
132
        }
133
        return res;
133
        return res;
134
}
134
}
135
 
135
 
-
 
136
#ifdef WIN_ENV
136
BOOL CalledFromRunDLL32(HINSTANCE hinst) {
137
BOOL CalledFromRunDLL32(HINSTANCE hinst) {
137
        char exename[MAX_PATH];
138
        char exename[MAX_PATH];
138
        if (GetModuleFileNameA(hinst, exename, MAX_PATH) == 0) return false;
139
        if (GetModuleFileNameA(hinst, exename, MAX_PATH) == 0) return false;
139
        return stristr(exename, "rundll32") != NULL;
140
        return stristr(exename, "rundll32") != NULL;
140
}
141
}
-
 
142
#endif
141
 
143
 
-
 
144
#ifdef WIN_ENV
142
void CALLBACK FakeRundll32(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) {
145
void CALLBACK FakeRundll32(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) {
143
        UNREFERENCED_PARAMETER(hwnd);
146
        UNREFERENCED_PARAMETER(hwnd);
144
        UNREFERENCED_PARAMETER(hinst);
147
        UNREFERENCED_PARAMETER(hinst);
145
        UNREFERENCED_PARAMETER(lpszCmdLine);
148
        UNREFERENCED_PARAMETER(lpszCmdLine);
146
        UNREFERENCED_PARAMETER(nCmdShow);
149
        UNREFERENCED_PARAMETER(nCmdShow);
Line 156... Line 159...
156
 
159
 
157
        simplealert_id(MSG_RUNDLL_ERR_ID);
160
        simplealert_id(MSG_RUNDLL_ERR_ID);
158
 
161
 
159
        return;
162
        return;
160
}
163
}
-
 
164
#endif
161
 
165
 
162
void CreateDataPointer(intptr_t* data) {
166
void CreateDataPointer(intptr_t* data) {
163
        // Register "gdata" that contains the PARM information and other things which need to be persistant
167
        // Register "gdata" that contains the PARM information and other things which need to be persistant
164
        // and preserve them in *data
168
        // and preserve them in *data
165
        // This memory allocation is never freed, because the filter can always be invoked again.
169
        // This memory allocation is never freed, because the filter can always be invoked again.
Line 272... Line 276...
272
                FakeRundll32((HWND)(intptr_t)selector, (HINSTANCE)pb, (LPSTR)data, (int)(intptr_t)result);
276
                FakeRundll32((HWND)(intptr_t)selector, (HINSTANCE)pb, (LPSTR)data, (int)(intptr_t)result);
273
                // (I don't understand why this works! Aren't we __cdecl and rundll expected __stdcall? But why is the parameter order correct and not reversed?)
277
                // (I don't understand why this works! Aren't we __cdecl and rundll expected __stdcall? But why is the parameter order correct and not reversed?)
274
 
278
 
275
                goto endmain;
279
                goto endmain;
276
        }
280
        }
277
        else {
281
        #endif
-
 
282
 
278
                // will be changed if an error happens
283
        // will be changed if an error happens
279
                *result = noErr;
284
        *result = noErr;
280
        }
-
 
281
        #endif
-
 
282
 
285
 
283
        #ifdef SHOW_HOST_DEBUG
286
        #ifdef SHOW_HOST_DEBUG
284
        tmp = (char*)malloc(512);
287
        tmp = (char*)malloc(512);
285
        sprintf(tmp, "Host signature: '%c%c%c%c' (%d)\nMaxSpace32 = %d\nMaxSpace64 = %lld\nNum buffer procs: %d", (pb->hostSig >> 24) & 0xFF, (pb->hostSig >> 16) & 0xFF, (pb->hostSig >> 8) & 0xFF, pb->hostSig & 0xFF, pb->hostSig, pb->maxSpace, pb->maxSpace64, pb->bufferProcs == 0 ? -999/*About has no BufferProcs*/ : pb->bufferProcs->numBufferProcs);
288
        sprintf(tmp, "Host signature: '%c%c%c%c' (%d)\nMaxSpace32 = %d\nMaxSpace64 = %lld\nNum buffer procs: %d", (pb->hostSig >> 24) & 0xFF, (pb->hostSig >> 16) & 0xFF, (pb->hostSig >> 8) & 0xFF, pb->hostSig & 0xFF, pb->hostSig, pb->maxSpace, pb->maxSpace64, pb->bufferProcs == 0 ? -999/*About has no BufferProcs*/ : pb->bufferProcs->numBufferProcs);
286
        simplealert(tmp);
289
        simplealert(tmp);