Fixed a race condition on RPC worker thread creation, and a typo.
[wine] / dlls / winmm / wineoss / oss.c
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2 /*
3  * Wine Driver for Open Sound System
4  *
5  * Copyright    1999 Eric Pouech
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "mmddk.h"
29 #include "oss.h"
30
31 #ifdef HAVE_OSS
32
33 static  struct WINE_OSS* oss = NULL;
34
35 /**************************************************************************
36  *                              OSS_drvOpen                     [internal]
37  */
38 static  DWORD   OSS_drvOpen(LPSTR str)
39 {
40     if (oss)
41         return 0;
42
43     /* I know, this is ugly, but who cares... */
44     oss = (struct WINE_OSS*)1;
45     return 1;
46 }
47
48 /**************************************************************************
49  *                              OSS_drvClose                    [internal]
50  */
51 static  DWORD   OSS_drvClose(DWORD dwDevID)
52 {
53     if (oss) {
54         oss = NULL;
55         return 1;
56     }
57     return 0;
58 }
59
60 #endif
61
62
63 /**************************************************************************
64  *                              DriverProc (WINEOSS.1)
65  */
66 LONG CALLBACK   OSS_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
67                                DWORD dwParam1, DWORD dwParam2)
68 {
69 /* EPP     TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n",  */
70 /* EPP    dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
71
72     switch(wMsg) {
73 #ifdef HAVE_OSS
74     case DRV_LOAD:              OSS_WaveInit();
75 #ifdef HAVE_OSS_MIDI
76                                 OSS_MidiInit();
77 #endif
78                                 return 1;
79     case DRV_FREE:              return 1;
80     case DRV_OPEN:              return OSS_drvOpen((LPSTR)dwParam1);
81     case DRV_CLOSE:             return OSS_drvClose(dwDevID);
82     case DRV_ENABLE:            return 1;
83     case DRV_DISABLE:           return 1;
84     case DRV_QUERYCONFIGURE:    return 1;
85     case DRV_CONFIGURE:         MessageBoxA(0, "OSS MultiMedia Driver !", "OSS Driver", MB_OK); return 1;
86     case DRV_INSTALL:           return DRVCNF_RESTART;
87     case DRV_REMOVE:            return DRVCNF_RESTART;
88 #endif
89     default:
90         return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
91     }
92 }
93
94