mmsystem should be loaded at startup

Joshua Thielen thielen at netprince.net
Fri Nov 23 14:59:16 CST 2001


Hello everybody,

Finale expects mmsystem to be present without having to call LoadLibrary 
on it. It does a GetModuleHandle on mmsystem.dll to find out if the mm 
extensions are available. I checked out windows 95, and it has mmsystem 
and winmm loaded when no apps are runing besides  the desktop / 
explorer. This patch links wine with winmm andmakes winmm load mmsystem 
on init. Finale gets by this ok now. I don't know if this the correct 
approach, though.  Could someone (Eric or Alexandre?) please take a look 
at it before I send it to wine-patches?

TIA,

Josh Thielen
-------------- next part --------------
Index: wine/miscemu/wine.spec
===================================================================
RCS file: /home/wine/wine/miscemu/wine.spec,v
retrieving revision 1.3
diff -u -r1.3 wine.spec
--- wine/miscemu/wine.spec	2000/12/15 03:38:11	1.3
+++ wine/miscemu/wine.spec	2001/11/23 19:11:47
@@ -4,3 +4,4 @@
 init	wine_initial_task
 
 import	ntdll.dll
+import  winmm.dll
Index: wine/dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.46
diff -u -r1.46 mmsystem.c
--- wine/dlls/winmm/mmsystem.c	2001/11/13 21:58:32	1.46
+++ wine/dlls/winmm/mmsystem.c	2001/11/23 19:11:59
@@ -114,6 +114,7 @@
  */
 BOOL WINAPI WINMM_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
 {
+    HINSTANCE16 mmsys16;
     TRACE("0x%x 0x%lx %p\n", hInstDLL, fdwReason, fImpLoad);
 
     switch (fdwReason) {
@@ -124,9 +125,15 @@
             MULTIMEDIA_DeleteIData();
             return FALSE;
 	}
+	mmsys16 = LoadLibrary16("mmsystem.dll");
+	if (!mmsys16) {
+	    ERR("Could not load sibling mmsystem.dll\n");
+	    return FALSE;
+	}
 	break;
     case DLL_PROCESS_DETACH:
 	MULTIMEDIA_DeleteIData();
+	if(mmsys16) FreeLibrary16(mmsys16);
 	break;
     case DLL_THREAD_ATTACH:
     case DLL_THREAD_DETACH:
@@ -2549,7 +2556,7 @@
     TRACE("(%d, %p, %d);\n", uDeviceID, lpCaps, uSize);
 
     if ((wmld = MMDRV_Get(uDeviceID, MMDRV_MIDIIN, TRUE)) == NULL) 
-	return MMSYSERR_INVALHANDLE;
+	return MMSYSERR_BADDEVICEID;
 
    return MMDRV_Message(wmld, MIDM_GETDEVCAPS, (DWORD)lpCaps, uSize, TRUE);
 }


More information about the wine-devel mailing list