[Mplayer-cvslog] CVS: main/loader win32.c,1.52,1.53

Alex Beregszaszi alex at mplayerhq.hu
Sun Apr 21 04:13:14 CEST 2002


Update of /cvsroot/mplayer/main/loader
In directory mail:/var/tmp.root/cvs-serv19240

Modified Files:
	win32.c 
Log Message:
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec

Index: win32.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- win32.c	21 Apr 2002 00:52:11 -0000	1.52
+++ win32.c	21 Apr 2002 02:13:11 -0000	1.53
@@ -195,6 +195,7 @@
 	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 @@
 {
     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 @@
     }
     //    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 @@
 	    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);




More information about the MPlayer-cvslog mailing list