comparison loader/win32.c @ 5751:271bd43aed88

loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
author alex
date Sun, 21 Apr 2002 02:13:11 +0000
parents 16a7eee0aca3
children 3f6b724efe83
comparison
equal deleted inserted replaced
5750:16fed1cbe1c7 5751:271bd43aed88
193 if (verbose > 2) 193 if (verbose > 2)
194 { 194 {
195 va_list va; 195 va_list va;
196 196
197 va_start(va, fmt); 197 va_start(va, fmt);
198 // vprintf(fmt, va);
198 mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va); 199 mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va);
199 va_end(va); 200 va_end(va);
200 } 201 }
201 #endif 202 #endif
202 } 203 }
2811 2812
2812 static int WINAPI expIsRectEmpty(CONST RECT *lprc) 2813 static int WINAPI expIsRectEmpty(CONST RECT *lprc)
2813 { 2814 {
2814 int r = (!lprc || (lprc->right == lprc->left) || (lprc->top == lprc->bottom)); 2815 int r = (!lprc || (lprc->right == lprc->left) || (lprc->top == lprc->bottom));
2815 dbgprintf("IsRectEmpty(%p) => %s\n", lprc, (r) ? "TRUE" : "FALSE"); 2816 dbgprintf("IsRectEmpty(%p) => %s\n", lprc, (r) ? "TRUE" : "FALSE");
2817 // printf("Rect: left: %d, top: %d, right: %d, bottom: %d\n",
2818 // lprc->left, lprc->top, lprc->right, lprc->bottom);
2816 return r; 2819 return r;
2817 } 2820 }
2818 2821
2819 static int _adjust_fdiv=0; //what's this? - used to adjust division 2822 static int _adjust_fdiv=0; //what's this? - used to adjust division
2820 2823
4071 printf("ERROR: library=0\n"); 4074 printf("ERROR: library=0\n");
4072 return (void*)ext_unknown; 4075 return (void*)ext_unknown;
4073 } 4076 }
4074 // printf("%x %x\n", &unk_exp1, &unk_exp2); 4077 // printf("%x %x\n", &unk_exp1, &unk_exp2);
4075 4078
4079 printf("External func %s:%d\n", library, ordinal);
4080
4081 /* ok, this is a hack, and a big memory leak. should be fixed. - alex */
4082 {
4083 HMODULE *hand;
4084 WINE_MODREF *wm;
4085 void *func;
4086
4087 hand = LoadLibraryA(library);
4088 if (!hand)
4089 goto no_dll;
4090 wm = MODULE32_LookupHMODULE(hand);
4091 if (!wm)
4092 {
4093 FreeLibrary(hand);
4094 goto no_dll;
4095 }
4096 func = PE_FindExportedFunction(wm, ordinal, 0);
4097 if (!func)
4098 {
4099 printf("No such ordinal in external dll\n");
4100 FreeLibrary(hand);
4101 goto no_dll;
4102 }
4103
4104 printf("External dll loaded (offset: %p, func: %p)\n",
4105 hand, func);
4106 return func;
4107 }
4108
4109 no_dll:
4076 for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++) 4110 for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
4077 { 4111 {
4078 if(strcasecmp(library, libraries[i].name)) 4112 if(strcasecmp(library, libraries[i].name))
4079 continue; 4113 continue;
4080 for(j=0; j<libraries[i].length; j++) 4114 for(j=0; j<libraries[i].length; j++)
4083 continue; 4117 continue;
4084 //printf("Hit: 0x%p\n", libraries[i].exps[j].func); 4118 //printf("Hit: 0x%p\n", libraries[i].exps[j].func);
4085 return libraries[i].exps[j].func; 4119 return libraries[i].exps[j].func;
4086 } 4120 }
4087 } 4121 }
4088 printf("External func %s:%d\n", library, ordinal);
4089 if(pos>150)return 0; 4122 if(pos>150)return 0;
4090 sprintf(export_names[pos], "%s:%d", library, ordinal); 4123 sprintf(export_names[pos], "%s:%d", library, ordinal);
4091 return add_stub(pos); 4124 return add_stub(pos);
4092 } 4125 }
4093 4126