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