summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-04-21 02:13:11 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-04-21 02:13:11 +0000
commit5d96eee63507bf6cf5e811221f86e8c3468eabd1 (patch)
treea5f62916f4955aa6d11d60be2f627822c403f049 /loader
parentfb8674f72515e5af91a62217d05c4c89d88668bf (diff)
downloadmpv-5d96eee63507bf6cf5e811221f86e8c3468eabd1.tar.bz2
mpv-5d96eee63507bf6cf5e811221f86e8c3468eabd1.tar.xz
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5752 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r--loader/win32.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/loader/win32.c b/loader/win32.c
index a35b857da8..37105ccaa9 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -195,6 +195,7 @@ static inline void dbgprintf(char* fmt, ...)
va_list va;
va_start(va, fmt);
+// vprintf(fmt, va);
mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va);
va_end(va);
}
@@ -2813,6 +2814,8 @@ static int WINAPI expIsRectEmpty(CONST RECT *lprc)
{
int r = (!lprc || (lprc->right == lprc->left) || (lprc->top == lprc->bottom));
dbgprintf("IsRectEmpty(%p) => %s\n", lprc, (r) ? "TRUE" : "FALSE");
+// printf("Rect: left: %d, top: %d, right: %d, bottom: %d\n",
+// lprc->left, lprc->top, lprc->right, lprc->bottom);
return r;
}
@@ -4073,6 +4076,37 @@ void* LookupExternal(const char* library, int ordinal)
}
// printf("%x %x\n", &unk_exp1, &unk_exp2);
+ printf("External func %s:%d\n", library, ordinal);
+
+ /* ok, this is a hack, and a big memory leak. should be fixed. - alex */
+ {
+ HMODULE *hand;
+ WINE_MODREF *wm;
+ void *func;
+
+ hand = LoadLibraryA(library);
+ if (!hand)
+ goto no_dll;
+ wm = MODULE32_LookupHMODULE(hand);
+ if (!wm)
+ {
+ FreeLibrary(hand);
+ goto no_dll;
+ }
+ func = PE_FindExportedFunction(wm, ordinal, 0);
+ if (!func)
+ {
+ printf("No such ordinal in external dll\n");
+ FreeLibrary(hand);
+ goto no_dll;
+ }
+
+ printf("External dll loaded (offset: %p, func: %p)\n",
+ hand, func);
+ return func;
+ }
+
+no_dll:
for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
{
if(strcasecmp(library, libraries[i].name))
@@ -4085,7 +4119,6 @@ void* LookupExternal(const char* library, int ordinal)
return libraries[i].exps[j].func;
}
}
- printf("External func %s:%d\n", library, ordinal);
if(pos>150)return 0;
sprintf(export_names[pos], "%s:%d", library, ordinal);
return add_stub(pos);