Huw Davies : wineoss: Move AUXDM_GETDEVCAPS to the unixlib.

Alexandre Julliard julliard at winehq.org
Tue May 3 15:39:23 CDT 2022


Module: wine
Branch: master
Commit: d088c3a119b40e67abaaf8059848cfcb860590ec
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d088c3a119b40e67abaaf8059848cfcb860590ec

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue May  3 07:42:30 2022 +0100

wineoss: Move AUXDM_GETDEVCAPS to the unixlib.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wineoss.drv/mmaux.c | 42 +-----------------------------------------
 dlls/wineoss.drv/oss.c   | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 41 deletions(-)

diff --git a/dlls/wineoss.drv/mmaux.c b/dlls/wineoss.drv/mmaux.c
index 9fb1eeb7cd7..a3a12a96bea 100644
--- a/dlls/wineoss.drv/mmaux.c
+++ b/dlls/wineoss.drv/mmaux.c
@@ -33,9 +33,9 @@
 #include "winbase.h"
 #include "mmddk.h"
 #include "audioclient.h"
+#include "winternl.h"
 
 #include "wine/debug.h"
-#include "wine/unicode.h"
 #include "wine/unixlib.h"
 
 #include "unixlib.h"
@@ -46,44 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmaux);
 
 /*-----------------------------------------------------------------------*/
 
-DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
-			    DWORD_PTR dwParam1, DWORD_PTR dwParam2);
-
-/**************************************************************************
- * 				AUX_GetDevCaps			[internal]
- */
-static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPSW lpCaps, DWORD dwSize)
-{
-    int 	mixer, volume;
-    static const WCHAR ini[] = {'O','S','S',' ','A','u','x',' ','#','0',0};
-    unsigned int num_aux = OSS_auxMessage(0, AUXDM_GETNUMDEVS, 0, 0, 0);
-
-    TRACE("(%04X, %p, %u);\n", wDevID, lpCaps, dwSize);
-    if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
-    if (wDevID >= num_aux) return MMSYSERR_BADDEVICEID;
-    if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
-	WARN("mixer device not available !\n");
-	return MMSYSERR_NOTENABLED;
-    }
-    if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) {
-	close(mixer);
-	WARN("unable to read mixer !\n");
-	return MMSYSERR_NOTENABLED;
-    }
-    close(mixer);
-    lpCaps->wMid = 0xAA;
-    lpCaps->wPid = 0x55 + wDevID;
-    lpCaps->vDriverVersion = 0x0100;
-    strcpyW(lpCaps->szPname, ini);
-    lpCaps->szPname[9] = '0' + wDevID; /* 6  at max */
-    lpCaps->wTechnology = wDevID == 2 ? AUXCAPS_CDAUDIO : AUXCAPS_AUXIN;
-    lpCaps->wReserved1 = 0;
-    lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
-
-    return MMSYSERR_NOERROR;
-}
-
-
 /**************************************************************************
  * 				AUX_GetVolume			[internal]
  */
@@ -212,8 +174,6 @@ DWORD WINAPI OSS_auxMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
 	  wDevID, wMsg, dwUser, dwParam1, dwParam2);
 
     switch (wMsg) {
-    case AUXDM_GETDEVCAPS:
-	return AUX_GetDevCaps(wDevID, (LPAUXCAPSW)dwParam1, dwParam2);
     case AUXDM_GETVOLUME:
 	return AUX_GetVolume(wDevID, (LPDWORD)dwParam1);
     case AUXDM_SETVOLUME:
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c
index d469bbebb4e..e387a2a4a71 100644
--- a/dlls/wineoss.drv/oss.c
+++ b/dlls/wineoss.drv/oss.c
@@ -1412,6 +1412,38 @@ static UINT aux_exit(void)
     return 0;
 }
 
+static UINT aux_get_devcaps(WORD dev_id, AUXCAPSW *caps, UINT size)
+{
+    int mixer, volume;
+    static const WCHAR ini[] = {'O','S','S',' ','A','u','x',' ','#','0',0};
+
+    TRACE("(%04X, %p, %u);\n", dev_id, caps, size);
+    if (caps == NULL) return MMSYSERR_NOTENABLED;
+    if (dev_id >= num_aux) return MMSYSERR_BADDEVICEID;
+    if ((mixer = open(MIXER_DEV, O_RDWR)) < 0)
+    {
+        WARN("mixer device not available !\n");
+        return MMSYSERR_NOTENABLED;
+    }
+    if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1)
+    {
+        close(mixer);
+        WARN("unable to read mixer !\n");
+        return MMSYSERR_NOTENABLED;
+    }
+    close(mixer);
+    caps->wMid = 0xAA;
+    caps->wPid = 0x55 + dev_id;
+    caps->vDriverVersion = 0x0100;
+    memcpy(caps->szPname, ini, sizeof(ini));
+    caps->szPname[9] = '0' + dev_id; /* 6  at max */
+    caps->wTechnology = (dev_id == 2) ? AUXCAPS_CDAUDIO : AUXCAPS_AUXIN;
+    caps->wReserved1 = 0;
+    caps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
+
+    return MMSYSERR_NOERROR;
+}
+
 static NTSTATUS aux_message(void *args)
 {
     struct aux_message_params *params = args;
@@ -1429,6 +1461,9 @@ static NTSTATUS aux_message(void *args)
         /* FIXME: Pretend this is supported */
         *params->err = 0;
         break;
+    case AUXDM_GETDEVCAPS:
+        *params->err = aux_get_devcaps(params->dev_id, (AUXCAPSW *)params->param_1, params->param_2);
+        break;
     case AUXDM_GETNUMDEVS:
         TRACE("return %d;\n", num_aux);
         *params->err = num_aux;




More information about the wine-cvs mailing list