Mercurial > mplayer.hg
annotate loader/module.c @ 12181:12ddc64011fe
Add license, remove bogus comment as told by Reza Jelveh, the author.
author | diego |
---|---|
date | Mon, 12 Apr 2004 23:58:06 +0000 |
parents | ebea9d9163b0 |
children | ef68b86beaf4 |
rev | line source |
---|---|
1 | 1 /* |
2 * Modules | |
3 * | |
4 * Copyright 1995 Alexandre Julliard | |
5 */ | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
6 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
7 // define for quicktime calls debugging and/or MacOS-level emulation: |
8286
1a9ea966d840
patching out threads ;) raw measure: 18% cpu instead 30%
alex
parents:
8277
diff
changeset
|
8 #define EMU_QTX_API |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
9 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
10 // define for quicktime debugging (verbose logging): |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
11 //#define DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
12 |
3465 | 13 #include "config.h" |
1 | 14 |
15 #include <assert.h> | |
16 #include <errno.h> | |
17 #include <fcntl.h> | |
18 #include <stdio.h> | |
19 #include <stdlib.h> | |
20 #include <string.h> | |
21 #include <unistd.h> | |
22 #include <sys/mman.h> | |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
23 #include <inttypes.h> |
1 | 24 |
7386 | 25 #include "wine/windef.h" |
26 #include "wine/winerror.h" | |
27 #include "wine/heap.h" | |
28 #include "wine/module.h" | |
29 #include "wine/pe_image.h" | |
30 #include "wine/debugtools.h" | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
31 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
32 #undef HAVE_LIBDL |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
33 |
2069 | 34 #ifdef HAVE_LIBDL |
35 #include <dlfcn.h> | |
7386 | 36 #include "wine/elfdll.h" |
2069 | 37 #endif |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
128
diff
changeset
|
38 #include "win32.h" |
7386 | 39 #include "driver.h" |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
40 |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
41 #ifdef EMU_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
42 #include "wrapper.h" |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
43 static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags); |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
44 static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
45 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
46 |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
47 //#undef TRACE |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
48 //#define TRACE printf |
1 | 49 |
50 //WINE_MODREF *local_wm=NULL; | |
51 modref_list* local_wm=NULL; | |
52 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
53 HANDLE SegptrHeap; |
2069 | 54 |
3465 | 55 WINE_MODREF* MODULE_FindModule(LPCSTR m) |
1 | 56 { |
57 modref_list* list=local_wm; | |
8277 | 58 TRACE("FindModule: Module %s request\n", m); |
1 | 59 if(list==NULL) |
60 return NULL; | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
61 // while(strcmp(m, list->wm->filename)) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
62 while(!strstr(list->wm->filename, m)) |
1 | 63 { |
128 | 64 TRACE("%s: %x\n", list->wm->filename, list->wm->module); |
1 | 65 list=list->prev; |
66 if(list==NULL) | |
67 return NULL; | |
2069 | 68 } |
1 | 69 TRACE("Resolved to %s\n", list->wm->filename); |
70 return list->wm; | |
2069 | 71 } |
1 | 72 |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
128
diff
changeset
|
73 static void MODULE_RemoveFromList(WINE_MODREF *mod) |
1 | 74 { |
75 modref_list* list=local_wm; | |
76 if(list==0) | |
77 return; | |
78 if(mod==0) | |
79 return; | |
80 if((list->prev==NULL)&&(list->next==NULL)) | |
81 { | |
82 free(list); | |
83 local_wm=NULL; | |
84 // uninstall_fs(); | |
85 return; | |
86 } | |
87 for(;list;list=list->prev) | |
88 { | |
89 if(list->wm==mod) | |
90 { | |
91 if(list->prev) | |
92 list->prev->next=list->next; | |
93 if(list->next) | |
94 list->next->prev=list->prev; | |
95 if(list==local_wm) | |
96 local_wm=list->prev; | |
97 free(list); | |
98 return; | |
99 } | |
100 } | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
101 |
2069 | 102 } |
103 | |
1 | 104 WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m) |
105 { | |
106 modref_list* list=local_wm; | |
8277 | 107 TRACE("LookupHMODULE: Module %X request\n", m); |
1 | 108 if(list==NULL) |
8277 | 109 { |
110 TRACE("LookupHMODULE failed\n"); | |
1 | 111 return NULL; |
8277 | 112 } |
1 | 113 while(m!=list->wm->module) |
114 { | |
115 // printf("Checking list %X wm %X module %X\n", | |
116 // list, list->wm, list->wm->module); | |
117 list=list->prev; | |
118 if(list==NULL) | |
8277 | 119 { |
120 TRACE("LookupHMODULE failed\n"); | |
1 | 121 return NULL; |
8277 | 122 } |
2069 | 123 } |
124 TRACE("LookupHMODULE hit %p\n", list->wm); | |
1 | 125 return list->wm; |
2069 | 126 } |
1 | 127 |
128 /************************************************************************* | |
129 * MODULE_InitDll | |
130 */ | |
131 static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) | |
132 { | |
133 WIN_BOOL retv = TRUE; | |
134 | |
2069 | 135 static LPCSTR typeName[] = { "PROCESS_DETACH", "PROCESS_ATTACH", |
1 | 136 "THREAD_ATTACH", "THREAD_DETACH" }; |
137 assert( wm ); | |
138 | |
139 | |
140 /* Skip calls for modules loaded with special load flags */ | |
141 | |
142 if ( ( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS ) | |
143 || ( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE ) ) | |
144 return TRUE; | |
145 | |
146 | |
147 TRACE("(%s,%s,%p) - CALL\n", wm->modname, typeName[type], lpReserved ); | |
148 | |
149 /* Call the initialization routine */ | |
150 switch ( wm->type ) | |
151 { | |
152 case MODULE32_PE: | |
153 retv = PE_InitDLL( wm, type, lpReserved ); | |
154 break; | |
155 | |
156 case MODULE32_ELF: | |
157 /* no need to do that, dlopen() already does */ | |
158 break; | |
159 | |
160 default: | |
161 ERR("wine_modref type %d not handled.\n", wm->type ); | |
162 retv = FALSE; | |
163 break; | |
164 } | |
165 | |
166 /* The state of the module list may have changed due to the call | |
167 to PE_InitDLL. We cannot assume that this module has not been | |
168 deleted. */ | |
169 TRACE("(%p,%s,%p) - RETURN %d\n", wm, typeName[type], lpReserved, retv ); | |
170 | |
171 return retv; | |
172 } | |
173 | |
174 /************************************************************************* | |
175 * MODULE_DllProcessAttach | |
2069 | 176 * |
1 | 177 * Send the process attach notification to all DLLs the given module |
178 * depends on (recursively). This is somewhat complicated due to the fact that | |
179 * | |
180 * - we have to respect the module dependencies, i.e. modules implicitly | |
181 * referenced by another module have to be initialized before the module | |
182 * itself can be initialized | |
2069 | 183 * |
1 | 184 * - the initialization routine of a DLL can itself call LoadLibrary, |
185 * thereby introducing a whole new set of dependencies (even involving | |
186 * the 'old' modules) at any time during the whole process | |
187 * | |
188 * (Note that this routine can be recursively entered not only directly | |
189 * from itself, but also via LoadLibrary from one of the called initialization | |
190 * routines.) | |
191 * | |
192 * Furthermore, we need to rearrange the main WINE_MODREF list to allow | |
193 * the process *detach* notifications to be sent in the correct order. | |
2069 | 194 * This must not only take into account module dependencies, but also |
1 | 195 * 'hidden' dependencies created by modules calling LoadLibrary in their |
196 * attach notification routine. | |
197 * | |
198 * The strategy is rather simple: we move a WINE_MODREF to the head of the | |
199 * list after the attach notification has returned. This implies that the | |
200 * detach notifications are called in the reverse of the sequence the attach | |
201 * notifications *returned*. | |
202 * | |
203 * NOTE: Assumes that the process critical section is held! | |
204 * | |
205 */ | |
3465 | 206 static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) |
1 | 207 { |
208 WIN_BOOL retv = TRUE; | |
209 int i; | |
210 assert( wm ); | |
211 | |
212 /* prevent infinite recursion in case of cyclical dependencies */ | |
213 if ( ( wm->flags & WINE_MODREF_MARKER ) | |
214 || ( wm->flags & WINE_MODREF_PROCESS_ATTACHED ) ) | |
215 return retv; | |
216 | |
217 TRACE("(%s,%p) - START\n", wm->modname, lpReserved ); | |
218 | |
219 /* Tag current MODREF to prevent recursive loop */ | |
220 wm->flags |= WINE_MODREF_MARKER; | |
221 | |
222 /* Recursively attach all DLLs this one depends on */ | |
223 /* for ( i = 0; retv && i < wm->nDeps; i++ ) | |
224 if ( wm->deps[i] ) | |
225 retv = MODULE_DllProcessAttach( wm->deps[i], lpReserved ); | |
226 */ | |
227 /* Call DLL entry point */ | |
228 | |
229 //local_wm=wm; | |
230 if(local_wm) | |
231 { | |
7386 | 232 local_wm->next = (modref_list*) malloc(sizeof(modref_list)); |
1 | 233 local_wm->next->prev=local_wm; |
234 local_wm->next->next=NULL; | |
235 local_wm->next->wm=wm; | |
236 local_wm=local_wm->next; | |
237 } | |
238 else | |
239 { | |
7386 | 240 local_wm = (modref_list*)malloc(sizeof(modref_list)); |
1 | 241 local_wm->next=local_wm->prev=NULL; |
242 local_wm->wm=wm; | |
2069 | 243 } |
1 | 244 /* Remove recursion flag */ |
245 wm->flags &= ~WINE_MODREF_MARKER; | |
2069 | 246 |
1 | 247 if ( retv ) |
248 { | |
249 retv = MODULE_InitDll( wm, DLL_PROCESS_ATTACH, lpReserved ); | |
250 if ( retv ) | |
251 wm->flags |= WINE_MODREF_PROCESS_ATTACHED; | |
252 } | |
253 | |
254 | |
255 TRACE("(%s,%p) - END\n", wm->modname, lpReserved ); | |
256 | |
257 return retv; | |
258 } | |
259 | |
260 /************************************************************************* | |
261 * MODULE_DllProcessDetach | |
2069 | 262 * |
263 * Send DLL process detach notifications. See the comment about calling | |
1 | 264 * sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag |
265 * is set, only DLLs with zero refcount are notified. | |
266 */ | |
3465 | 267 static void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPVOID lpReserved ) |
1 | 268 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
269 // WINE_MODREF *wm=local_wm; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
270 modref_list* l = local_wm; |
1 | 271 wm->flags &= ~WINE_MODREF_PROCESS_ATTACHED; |
272 MODULE_InitDll( wm, DLL_PROCESS_DETACH, lpReserved ); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
273 /* while (l) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
274 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
275 modref_list* f = l; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
276 l = l->next; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
277 free(f); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
278 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
279 local_wm = 0;*/ |
1 | 280 } |
281 | |
3465 | 282 /*********************************************************************** |
283 * MODULE_LoadLibraryExA (internal) | |
284 * | |
285 * Load a PE style module according to the load order. | |
286 * | |
287 * The HFILE parameter is not used and marked reserved in the SDK. I can | |
288 * only guess that it should force a file to be mapped, but I rather | |
289 * ignore the parameter because it would be extremely difficult to | |
290 * integrate this with different types of module represenations. | |
291 * | |
292 */ | |
293 static WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags ) | |
294 { | |
295 DWORD err = GetLastError(); | |
296 WINE_MODREF *pwm; | |
297 int i; | |
298 // module_loadorder_t *plo; | |
299 | |
300 SetLastError( ERROR_FILE_NOT_FOUND ); | |
301 TRACE("Trying native dll '%s'\n", libname); | |
302 pwm = PE_LoadLibraryExA(libname, flags); | |
303 #ifdef HAVE_LIBDL | |
304 if(!pwm) | |
305 { | |
306 TRACE("Trying ELF dll '%s'\n", libname); | |
307 pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags); | |
308 } | |
309 #endif | |
310 // printf("0x%08x\n", pwm); | |
311 // break; | |
312 if(pwm) | |
313 { | |
314 /* Initialize DLL just loaded */ | |
315 TRACE("Loaded module '%s' at 0x%08x, \n", libname, pwm->module); | |
316 /* Set the refCount here so that an attach failure will */ | |
317 /* decrement the dependencies through the MODULE_FreeLibrary call. */ | |
318 pwm->refCount++; | |
319 | |
320 SetLastError( err ); /* restore last error */ | |
321 return pwm; | |
322 } | |
323 | |
324 | |
325 WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError()); | |
326 return NULL; | |
327 } | |
328 | |
329 /*********************************************************************** | |
330 * MODULE_FreeLibrary | |
331 * | |
332 * NOTE: Assumes that the process critical section is held! | |
333 */ | |
334 static WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm ) | |
335 { | |
336 TRACE("(%s) - START\n", wm->modname ); | |
337 | |
338 /* Recursively decrement reference counts */ | |
339 //MODULE_DecRefCount( wm ); | |
340 | |
341 /* Call process detach notifications */ | |
342 MODULE_DllProcessDetach( wm, FALSE, NULL ); | |
343 | |
344 PE_UnloadLibrary(wm); | |
345 | |
346 TRACE("END\n"); | |
347 | |
348 return TRUE; | |
349 } | |
1 | 350 |
351 /*********************************************************************** | |
352 * LoadLibraryExA (KERNEL32) | |
353 */ | |
354 HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) | |
355 { | |
2069 | 356 WINE_MODREF *wm = 0; |
357 char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 }; | |
358 extern char* def_path; | |
359 char path[512]; | |
360 char checked[2000]; | |
361 int i = -1; | |
1 | 362 |
2069 | 363 checked[0] = 0; |
1 | 364 if(!libname) |
365 { | |
366 SetLastError(ERROR_INVALID_PARAMETER); | |
367 return 0; | |
368 } | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
369 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
370 wm=MODULE_FindModule(libname); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
371 if(wm) return wm->module; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
372 |
3465 | 373 // if(fs_installed==0) |
374 // install_fs(); | |
2069 | 375 |
376 while (wm == 0 && listpath[++i]) | |
377 { | |
378 if (i < 2) | |
379 { | |
380 if (i == 0) | |
381 /* check just original file name */ | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
382 strncpy(path, libname, 511); |
2069 | 383 else |
384 /* check default user path */ | |
385 strncpy(path, def_path, 300); | |
386 } | |
387 else if (strcmp(def_path, listpath[i])) | |
388 /* path from the list */ | |
389 strncpy(path, listpath[i], 300); | |
390 else | |
391 continue; | |
1 | 392 |
2069 | 393 if (i > 0) |
394 { | |
395 strcat(path, "/"); | |
396 strncat(path, libname, 100); | |
397 } | |
398 path[511] = 0; | |
399 wm = MODULE_LoadLibraryExA( path, hfile, flags ); | |
400 | |
401 if (!wm) | |
402 { | |
403 if (checked[0]) | |
404 strcat(checked, ", "); | |
405 strcat(checked, path); | |
406 checked[1500] = 0; | |
407 | |
408 } | |
409 } | |
1 | 410 if ( wm ) |
411 { | |
412 if ( !MODULE_DllProcessAttach( wm, NULL ) ) | |
413 { | |
414 WARN_(module)("Attach failed for module '%s', \n", libname); | |
415 MODULE_FreeLibrary(wm); | |
416 SetLastError(ERROR_DLL_INIT_FAILED); | |
417 MODULE_RemoveFromList(wm); | |
418 wm = NULL; | |
419 } | |
420 } | |
421 | |
2069 | 422 if (!wm) |
423 printf("Win32 LoadLibrary failed to load: %s\n", checked); | |
7386 | 424 |
12042 | 425 // remove a few divs in the VP codecs that make trouble |
426 if (strstr(libname,"vp5vfw.dll") && wm) | |
427 { | |
428 int i; | |
429 if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==(void*)0x10003930) { | |
430 for (i=0;i<3;i++) ((char*)0x10004e86)[i]=0x90; | |
431 for (i=0;i<3;i++) ((char*)0x10005a23)[i]=0x90; | |
432 for (i=0;i<3;i++) ((char*)0x10005bff)[i]=0x90; | |
433 } else { | |
434 fprintf(stderr, "Unsupported VP5 version\n"); | |
435 return 0; | |
436 } | |
437 } | |
438 | |
439 if (strstr(libname,"vp6vfw.dll") && wm) | |
440 { | |
441 int i; | |
442 if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==(void*)0x10003ef0) { | |
443 // looks like VP 6.1.0.2 | |
444 for (i=0;i<6;i++) ((char*)0x10007268)[i]=0x90; | |
445 for (i=0;i<6;i++) ((char*)0x10007e83)[i]=0x90; | |
446 for (i=0;i<6;i++) ((char*)0x1000806a)[i]=0x90; | |
447 } else if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==(void*)0x10004120) { | |
448 // looks like VP 6.2.0.10 | |
449 for (i=0;i<6;i++) ((char*)0x10007688)[i]=0x90; | |
450 for (i=0;i<6;i++) ((char*)0x100082c3)[i]=0x90; | |
451 for (i=0;i<6;i++) ((char*)0x100084aa)[i]=0x90; | |
452 } else { | |
453 fprintf(stderr, "Unsupported VP6 version\n"); | |
454 return 0; | |
455 } | |
456 } | |
457 | |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
458 if (strstr(libname,"QuickTime.qts") && wm) |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
459 { |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
460 void** ptr; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
461 void *dispatch_addr; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
462 int i; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
463 |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
464 // dispatch_addr = GetProcAddress(wm->module, "theQuickTimeDispatcher", TRUE); |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
465 dispatch_addr = PE_FindExportedFunction(wm, "theQuickTimeDispatcher", TRUE); |
8451 | 466 if (dispatch_addr == (void *)0x62924c30) |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
467 { |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
468 fprintf(stderr, "QuickTime5 DLLs found\n"); |
8451 | 469 ptr = (void **)0x62b75ca4; // dispatch_ptr |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
470 for (i=0;i<5;i++) ((char*)0x6299e842)[i]=0x90; // make_new_region ? |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
471 for (i=0;i<28;i++) ((char*)0x6299e86d)[i]=0x90; // call__call_CreateCompatibleDC ? |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
472 for (i=0;i<5;i++) ((char*)0x6299e898)[i]=0x90; // jmp_to_call_loadbitmap ? |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
473 for (i=0;i<9;i++) ((char*)0x6299e8ac)[i]=0x90; // call__calls_OLE_shit ? |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
474 for (i=0;i<106;i++) ((char*)0x62a61b10)[i]=0x90; // disable threads |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
475 #if 0 |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
476 /* CreateThread callers */ |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
477 for (i=0;i<5;i++) ((char*)0x629487c5)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
478 for (i=0;i<5;i++) ((char*)0x6294b275)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
479 for (i=0;i<5;i++) ((char*)0x629a24b1)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
480 for (i=0;i<5;i++) ((char*)0x629afc5a)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
481 for (i=0;i<5;i++) ((char*)0x62af799c)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
482 for (i=0;i<5;i++) ((char*)0x62af7efe)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
483 for (i=0;i<5;i++) ((char*)0x62afa33e)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
484 #endif |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
485 |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
486 #if 0 |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
487 /* TerminateQTML fix */ |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
488 for (i=0;i<47;i++) ((char*)0x62afa3b8)[i]=0x90; // terminate thread |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
489 for (i=0;i<47;i++) ((char*)0x62af7f78)[i]=0x90; // terminate thread |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
490 for (i=0;i<77;i++) ((char*)0x629a13d5)[i]=0x90; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
491 ((char *)0x6288e0ae)[0] = 0xc3; // font/dc remover |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
492 for (i=0;i<24;i++) ((char*)0x6287a1ad)[i]=0x90; // destroy window |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
493 #endif |
8451 | 494 } else if (dispatch_addr == (void *)0x6693b330) |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
495 { |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
496 fprintf(stderr, "QuickTime6 DLLs found\n"); |
8451 | 497 ptr = (void **)0x66bb9524; // dispatcher_ptr |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
498 for (i=0;i<5;i++) ((char *)0x66a730cc)[i]=0x90; // make_new_region |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
499 for (i=0;i<28;i++) ((char *)0x66a730f7)[i]=0x90; // call__call_CreateCompatibleDC |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
500 for (i=0;i<5;i++) ((char *)0x66a73122)[i]=0x90; // jmp_to_call_loadbitmap |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
501 for (i=0;i<9;i++) ((char *)0x66a73131)[i]=0x90; // call__calls_OLE_shit |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
502 for (i=0;i<96;i++) ((char *)0x66aac852)[i]=0x90; // disable threads |
10795
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
503 } else if (dispatch_addr == (void *)0x6693c3e0) |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
504 { |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
505 fprintf(stderr, "QuickTime6.3 DLLs found\n"); |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
506 ptr = (void **)0x66bca01c; // dispatcher_ptr |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
507 for (i=0;i<5;i++) ((char *)0x66a68f6c)[i]=0x90; // make_new_region |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
508 for (i=0;i<28;i++) ((char *)0x66a68f97)[i]=0x90; // call__call_CreateCompatibleDC |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
509 for (i=0;i<5;i++) ((char *)0x66a68fc2)[i]=0x90; // jmp_to_call_loadbitmap |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
510 for (i=0;i<9;i++) ((char *)0x66a68fd1)[i]=0x90; // call__calls_OLE_shit |
2ab9ab4f07b4
Support for QuickTime6.3 DLLs. Patch by Dima K. <dimakar@yahoo.com>
mosu
parents:
8451
diff
changeset
|
511 for (i=0;i<96;i++) ((char *)0x66ab4722)[i]=0x90; // disable threads |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
512 } else |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
513 { |
8451 | 514 fprintf(stderr, "Unsupported QuickTime version (%p)\n", |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
515 dispatch_addr); |
8451 | 516 return 0; |
8318
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
517 } |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
518 |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
519 fprintf(stderr,"QuickTime.qts patched!!! old entry=%p\n",ptr[0]); |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
520 |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
521 #ifdef EMU_QTX_API |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
522 report_entry = report_func; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
523 report_ret = report_func_ret; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
524 wrapper_target=ptr[0]; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
525 ptr[0]=wrapper; |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
526 #endif |
1ed329d61051
both qt5 and qt6 patching support (qt6 addresses found by arpi)
alex
parents:
8286
diff
changeset
|
527 } |
2069 | 528 |
1 | 529 return wm ? wm->module : 0; |
530 } | |
531 | |
532 | |
533 /*********************************************************************** | |
534 * LoadLibraryA (KERNEL32) | |
535 */ | |
536 HMODULE WINAPI LoadLibraryA(LPCSTR libname) { | |
537 return LoadLibraryExA(libname,0,0); | |
538 } | |
539 | |
540 /*********************************************************************** | |
541 * FreeLibrary | |
542 */ | |
543 WIN_BOOL WINAPI FreeLibrary(HINSTANCE hLibModule) | |
544 { | |
545 WIN_BOOL retv = FALSE; | |
546 WINE_MODREF *wm; | |
547 | |
548 wm=MODULE32_LookupHMODULE(hLibModule); | |
549 | |
550 if ( !wm || !hLibModule ) | |
551 { | |
552 SetLastError( ERROR_INVALID_HANDLE ); | |
553 return 0; | |
2069 | 554 } |
1 | 555 else |
556 retv = MODULE_FreeLibrary( wm ); | |
2069 | 557 |
1 | 558 MODULE_RemoveFromList(wm); |
559 | |
128 | 560 /* garbage... */ |
561 if (local_wm == NULL) my_garbagecollection(); | |
562 | |
1 | 563 return retv; |
564 } | |
565 | |
566 /*********************************************************************** | |
567 * MODULE_DecRefCount | |
568 * | |
569 * NOTE: Assumes that the process critical section is held! | |
570 */ | |
571 static void MODULE_DecRefCount( WINE_MODREF *wm ) | |
572 { | |
573 int i; | |
574 | |
575 if ( wm->flags & WINE_MODREF_MARKER ) | |
576 return; | |
577 | |
578 if ( wm->refCount <= 0 ) | |
579 return; | |
580 | |
581 --wm->refCount; | |
582 TRACE("(%s) refCount: %d\n", wm->modname, wm->refCount ); | |
583 | |
584 if ( wm->refCount == 0 ) | |
585 { | |
586 wm->flags |= WINE_MODREF_MARKER; | |
587 | |
588 for ( i = 0; i < wm->nDeps; i++ ) | |
589 if ( wm->deps[i] ) | |
590 MODULE_DecRefCount( wm->deps[i] ); | |
591 | |
592 wm->flags &= ~WINE_MODREF_MARKER; | |
593 } | |
594 } | |
595 | |
596 /*********************************************************************** | |
597 * GetProcAddress (KERNEL32.257) | |
598 */ | |
599 FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) | |
600 { | |
601 return MODULE_GetProcAddress( hModule, function, TRUE ); | |
602 } | |
603 | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
604 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
605 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
606 struct ComponentParameters { |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
607 unsigned char flags; /* call modifiers: sync/async, deferred, immed, etc */ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
608 unsigned char paramSize; /* size in bytes of actual parameters passed to this call */ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
609 short what; /* routine selector, negative for Component management calls */ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
610 long params[1]; /* actual parameters for the indicated routine */ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
611 }; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
612 typedef struct ComponentParameters ComponentParameters; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
613 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
614 static char* component_func(int what){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
615 switch(what){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
616 case -1: return "kComponentOpenSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
617 case -2: return "kComponentCloseSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
618 case -3: return "kComponentCanDoSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
619 case -4: return "kComponentVersionSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
620 case -5: return "kComponentRegisterSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
621 case -6: return "kComponentTargetSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
622 case -7: return "kComponentUnregisterSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
623 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
624 return "???"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
625 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
626 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
627 static char* component_func_type(int type,int what){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
628 if(type==1) switch(what){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
629 case 0: return "kImageCodecGetCodecInfoSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
630 case 1: return "kImageCodecGetCompressionTimeSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
631 case 5: return "kImageCodecPreDecompressSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
632 case 6: return "kImageCodecBandDecompressSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
633 case 0x12: return "kImageCodecDisposeMemorySelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
634 case 0x10: return "kImageCodecIsImageDescriptionEquivalentSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
635 case 0x14: return "kImageCodecNewImageBufferMemorySelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
636 case 0x28: return "kImageCodecRequestGammaLevelSelect"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
637 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
638 return "???"; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
639 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
640 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
641 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
642 static int c_level=0; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
643 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
644 static int dump_component(char* name,int type,void* _orig, ComponentParameters *params,void** glob){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
645 int ( *orig)(ComponentParameters *params, void** glob) = _orig; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
646 int ret,i; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
647 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
648 if(params->what<0) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
649 fprintf(stderr,"%*sComponentCall: %s flags=0x%X size=%d what=%d %s\n",3*c_level,"",name,params->flags, params->paramSize, params->what, component_func(params->what)); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
650 else |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
651 fprintf(stderr,"%*sComponentCall: %s flags=0x%X size=%d what=0x%X %s\n",3*c_level,"",name,params->flags, params->paramSize, params->what, component_func_type(type,params->what)); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
652 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
653 for(i=0;i<params->paramSize/4;i++) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
654 fprintf(stderr,"%*s param[%d] = 0x%X\n",3*c_level,"",i,params->params[i]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
655 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
656 ++c_level; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
657 ret=orig(params,glob); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
658 --c_level; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
659 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
660 if(ret>=0x1000) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
661 fprintf(stderr,"%*s return=0x%X\n",3*c_level,"",ret); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
662 else |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
663 fprintf(stderr,"%*s return=%d\n",3*c_level,"",ret); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
664 return ret; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
665 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
666 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
667 #define DECL_COMPONENT(sname,name,type) \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
668 static void* real_ ## sname = NULL; \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
669 static int fake_ ## sname(ComponentParameters *params,void** glob){ \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
670 return dump_component(name,type,real_ ## sname, params, glob); \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
671 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
672 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
673 #include "qt_comp.h" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
674 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
675 #undef DECL_COMPONENT |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
676 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
677 #include "qt_fv.h" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
678 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
679 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
680 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
681 #ifdef EMU_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
682 |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
683 static uint32_t ret_array[4096]; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
684 static int ret_i=0; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
685 |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
686 static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags) |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
687 { |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
688 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
689 int i; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
690 int* dptr; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
691 void* pwrapper=NULL; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
692 void* pptr=NULL; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
693 char* pname=NULL; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
694 int plen=-1; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
695 // find the code: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
696 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
697 dptr=0x62b67ae0;dptr+=2*((reg->eax>>16)&255); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
698 // printf("FUNC: flag=%d ptr=%p\n",dptr[0],dptr[1]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
699 if(dptr[0]&255){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
700 dptr=dptr[1];dptr+=4*(reg->eax&65535); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
701 // printf("FUNC: ptr2=%p eax=%p edx=%p\n",dptr[1],dptr[0],dptr[2]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
702 pwrapper=dptr[1]; pptr=dptr[0]; plen=dptr[2]; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
703 } else { |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
704 pwrapper=0x62924910; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
705 switch(dptr[1]){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
706 case 0x629248d0: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
707 dptr=0x62b672c0;dptr+=2*(reg->eax&65535); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
708 // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
709 pptr=dptr[0]; plen=dptr[1]; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
710 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
711 case 0x62924e40: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
712 dptr=0x62b67c70;dptr+=2*(reg->eax&65535); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
713 // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
714 pptr=dptr[0]; plen=dptr[1]; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
715 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
716 case 0x62924e60: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
717 dptr=0x62b68108;if(reg->eax&0x8000) dptr+=2*(reg->eax|0xffff0000); else dptr+=2*(reg->eax&65535); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
718 // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
719 pptr=dptr[0]; plen=dptr[1]; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
720 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
721 case 0x62924e80: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
722 dptr=0x62b68108;if(reg->eax&0x8000) dptr+=2*(reg->eax|0xffff0000); else dptr+=2*(reg->eax&65535); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
723 // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
724 pptr=dptr[0]; plen=dptr[1]; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
725 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
726 default: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
727 printf("FUNC: unknown ptr & psize!\n"); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
728 pwrapper=dptr[1]; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
729 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
730 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
731 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
732 for(i=0;qt_fv_list[i].name;i++){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
733 if(qt_fv_list[i].id==reg->eax){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
734 pname=qt_fv_list[i].name; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
735 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
736 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
737 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
738 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
739 printf("FUNC[%X/%s]: wrapper=%p func=%p len=%d\n",reg->eax, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
740 pname?pname:"???",pwrapper,pptr,plen); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
741 |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
742 printf("FUNC: caller=%p ebx=%p\n",((uint32_t *)stack_base)[0],reg->ebx); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
743 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
744 if(pname) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
745 printf("%*sENTER(%d): %s(",ret_i*2,"",ret_i,pname); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
746 else |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
747 printf("%*sENTER(%d): %X(",ret_i*2,"",ret_i,reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
748 for (i=0;i<plen/4;i++){ |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
749 unsigned int val=((uint32_t *)stack_base)[1+i]; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
750 unsigned char* fcc=&val; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
751 printf("%s0x%X", i?", ":"",val); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
752 if(fcc[0]>=0x20 && fcc[0]<128 && |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
753 fcc[1]>=0x20 && fcc[1]<128 && |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
754 fcc[2]>=0x20 && fcc[2]<128 && |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
755 fcc[3]>=0x20 && fcc[3]<128) printf("='%c%c%c%c'",fcc[3],fcc[2],fcc[1],fcc[0]); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
756 else if(val>=8 && val<65536) printf("=%d",val); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
757 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
758 printf(")\n"); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
759 fflush(stdout); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
760 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
761 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
762 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
763 #if 1 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
764 // emulate some functions: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
765 switch(reg->eax){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
766 // memory management: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
767 case 0x150011: //NewPtrClear |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
768 case 0x150012: //NewPtrSysClear |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
769 reg->eax=(uint32_t)malloc(((uint32_t *)stack_base)[1]); |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
770 memset((void *)reg->eax,0,((uint32_t *)stack_base)[1]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
771 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
772 printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
773 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
774 return 1; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
775 case 0x15000F: //NewPtr |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
776 case 0x150010: //NewPtrSys |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
777 reg->eax=(uint32_t)malloc(((uint32_t *)stack_base)[1]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
778 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
779 printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
780 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
781 return 1; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
782 case 0x15002f: //DisposePtr |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
783 if(((uint32_t *)stack_base)[1]>=0x60000000) |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
784 printf("WARNING! Invalid Ptr handle!\n"); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
785 else |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
786 free((void *)((uint32_t *)stack_base)[1]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
787 reg->eax=0; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
788 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
789 printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
790 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
791 return 1; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
792 // mutexes: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
793 case 0x1d0033: //QTMLCreateMutex |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
794 reg->eax=0xdeadbabe; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
795 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
796 printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
797 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
798 return 1; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
799 case 0x1d0034: //QTMLDestroyMutex |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
800 case 0x1d0035: //QTMLGrabMutex |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
801 case 0x1d0036: //QTMLReturnMutex |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
802 case 0x1d003d: //QTMLTryGrabMutex |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
803 reg->eax=0; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
804 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
805 printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
806 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
807 return 1; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
808 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
809 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
810 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
811 #if 0 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
812 switch(reg->eax){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
813 // case 0x00010000: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
814 // printf("FUNC: ImageCodecInitialize/ImageCodecGetCodecInfo(ci=%p,&icap=%p)\n",((uint32_t *)stack_base)[1],((uint32_t *)stack_base)[4]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
815 // break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
816 case 0x00010003: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
817 printf("FUNC: CountComponents(&desc=%p)\n",((uint32_t *)stack_base)[1]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
818 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
819 case 0x00010004: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
820 printf("FUNC: FindNextComponent(prev=%p,&desc=%p)\n",((uint32_t *)stack_base)[1],((uint32_t *)stack_base)[2]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
821 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
822 case 0x00010007: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
823 printf("FUNC: OpenComponent(prev=%p)\n",((uint32_t *)stack_base)[1]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
824 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
825 case 0x0003008b: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
826 printf("FUNC: QTNewGWorldFromPtr(&pts=%p,fourcc=%.4s,&rect=%p,x1=%p,x2=%p,x3=%p,plane=%p,stride=%d)\n", |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
827 ((uint32_t *)stack_base)[1], |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
828 &(((uint32_t *)stack_base)[2]), |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
829 ((uint32_t *)stack_base)[3], |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
830 ((uint32_t *)stack_base)[4], |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
831 ((uint32_t *)stack_base)[5], |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
832 ((uint32_t *)stack_base)[6], |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
833 ((uint32_t *)stack_base)[7], |
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
834 ((uint32_t *)stack_base)[8]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
835 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
836 case 0x001c0018: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
837 printf("FUNC: GetGWorldPixMap(gworld=%p)\n",((uint32_t *)stack_base)[1]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
838 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
839 case 0x00110001: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
840 printf("FUNC: Gestalt(fourcc=%.4s, &ret=%p)\n",&(((uint32_t *)stack_base)[1]),((uint32_t *)stack_base)[2]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
841 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
842 default: { |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
843 int i; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
844 for(i=0;qt_fv_list[i].name;i++){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
845 if(qt_fv_list[i].id==reg->eax){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
846 printf("FUNC: %s\n",qt_fv_list[i].name); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
847 break; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
848 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
849 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
850 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
851 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
852 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
853 // print stack/reg information |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
854 printf("ENTER(%d) stack = %d bytes @ %p\n" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
855 "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
856 "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
857 "flags = 0x%08x\n", ret_i, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
858 stack_size, stack_base, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
859 reg->eax, reg->edx, reg->ebx, reg->ecx, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
860 reg->esp, reg->ebp, reg->esi, reg->edi, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
861 *flags); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
862 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
863 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
864 // save ret addr: |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
865 ret_array[ret_i]=((uint32_t *)stack_base)[0]; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
866 ++ret_i; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
867 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
868 #if 0 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
869 // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
870 printf("stack[] = { "); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
871 for (i=0;i<7;i++) { |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
872 printf("%08x ", ((uint32_t *)stack_base)[i]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
873 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
874 printf("}\n\n"); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
875 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
876 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
877 // // mess with function parameters |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
878 // ((uint32_t *)stack_base)[1] = 0x66554433; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
879 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
880 // // mess with return address... |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
881 // reg->eax = 0x11223344; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
882 return 0; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
883 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
884 |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
885 static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint32_t *flags) |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
886 { |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
887 int i; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
888 short err; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
889 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
890 // restore ret addr: |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
891 --ret_i; |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
892 ((uint32_t *)stack_base)[0]=ret_array[ret_i]; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
893 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
894 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
895 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
896 #if 1 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
897 printf("%*sLEAVE(%d): 0x%X",ret_i*2,"",ret_i, reg->eax); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
898 err=reg->eax; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
899 if(err && (reg->eax>>16)==0) printf(" = %d",err); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
900 printf("\n"); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
901 fflush(stdout); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
902 #else |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
903 // print stack/reg information |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
904 printf("LEAVE(%d) stack = %d bytes @ %p\n" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
905 "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
906 "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
907 "flags = 0x%08x\n", ret_i, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
908 stack_size, stack_base, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
909 reg->eax, reg->edx, reg->ebx, reg->ecx, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
910 reg->esp, reg->ebp, reg->esi, reg->edi, |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
911 *flags); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
912 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
913 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
914 #if 0 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
915 // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
916 printf("stack[] = { "); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
917 for (i=0;i<7;i++) { |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
918 printf("%08x ", ((uint32_t *)stack_base)[i]); |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
919 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
920 printf("}\n\n"); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
921 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
922 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
923 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
924 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
925 // // mess with function parameters |
11868
711e584107af
switch to inttypes.h (u_int32_t vs uint32_t) in favour of Solaris9/x86 support
alex
parents:
10795
diff
changeset
|
926 // ((uint32_t *)stack_base)[1] = 0x66554433; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
927 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
928 // // mess with return address... |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
929 // reg->eax = 0x11223344; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
930 return 0; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
931 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
932 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
933 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
934 |
1 | 935 /*********************************************************************** |
936 * MODULE_GetProcAddress (internal) | |
937 */ | |
2069 | 938 FARPROC MODULE_GetProcAddress( |
1 | 939 HMODULE hModule, /* [in] current module handle */ |
940 LPCSTR function, /* [in] function to be looked up */ | |
941 WIN_BOOL snoop ) | |
942 { | |
943 WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); | |
2069 | 944 // WINE_MODREF *wm=local_wm; |
1 | 945 FARPROC retproc; |
946 | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
947 #ifdef DEBUG_QTX_API |
1 | 948 if (HIWORD(function)) |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
949 fprintf(stderr,"XXX GetProcAddress(%08lx,%s)\n",(DWORD)hModule,function); |
1 | 950 else |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
951 fprintf(stderr,"XXX GetProcAddress(%08lx,%p)\n",(DWORD)hModule,function); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
952 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
953 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
954 // TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
955 // else |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
956 // TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
957 |
1 | 958 if (!wm) { |
959 SetLastError(ERROR_INVALID_HANDLE); | |
960 return (FARPROC)0; | |
961 } | |
962 switch (wm->type) | |
963 { | |
964 case MODULE32_PE: | |
965 retproc = PE_FindExportedFunction( wm, function, snoop ); | |
966 if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
967 break; |
2069 | 968 #ifdef HAVE_LIBDL |
1 | 969 case MODULE32_ELF: |
2069 | 970 retproc = (FARPROC) dlsym( (void*) wm->module, function); |
1 | 971 if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); |
972 return retproc; | |
973 #endif | |
974 default: | |
975 ERR("wine_modref type %d not handled.\n",wm->type); | |
976 SetLastError(ERROR_INVALID_HANDLE); | |
977 return (FARPROC)0; | |
978 } | |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
979 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
980 #ifdef EMU_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
981 if (HIWORD(function) && retproc){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
982 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
983 #ifdef DEBUG_QTX_API |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
984 #define DECL_COMPONENT(sname,name,type) \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
985 if(!strcmp(function,name)){ \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
986 fprintf(stderr,name "dispatcher catched -> %p\n",retproc); \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
987 real_ ## sname = retproc; retproc = fake_ ## sname; \ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
988 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
989 #include "qt_comp.h" |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
990 #undef DECL_COMPONENT |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
991 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
992 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
993 if(!strcmp(function,"theQuickTimeDispatcher") |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
994 // || !strcmp(function,"_CallComponentFunctionWithStorage") |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
995 // || !strcmp(function,"_CallComponent") |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
996 ){ |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
997 fprintf(stderr,"theQuickTimeDispatcher catched -> %p\n",retproc); |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
998 report_entry = report_func; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
999 report_ret = report_func_ret; |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1000 wrapper_target=retproc; |
8451 | 1001 retproc=(FARPROC)wrapper; |
8269
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1002 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1003 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1004 } |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1005 #endif |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1006 |
8b905703a450
- qtx (quicktime's macos emulation layer) debugging/emulation environment :)
arpi
parents:
7386
diff
changeset
|
1007 return retproc; |
1 | 1008 } |
1009 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1010 static int acounter = 0; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1011 void CodecAlloc(void) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1012 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1013 acounter++; |
3465 | 1014 //printf("**************CODEC ALLOC %d\n", acounter); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1015 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1016 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1017 void CodecRelease(void) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1018 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1019 acounter--; |
3465 | 1020 //printf("**************CODEC RELEASE %d\n", acounter); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1021 if (acounter == 0) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1022 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1023 for (;;) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1024 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1025 modref_list* list = local_wm; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1026 if (!local_wm) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1027 break; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1028 //printf("CODECRELEASE %p\n", list); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1029 MODULE_FreeLibrary(list->wm); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1030 MODULE_RemoveFromList(list->wm); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1031 if (local_wm == NULL) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1032 my_garbagecollection(); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1033 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1034 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
1035 } |