From 5d96eee63507bf6cf5e811221f86e8c3468eabd1 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 21 Apr 2002 02:13:11 +0000 Subject: 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 --- loader/win32.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'loader') 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; i150)return 0; sprintf(export_names[pos], "%s:%d", library, ordinal); return add_stub(pos); -- cgit v1.2.3