midimap: Defer initialisation.
authorMaarten Lankhorst <m.b.lankhorst@gmail.com>
Wed, 17 Mar 2010 09:50:24 +0000 (10:50 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 17 Mar 2010 12:38:12 +0000 (13:38 +0100)
dlls/midimap/midimap.c

index 5df8472e68aeca5ac17a93896ea5b21f05528723..833c2f75f71002442e98e4dfc5d667997b716f2c 100644 (file)
@@ -495,6 +495,9 @@ static      DWORD   modReset(MIDIMAPDATA* mom)
     return ret;
 }
 
+static LRESULT MIDIMAP_drvOpen(void);
+static LRESULT MIDIMAP_drvClose(void);
+
 /**************************************************************************
  *                             modMessage (MIDIMAP.@)
  */
@@ -507,7 +510,9 @@ DWORD WINAPI MIDIMAP_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
     switch (wMsg)
     {
     case DRVM_INIT:
+        return MIDIMAP_drvOpen();
     case DRVM_EXIT:
+        return MIDIMAP_drvClose();
     case DRVM_ENABLE:
     case DRVM_DISABLE:
        /* FIXME: Pretend this is supported */
@@ -539,7 +544,7 @@ DWORD WINAPI MIDIMAP_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
 /**************************************************************************
  *                             MIDIMAP_drvOpen                 [internal]
  */
-static LRESULT MIDIMAP_drvOpen(LPSTR str)
+static LRESULT MIDIMAP_drvOpen(void)
 {
     MIDIOUTCAPSW       moc;
     unsigned           dev, i;
@@ -574,7 +579,7 @@ static LRESULT MIDIMAP_drvOpen(LPSTR str)
 /**************************************************************************
  *                             MIDIMAP_drvClose                [internal]
  */
-static LRESULT MIDIMAP_drvClose(DWORD_PTR dwDevID)
+static LRESULT MIDIMAP_drvClose(void)
 {
     if (midiOutPorts)
     {
@@ -598,8 +603,8 @@ LRESULT CALLBACK MIDIMAP_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
     {
     case DRV_LOAD:             return 1;
     case DRV_FREE:             return 1;
-    case DRV_OPEN:             return MIDIMAP_drvOpen((LPSTR)dwParam1);
-    case DRV_CLOSE:            return MIDIMAP_drvClose(dwDevID);
+    case DRV_OPEN:             return 1;
+    case DRV_CLOSE:            return 1;
     case DRV_ENABLE:           return 1;
     case DRV_DISABLE:          return 1;
     case DRV_QUERYCONFIGURE:   return 1;