X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libs%2Floader%2Fmodule.c;h=e88b9f464ea252347dab28d3d2eb6540d94dd949;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=2e42dff415a6fee572080542f852faf3547a2e26;hpb=3305b049e7f587b23359a1c9047fb5763d19c1dc;p=vlc diff --git a/libs/loader/module.c b/libs/loader/module.c index 2e42dff415..e88b9f464e 100644 --- a/libs/loader/module.c +++ b/libs/loader/module.c @@ -80,14 +80,14 @@ WINE_MODREF* MODULE_FindModule(LPCSTR m) modref_list* list=local_wm; TRACE("FindModule: Module %s request\n", m); if(list==NULL) - return NULL; + return NULL; // while(strcmp(m, list->wm->filename)) while(!strstr(list->wm->filename, m)) { - TRACE("%s: %x\n", list->wm->filename, list->wm->module); - list=list->prev; - if(list==NULL) - return NULL; + TRACE("%s: %x\n", list->wm->filename, list->wm->module); + list=list->prev; + if(list==NULL) + return NULL; } TRACE("Resolved to %s\n", list->wm->filename); return list->wm; @@ -97,29 +97,29 @@ static void MODULE_RemoveFromList(WINE_MODREF *mod) { modref_list* list=local_wm; if(list==0) - return; + return; if(mod==0) - return; + return; if((list->prev==NULL)&&(list->next==NULL)) { - free(list); - local_wm=NULL; -// uninstall_fs(); - return; + free(list); + local_wm=NULL; +// uninstall_fs(); + return; } for(;list;list=list->prev) { - if(list->wm==mod) - { - if(list->prev) - list->prev->next=list->next; - if(list->next) - list->next->prev=list->prev; - if(list==local_wm) - local_wm=list->prev; - free(list); - return; - } + if(list->wm==mod) + { + if(list->prev) + list->prev->next=list->next; + if(list->next) + list->next->prev=list->prev; + if(list==local_wm) + local_wm=list->prev; + free(list); + return; + } } } @@ -130,26 +130,26 @@ WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m) TRACE("LookupHMODULE: Module %X request\n", m); if(list==NULL) { - TRACE("LookupHMODULE failed\n"); - return NULL; + TRACE("LookupHMODULE failed\n"); + return NULL; } while(m!=list->wm->module) { // printf("Checking list %X wm %X module %X\n", -// list, list->wm, list->wm->module); - list=list->prev; - if(list==NULL) - { - TRACE("LookupHMODULE failed\n"); - return NULL; - } +// list, list->wm, list->wm->module); + list=list->prev; + if(list==NULL) + { + TRACE("LookupHMODULE failed\n"); + return NULL; + } } TRACE("LookupHMODULE hit %p\n", list->wm); return list->wm; } /************************************************************************* - * MODULE_InitDll + * MODULE_InitDll */ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) { @@ -195,7 +195,7 @@ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) } /************************************************************************* - * MODULE_DllProcessAttach + * MODULE_DllProcessAttach * * Send the process attach notification to all DLLs the given module * depends on (recursively). This is somewhat complicated due to the fact that @@ -252,7 +252,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) //local_wm=wm; if(local_wm) { - local_wm->next = (modref_list*) malloc(sizeof(modref_list)); + local_wm->next = (modref_list*) malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; @@ -260,9 +260,9 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) } else { - local_wm = (modref_list*)malloc(sizeof(modref_list)); - local_wm->next=local_wm->prev=NULL; - local_wm->wm=wm; + local_wm = (modref_list*)malloc(sizeof(modref_list)); + local_wm->next=local_wm->prev=NULL; + local_wm->wm=wm; } /* Remove recursion flag */ wm->flags &= ~WINE_MODREF_MARKER; @@ -281,7 +281,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) } /************************************************************************* - * MODULE_DllProcessDetach + * MODULE_DllProcessDetach * * Send DLL process detach notifications. See the comment about calling * sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag @@ -295,15 +295,15 @@ static void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPV MODULE_InitDll( wm, DLL_PROCESS_DETACH, lpReserved ); /* while (l) { - modref_list* f = l; - l = l->next; - free(f); + modref_list* f = l; + l = l->next; + free(f); } local_wm = 0;*/ } /*********************************************************************** - * MODULE_LoadLibraryExA (internal) + * MODULE_LoadLibraryExA (internal) * * Load a PE style module according to the load order. * @@ -315,38 +315,38 @@ static void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPV */ static WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags ) { - DWORD err = GetLastError(); - WINE_MODREF *pwm; - int i; -// module_loadorder_t *plo; + DWORD err = GetLastError(); + WINE_MODREF *pwm; + int i; +// module_loadorder_t *plo; SetLastError( ERROR_FILE_NOT_FOUND ); - TRACE("Trying native dll '%s'\n", libname); - pwm = PE_LoadLibraryExA(libname, flags); + TRACE("Trying native dll '%s'\n", libname); + pwm = PE_LoadLibraryExA(libname, flags); #ifdef HAVE_LIBDL - if(!pwm) - { - TRACE("Trying ELF dll '%s'\n", libname); - pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags); - } + if(!pwm) + { + TRACE("Trying ELF dll '%s'\n", libname); + pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags); + } #endif -// printf("0x%08x\n", pwm); -// break; - if(pwm) - { - /* Initialize DLL just loaded */ - TRACE("Loaded module '%s' at 0x%08x, \n", libname, pwm->module); - /* Set the refCount here so that an attach failure will */ - /* decrement the dependencies through the MODULE_FreeLibrary call. */ - pwm->refCount++; +// printf("0x%08x\n", pwm); +// break; + if(pwm) + { + /* Initialize DLL just loaded */ + TRACE("Loaded module '%s' at 0x%08x, \n", libname, pwm->module); + /* Set the refCount here so that an attach failure will */ + /* decrement the dependencies through the MODULE_FreeLibrary call. */ + pwm->refCount++; SetLastError( err ); /* restore last error */ - return pwm; - } + return pwm; + } - WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError()); - return NULL; + WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError()); + return NULL; } /*********************************************************************** @@ -376,85 +376,85 @@ static WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm ) */ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) { - WINE_MODREF *wm = 0; - char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", "/usr/lib/codecs", "/usr/local/lib/codecs", 0 }; - extern char* def_path; - char path[512]; - char checked[2000]; + WINE_MODREF *wm = 0; + char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", "/usr/lib/codecs", "/usr/local/lib/codecs", 0 }; + extern char* def_path; + char path[512]; + char checked[2000]; int i = -1; checked[0] = 0; - if(!libname) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - wm=MODULE_FindModule(libname); - if(wm) return wm->module; - -// if(fs_installed==0) -// install_fs(); - - while (wm == 0 && listpath[++i]) - { - if (i < 2) - { - if (i == 0) - /* check just original file name */ - strncpy(path, libname, 511); + if(!libname) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + wm=MODULE_FindModule(libname); + if(wm) return wm->module; + +// if(fs_installed==0) +// install_fs(); + + while (wm == 0 && listpath[++i]) + { + if (i < 2) + { + if (i == 0) + /* check just original file name */ + strncpy(path, libname, 511); else - /* check default user path */ - strncpy(path, def_path, 300); - } - else if (strcmp(def_path, listpath[i])) + /* check default user path */ + strncpy(path, def_path, 300); + } + else if (strcmp(def_path, listpath[i])) /* path from the list */ - strncpy(path, listpath[i], 300); - else - continue; - - if (i > 0) - { - strcat(path, "/"); - strncat(path, libname, 100); - } - path[511] = 0; - wm = MODULE_LoadLibraryExA( path, hfile, flags ); - - if (!wm) - { - if (checked[0]) - strcat(checked, ", "); - strcat(checked, path); + strncpy(path, listpath[i], 300); + else + continue; + + if (i > 0) + { + strcat(path, "/"); + strncat(path, libname, 100); + } + path[511] = 0; + wm = MODULE_LoadLibraryExA( path, hfile, flags ); + + if (!wm) + { + if (checked[0]) + strcat(checked, ", "); + strcat(checked, path); checked[1500] = 0; - } - } - if ( wm ) - { - if ( !MODULE_DllProcessAttach( wm, NULL ) ) - { - WARN_(module)("Attach failed for module '%s', \n", libname); - MODULE_FreeLibrary(wm); - SetLastError(ERROR_DLL_INIT_FAILED); - MODULE_RemoveFromList(wm); - wm = NULL; - } - } - - if (!wm) - printf("Win32 LoadLibrary failed to load: %s\n", checked); - - if (strstr(libname,"vp31vfw.dll") && wm) - { - int i; - - // sse hack moved from patch dll into runtime patching + } + } + if ( wm ) + { + if ( !MODULE_DllProcessAttach( wm, NULL ) ) + { + WARN_(module)("Attach failed for module '%s', \n", libname); + MODULE_FreeLibrary(wm); + SetLastError(ERROR_DLL_INIT_FAILED); + MODULE_RemoveFromList(wm); + wm = NULL; + } + } + + if (!wm) + printf("Win32 LoadLibrary failed to load: %s\n", checked); + + if (strstr(libname,"vp31vfw.dll") && wm) + { + int i; + + // sse hack moved from patch dll into runtime patching if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==(void*)0x10001000) { - fprintf(stderr, "VP3 DLL found\n"); - for (i=0;i<18;i++) ((char*)0x10004bd6)[i]=0x90; - } - } + fprintf(stderr, "VP3 DLL found\n"); + for (i=0;i<18;i++) ((char*)0x10004bd6)[i]=0x90; + } + } // remove a few divs in the VP codecs that make trouble if (strstr(libname,"vp5vfw.dll") && wm) @@ -508,78 +508,78 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) } } - if (strstr(libname,"QuickTime.qts") && wm) - { - void** ptr; - void *dispatch_addr; - int i; - -// dispatch_addr = GetProcAddress(wm->module, "theQuickTimeDispatcher", TRUE); - dispatch_addr = PE_FindExportedFunction(wm, "theQuickTimeDispatcher", TRUE); - if (dispatch_addr == (void *)0x62924c30) - { - fprintf(stderr, "QuickTime5 DLLs found\n"); - ptr = (void **)0x62b75ca4; // dispatch_ptr - for (i=0;i<5;i++) ((char*)0x6299e842)[i]=0x90; // make_new_region ? - for (i=0;i<28;i++) ((char*)0x6299e86d)[i]=0x90; // call__call_CreateCompatibleDC ? - for (i=0;i<5;i++) ((char*)0x6299e898)[i]=0x90; // jmp_to_call_loadbitmap ? - for (i=0;i<9;i++) ((char*)0x6299e8ac)[i]=0x90; // call__calls_OLE_shit ? - for (i=0;i<106;i++) ((char*)0x62a61b10)[i]=0x90; // disable threads + if (strstr(libname,"QuickTime.qts") && wm) + { + void** ptr; + void *dispatch_addr; + int i; + +// dispatch_addr = GetProcAddress(wm->module, "theQuickTimeDispatcher", TRUE); + dispatch_addr = PE_FindExportedFunction(wm, "theQuickTimeDispatcher", TRUE); + if (dispatch_addr == (void *)0x62924c30) + { + fprintf(stderr, "QuickTime5 DLLs found\n"); + ptr = (void **)0x62b75ca4; // dispatch_ptr + for (i=0;i<5;i++) ((char*)0x6299e842)[i]=0x90; // make_new_region ? + for (i=0;i<28;i++) ((char*)0x6299e86d)[i]=0x90; // call__call_CreateCompatibleDC ? + for (i=0;i<5;i++) ((char*)0x6299e898)[i]=0x90; // jmp_to_call_loadbitmap ? + for (i=0;i<9;i++) ((char*)0x6299e8ac)[i]=0x90; // call__calls_OLE_shit ? + for (i=0;i<106;i++) ((char*)0x62a61b10)[i]=0x90; // disable threads #if 0 - /* CreateThread callers */ - for (i=0;i<5;i++) ((char*)0x629487c5)[i]=0x90; - for (i=0;i<5;i++) ((char*)0x6294b275)[i]=0x90; - for (i=0;i<5;i++) ((char*)0x629a24b1)[i]=0x90; - for (i=0;i<5;i++) ((char*)0x629afc5a)[i]=0x90; - for (i=0;i<5;i++) ((char*)0x62af799c)[i]=0x90; - for (i=0;i<5;i++) ((char*)0x62af7efe)[i]=0x90; - for (i=0;i<5;i++) ((char*)0x62afa33e)[i]=0x90; + /* CreateThread callers */ + for (i=0;i<5;i++) ((char*)0x629487c5)[i]=0x90; + for (i=0;i<5;i++) ((char*)0x6294b275)[i]=0x90; + for (i=0;i<5;i++) ((char*)0x629a24b1)[i]=0x90; + for (i=0;i<5;i++) ((char*)0x629afc5a)[i]=0x90; + for (i=0;i<5;i++) ((char*)0x62af799c)[i]=0x90; + for (i=0;i<5;i++) ((char*)0x62af7efe)[i]=0x90; + for (i=0;i<5;i++) ((char*)0x62afa33e)[i]=0x90; #endif #if 0 - /* TerminateQTML fix */ - for (i=0;i<47;i++) ((char*)0x62afa3b8)[i]=0x90; // terminate thread - for (i=0;i<47;i++) ((char*)0x62af7f78)[i]=0x90; // terminate thread - for (i=0;i<77;i++) ((char*)0x629a13d5)[i]=0x90; - ((char *)0x6288e0ae)[0] = 0xc3; // font/dc remover - for (i=0;i<24;i++) ((char*)0x6287a1ad)[i]=0x90; // destroy window + /* TerminateQTML fix */ + for (i=0;i<47;i++) ((char*)0x62afa3b8)[i]=0x90; // terminate thread + for (i=0;i<47;i++) ((char*)0x62af7f78)[i]=0x90; // terminate thread + for (i=0;i<77;i++) ((char*)0x629a13d5)[i]=0x90; + ((char *)0x6288e0ae)[0] = 0xc3; // font/dc remover + for (i=0;i<24;i++) ((char*)0x6287a1ad)[i]=0x90; // destroy window #endif - } else if (dispatch_addr == (void *)0x6693b330) - { - fprintf(stderr, "QuickTime6 DLLs found\n"); - ptr = (void **)0x66bb9524; // dispatcher_ptr - for (i=0;i<5;i++) ((char *)0x66a730cc)[i]=0x90; // make_new_region - for (i=0;i<28;i++) ((char *)0x66a730f7)[i]=0x90; // call__call_CreateCompatibleDC - for (i=0;i<5;i++) ((char *)0x66a73122)[i]=0x90; // jmp_to_call_loadbitmap - for (i=0;i<9;i++) ((char *)0x66a73131)[i]=0x90; // call__calls_OLE_shit - for (i=0;i<96;i++) ((char *)0x66aac852)[i]=0x90; // disable threads - } else if (dispatch_addr == (void *)0x6693c3e0) - { - fprintf(stderr, "QuickTime6.3 DLLs found\n"); - ptr = (void **)0x66bca01c; // dispatcher_ptr - for (i=0;i<5;i++) ((char *)0x66a68f6c)[i]=0x90; // make_new_region - for (i=0;i<28;i++) ((char *)0x66a68f97)[i]=0x90; // call__call_CreateCompatibleDC - for (i=0;i<5;i++) ((char *)0x66a68fc2)[i]=0x90; // jmp_to_call_loadbitmap - for (i=0;i<9;i++) ((char *)0x66a68fd1)[i]=0x90; // call__calls_OLE_shit - for (i=0;i<96;i++) ((char *)0x66ab4722)[i]=0x90; // disable threads - } else - { - fprintf(stderr, "Unsupported QuickTime version (%p)\n", - dispatch_addr); - return 0; - } - - fprintf(stderr,"QuickTime.qts patched!!! old entry=%p\n",ptr[0]); + } else if (dispatch_addr == (void *)0x6693b330) + { + fprintf(stderr, "QuickTime6 DLLs found\n"); + ptr = (void **)0x66bb9524; // dispatcher_ptr + for (i=0;i<5;i++) ((char *)0x66a730cc)[i]=0x90; // make_new_region + for (i=0;i<28;i++) ((char *)0x66a730f7)[i]=0x90; // call__call_CreateCompatibleDC + for (i=0;i<5;i++) ((char *)0x66a73122)[i]=0x90; // jmp_to_call_loadbitmap + for (i=0;i<9;i++) ((char *)0x66a73131)[i]=0x90; // call__calls_OLE_shit + for (i=0;i<96;i++) ((char *)0x66aac852)[i]=0x90; // disable threads + } else if (dispatch_addr == (void *)0x6693c3e0) + { + fprintf(stderr, "QuickTime6.3 DLLs found\n"); + ptr = (void **)0x66bca01c; // dispatcher_ptr + for (i=0;i<5;i++) ((char *)0x66a68f6c)[i]=0x90; // make_new_region + for (i=0;i<28;i++) ((char *)0x66a68f97)[i]=0x90; // call__call_CreateCompatibleDC + for (i=0;i<5;i++) ((char *)0x66a68fc2)[i]=0x90; // jmp_to_call_loadbitmap + for (i=0;i<9;i++) ((char *)0x66a68fd1)[i]=0x90; // call__calls_OLE_shit + for (i=0;i<96;i++) ((char *)0x66ab4722)[i]=0x90; // disable threads + } else + { + fprintf(stderr, "Unsupported QuickTime version (%p)\n", + dispatch_addr); + return 0; + } + + fprintf(stderr,"QuickTime.qts patched!!! old entry=%p\n",ptr[0]); #ifdef EMU_QTX_API - report_entry = report_func; - report_ret = report_func_ret; - wrapper_target=ptr[0]; - ptr[0]=wrapper; + report_entry = report_func; + report_ret = report_func_ret; + wrapper_target=ptr[0]; + ptr[0]=wrapper; #endif - } + } - return wm ? wm->module : 0; + return wm ? wm->module : 0; } @@ -587,7 +587,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) * LoadLibraryA (KERNEL32) */ HMODULE WINAPI LoadLibraryA(LPCSTR libname) { - return LoadLibraryExA(libname,0,0); + return LoadLibraryExA(libname,0,0); } /*********************************************************************** @@ -603,7 +603,7 @@ WIN_BOOL WINAPI FreeLibrary(HINSTANCE hLibModule) if ( !wm || !hLibModule ) { SetLastError( ERROR_INVALID_HANDLE ); - return 0; + return 0; } else retv = MODULE_FreeLibrary( wm ); @@ -647,7 +647,7 @@ static void MODULE_DecRefCount( WINE_MODREF *wm ) } /*********************************************************************** - * GetProcAddress (KERNEL32.257) + * GetProcAddress (KERNEL32.257) */ FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) { @@ -656,7 +656,7 @@ FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) #ifdef DEBUG_QTX_API -/* +/* http://lists.apple.com/archives/quicktime-api/2003/Jan/msg00278.html */ @@ -722,23 +722,23 @@ static int dump_component(char* name,int type,void* _orig, ComponentParameters * 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)); for(i=0;iparamSize/4;i++) - fprintf(stderr,"%*s param[%d] = 0x%X\n",3*c_level,"",i,params->params[i]); + fprintf(stderr,"%*s param[%d] = 0x%X\n",3*c_level,"",i,params->params[i]); ++c_level; ret=orig(params,glob); --c_level; - + if(ret>=0x1000) - fprintf(stderr,"%*s return=0x%X\n",3*c_level,"",ret); + fprintf(stderr,"%*s return=0x%X\n",3*c_level,"",ret); else - fprintf(stderr,"%*s return=%d\n",3*c_level,"",ret); + fprintf(stderr,"%*s return=%d\n",3*c_level,"",ret); return ret; } #define DECL_COMPONENT(sname,name,type) \ static void* real_ ## sname = NULL; \ static int fake_ ## sname(ComponentParameters *params,void** glob){ \ - return dump_component(name,type,real_ ## sname, params, glob); \ + return dump_component(name,type,real_ ## sname, params, glob); \ } #include "qt_comp.h" @@ -764,47 +764,47 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t char* pname=NULL; int plen=-1; // find the code: - + dptr=0x62b67ae0;dptr+=2*((reg->eax>>16)&255); // printf("FUNC: flag=%d ptr=%p\n",dptr[0],dptr[1]); if(dptr[0]&255){ dptr=dptr[1];dptr+=4*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",dptr[1],dptr[0],dptr[2]); - pwrapper=dptr[1]; pptr=dptr[0]; plen=dptr[2]; + pwrapper=dptr[1]; pptr=dptr[0]; plen=dptr[2]; } else { pwrapper=0x62924910; switch(dptr[1]){ case 0x629248d0: dptr=0x62b672c0;dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; - break; + pptr=dptr[0]; plen=dptr[1]; + break; case 0x62924e40: dptr=0x62b67c70;dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; - break; + pptr=dptr[0]; plen=dptr[1]; + break; case 0x62924e60: dptr=0x62b68108;if(reg->eax&0x8000) dptr+=2*(reg->eax|0xffff0000); else dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; - break; + pptr=dptr[0]; plen=dptr[1]; + break; case 0x62924e80: dptr=0x62b68108;if(reg->eax&0x8000) dptr+=2*(reg->eax|0xffff0000); else dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; - break; + pptr=dptr[0]; plen=dptr[1]; + break; default: printf("FUNC: unknown ptr & psize!\n"); - pwrapper=dptr[1]; + pwrapper=dptr[1]; } } for(i=0;qt_fv_list[i].name;i++){ if(qt_fv_list[i].id==reg->eax){ - pname=qt_fv_list[i].name; - break; - } + pname=qt_fv_list[i].name; + break; + } } printf("FUNC[%X/%s]: wrapper=%p func=%p len=%d\n",reg->eax, @@ -830,7 +830,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t fflush(stdout); #endif - + #if 1 // emulate some functions: switch(reg->eax){ @@ -914,22 +914,22 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t int i; for(i=0;qt_fv_list[i].name;i++){ if(qt_fv_list[i].id==reg->eax){ - printf("FUNC: %s\n",qt_fv_list[i].name); - break; - } + printf("FUNC: %s\n",qt_fv_list[i].name); + break; + } } } } - // print stack/reg information + // print stack/reg information printf("ENTER(%d) stack = %d bytes @ %p\n" - "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" - "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" - "flags = 0x%08x\n", ret_i, - stack_size, stack_base, - reg->eax, reg->edx, reg->ebx, reg->ecx, - reg->esp, reg->ebp, reg->esi, reg->edi, - *flags); + "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" + "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" + "flags = 0x%08x\n", ret_i, + stack_size, stack_base, + reg->eax, reg->edx, reg->ebx, reg->ecx, + reg->esp, reg->ebp, reg->esi, reg->edi, + *flags); #endif // save ret addr: @@ -937,15 +937,15 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t ++ret_i; #if 0 - // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) + // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) printf("stack[] = { "); for (i=0;i<7;i++) { printf("%08x ", ((uint32_t *)stack_base)[i]); } printf("}\n\n"); #endif - -// // mess with function parameters + +// // mess with function parameters // ((uint32_t *)stack_base)[1] = 0x66554433; // // mess with return address... @@ -971,19 +971,19 @@ static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint printf("\n"); fflush(stdout); #else - // print stack/reg information + // print stack/reg information printf("LEAVE(%d) stack = %d bytes @ %p\n" - "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" - "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" - "flags = 0x%08x\n", ret_i, - stack_size, stack_base, - reg->eax, reg->edx, reg->ebx, reg->ecx, - reg->esp, reg->ebp, reg->esi, reg->edi, - *flags); + "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" + "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" + "flags = 0x%08x\n", ret_i, + stack_size, stack_base, + reg->eax, reg->edx, reg->ebx, reg->ecx, + reg->esp, reg->ebp, reg->esi, reg->edi, + *flags); #endif #if 0 - // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) + // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) printf("stack[] = { "); for (i=0;i<7;i++) { printf("%08x ", ((uint32_t *)stack_base)[i]); @@ -992,8 +992,8 @@ static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint #endif #endif - -// // mess with function parameters + +// // mess with function parameters // ((uint32_t *)stack_base)[1] = 0x66554433; // // mess with return address... @@ -1004,48 +1004,48 @@ static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint #endif /*********************************************************************** - * MODULE_GetProcAddress (internal) + * MODULE_GetProcAddress (internal) */ FARPROC MODULE_GetProcAddress( - HMODULE hModule, /* [in] current module handle */ - LPCSTR function, /* [in] function to be looked up */ - WIN_BOOL snoop ) + HMODULE hModule, /* [in] current module handle */ + LPCSTR function, /* [in] function to be looked up */ + WIN_BOOL snoop ) { - WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); + WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); // WINE_MODREF *wm=local_wm; - FARPROC retproc; + FARPROC retproc; #ifdef DEBUG_QTX_API if (HIWORD(function)) - fprintf(stderr,"XXX GetProcAddress(%08lx,%s)\n",(DWORD)hModule,function); + fprintf(stderr,"XXX GetProcAddress(%08lx,%s)\n",(DWORD)hModule,function); else - fprintf(stderr,"XXX GetProcAddress(%08lx,%p)\n",(DWORD)hModule,function); + fprintf(stderr,"XXX GetProcAddress(%08lx,%p)\n",(DWORD)hModule,function); #endif -// TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function); +// TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function); // else -// TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function); +// TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function); if (!wm) { - SetLastError(ERROR_INVALID_HANDLE); + SetLastError(ERROR_INVALID_HANDLE); return (FARPROC)0; } switch (wm->type) { case MODULE32_PE: - retproc = PE_FindExportedFunction( wm, function, snoop ); - if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); - break; + retproc = PE_FindExportedFunction( wm, function, snoop ); + if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); + break; #ifdef HAVE_LIBDL case MODULE32_ELF: - retproc = (FARPROC) dlsym( (void*) wm->module, function); - if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); - return retproc; + retproc = (FARPROC) dlsym( (void*) wm->module, function); + if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); + return retproc; #endif default: - ERR("wine_modref type %d not handled.\n",wm->type); - SetLastError(ERROR_INVALID_HANDLE); - return (FARPROC)0; + ERR("wine_modref type %d not handled.\n",wm->type); + SetLastError(ERROR_INVALID_HANDLE); + return (FARPROC)0; } #ifdef EMU_QTX_API @@ -1054,8 +1054,8 @@ FARPROC MODULE_GetProcAddress( #ifdef DEBUG_QTX_API #define DECL_COMPONENT(sname,name,type) \ if(!strcmp(function,name)){ \ - fprintf(stderr,name "dispatcher catched -> %p\n",retproc); \ - real_ ## sname = retproc; retproc = fake_ ## sname; \ + fprintf(stderr,name "dispatcher catched -> %p\n",retproc); \ + real_ ## sname = retproc; retproc = fake_ ## sname; \ } #include "qt_comp.h" #undef DECL_COMPONENT @@ -1065,7 +1065,7 @@ FARPROC MODULE_GetProcAddress( // || !strcmp(function,"_CallComponentFunctionWithStorage") // || !strcmp(function,"_CallComponent") ){ - fprintf(stderr,"theQuickTimeDispatcher catched -> %p\n",retproc); + fprintf(stderr,"theQuickTimeDispatcher catched -> %p\n",retproc); report_entry = report_func; report_ret = report_func_ret; wrapper_target=(void(*)(void))retproc; @@ -1091,16 +1091,16 @@ void CodecRelease(void) //printf("**************CODEC RELEASE %d\n", acounter); if (acounter == 0) { - for (;;) - { - modref_list* list = local_wm; - if (!local_wm) - break; - //printf("CODECRELEASE %p\n", list); + for (;;) + { + modref_list* list = local_wm; + if (!local_wm) + break; + //printf("CODECRELEASE %p\n", list); MODULE_FreeLibrary(list->wm); - MODULE_RemoveFromList(list->wm); + MODULE_RemoveFromList(list->wm); if (local_wm == NULL) - my_garbagecollection(); - } + my_garbagecollection(); + } } }