Sync to Wine-20050628:

Alexandre Julliard <julliard@winehq.org>
- Get rid of the WaveMapper and MidiMapper options, the defaults should
  be good enough in all cases.
- Moved the audio driver configuration to HKCU\Software\Wine\Drivers and
  changed it a bit to follow the model of the graphics driver.
- Added magic comments to all Wine-specific registry accesses to make
  them easier to grep.
Mike McCormack <mike@codeweavers.com>
- Make a function static.
Francois Gouget <fgouget@free.fr>
- Fix winapi_check documentation warnings.
Rein Klazes <wijn@wanadoo.nl>
- In MCI_(Un)MapMsg16To32W with wMsg == MCI_OPEN(_DRIVER) only do
  strdupAtoW on those parameters that are flagged to be a string.

svn path=/trunk/; revision=17076
This commit is contained in:
Gé van Geldorp 2005-08-05 20:25:46 +00:00
parent 638c41010a
commit be83809179
21 changed files with 2855 additions and 2867 deletions

View file

@ -414,7 +414,7 @@ DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg)
/**************************************************************************
* MMDRV_GetByID [internal]
*/
LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
static LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
{
TRACE("(%04x, %04x)\n", uDevID, type);
if (uDevID < llTypes[type].wMaxId)
@ -731,43 +731,19 @@ BOOL MMDRV_Init(void)
strcpy(mapper_buffer, WINE_DEFAULT_WINMM_MAPPER);
strcpy(midi_buffer, WINE_DEFAULT_WINMM_MIDI);
if (! RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\WinMM", &hKey)) {
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hKey))
{
size = sizeof(driver_buffer);
if (RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)driver_buffer, &size))
if (RegQueryValueExA(hKey, "Audio", 0, &type, (LPVOID)driver_buffer, &size))
strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
/* finish with mappers */
size = sizeof(mapper_buffer);
if (RegQueryValueExA(hKey, "WaveMapper", 0, &type, (LPVOID)mapper_buffer, &size))
strcpy(mapper_buffer, WINE_DEFAULT_WINMM_MAPPER);
size = sizeof(midi_buffer);
if (RegQueryValueExA(hKey, "MidiMapper", 0, &type, (LPVOID)midi_buffer, &size))
strcpy(midi_buffer, WINE_DEFAULT_WINMM_MIDI);
RegCloseKey(hKey);
}
#ifndef __REACTOS__
char* p1;
char* p2;
p1 = driver_buffer;
while (p1) {
p2 = strchr(p1, ';');
if (p2) *p2++ = '\0';
ret |= MMDRV_Install(p1, p1, FALSE);
p1 = p2;
}
#endif
#ifdef __REACTOS__
// AG: TESTING:
ret |= MMDRV_Install("mmdrv.dll", "mmdrv.dll", FALSE);
#endif
ret |= MMDRV_Install("wavemapper", mapper_buffer, TRUE);
ret |= MMDRV_Install("midimapper", midi_buffer, TRUE);
ret |= MMDRV_Install("wavemapper", WINE_DEFAULT_WINMM_MAPPER, TRUE);
ret |= MMDRV_Install("midimapper", WINE_DEFAULT_WINMM_MIDI, TRUE);
return ret;
}

View file

@ -68,8 +68,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mci);
WINMM_MapType (*pFnMciMapMsg16To32W) (WORD,WORD,DWORD*) /* = NULL */;
WINMM_MapType (*pFnMciUnMapMsg16To32W)(WORD,WORD,DWORD) /* = NULL */;
WINMM_MapType (*pFnMciMapMsg16To32W) (WORD,WORD,DWORD,DWORD*) /* = NULL */;
WINMM_MapType (*pFnMciUnMapMsg16To32W)(WORD,WORD,DWORD,DWORD) /* = NULL */;
WINMM_MapType (*pFnMciMapMsg32WTo16) (WORD,WORD,DWORD,DWORD*) /* = NULL */;
WINMM_MapType (*pFnMciUnMapMsg32WTo16)(WORD,WORD,DWORD,DWORD) /* = NULL */;
@ -1595,7 +1595,7 @@ DWORD MCI_SendCommandFrom16(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dwParam1,
if (wmd->bIs32 && pFnMciMapMsg16To32W) {
WINMM_MapType res;
switch (res = pFnMciMapMsg16To32W(wmd->wType, wMsg, &dwParam2)) {
switch (res = pFnMciMapMsg16To32W(wmd->wType, wMsg, dwParam1, &dwParam2)) {
case WINMM_MAP_MSGERROR:
TRACE("Not handled yet (%s)\n", MCI_MessageToString(wMsg));
dwRet = MCIERR_DRIVER_INTERNAL;
@ -1608,7 +1608,7 @@ DWORD MCI_SendCommandFrom16(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dwParam1,
case WINMM_MAP_OKMEM:
dwRet = SendDriverMessage(wmd->hDriver, wMsg, dwParam1, dwParam2);
if (res == WINMM_MAP_OKMEM)
pFnMciUnMapMsg16To32W(wmd->wType, wMsg, dwParam2);
pFnMciUnMapMsg16To32W(wmd->wType, wMsg, dwParam1, dwParam2);
break;
}
} else {
@ -1966,11 +1966,11 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,
if (bFrom32) {
dwRet = MCI_Open(dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
} else if (pFnMciMapMsg16To32W) {
switch (pFnMciMapMsg16To32W(0, wMsg, &dwParam2)) {
switch (pFnMciMapMsg16To32W(0, wMsg, dwParam1, &dwParam2)) {
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
dwRet = MCI_Open(dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam1, dwParam2);
break;
default: break; /* so that gcc does not bark */
}
@ -1980,11 +1980,11 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,
if (bFrom32) {
dwRet = MCI_Close(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
} else if (pFnMciMapMsg16To32W) {
switch (pFnMciMapMsg16To32W(0, wMsg, &dwParam2)) {
switch (pFnMciMapMsg16To32W(0, wMsg, dwParam1, &dwParam2)) {
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
dwRet = MCI_Close(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam1, dwParam2);
break;
default: break; /* so that gcc does not bark */
}
@ -1994,11 +1994,11 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,
if (bFrom32) {
dwRet = MCI_SysInfo(wDevID, dwParam1, (LPMCI_SYSINFO_PARMSW)dwParam2);
} else if (pFnMciMapMsg16To32W) {
switch (pFnMciMapMsg16To32W(0, wMsg, &dwParam2)) {
switch (pFnMciMapMsg16To32W(0, wMsg, dwParam1, &dwParam2)) {
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
dwRet = MCI_SysInfo(wDevID, dwParam1, (LPMCI_SYSINFO_PARMSW)dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam1, dwParam2);
break;
default: break; /* so that gcc does not bark */
}
@ -2008,11 +2008,11 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,
if (bFrom32) {
dwRet = MCI_Break(wDevID, dwParam1, (LPMCI_BREAK_PARMS)dwParam2);
} else if (pFnMciMapMsg16To32W) {
switch (pFnMciMapMsg16To32W(0, wMsg, &dwParam2)) {
switch (pFnMciMapMsg16To32W(0, wMsg, dwParam1, &dwParam2)) {
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
dwRet = MCI_Break(wDevID, dwParam1, (LPMCI_BREAK_PARMS)dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam1, dwParam2);
break;
default: break; /* so that gcc does not bark */
}
@ -2022,11 +2022,11 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,
if (bFrom32) {
dwRet = MCI_Sound(wDevID, dwParam1, (LPMCI_SOUND_PARMSW)dwParam2);
} else if (pFnMciMapMsg16To32W) {
switch (pFnMciMapMsg16To32W(0, wMsg, &dwParam2)) {
switch (pFnMciMapMsg16To32W(0, wMsg, dwParam1, &dwParam2)) {
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
dwRet = MCI_Sound(wDevID, dwParam1, (LPMCI_SOUND_PARMSW)dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam2);
pFnMciUnMapMsg16To32W(0, wMsg, dwParam1, dwParam2);
break;
default: break; /* so that gcc does not bark */
}

View file

@ -2522,7 +2522,7 @@ static WINMM_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlag
/**************************************************************************
* MCI_MapMsg16To32W [internal]
*/
static WINMM_MapType MCI_MapMsg16To32W(WORD uDevType, WORD wMsg, DWORD* lParam)
static WINMM_MapType MCI_MapMsg16To32W(WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD* lParam)
{
if (*lParam == 0)
return WINMM_MAP_OK;
@ -2632,9 +2632,18 @@ static WINMM_MapType MCI_MapMsg16To32W(WORD uDevType, WORD wMsg, DWORD* lParam)
mop32w = (LPMCI_OPEN_PARMSW)((char*)mop32w + sizeof(LPMCI_OPEN_PARMS16));
mop32w->dwCallback = mop16->dwCallback;
mop32w->wDeviceID = mop16->wDeviceID;
if( ( dwFlags & ( MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID)) == MCI_OPEN_TYPE)
mop32w->lpstrDeviceType = MCI_strdupAtoW(MapSL(mop16->lpstrDeviceType));
else
mop32w->lpstrDeviceType = (LPWSTR) mop16->lpstrDeviceType;
if( ( dwFlags & ( MCI_OPEN_ELEMENT | MCI_OPEN_ELEMENT_ID)) == MCI_OPEN_ELEMENT)
mop32w->lpstrElementName = MCI_strdupAtoW(MapSL(mop16->lpstrElementName));
else
mop32w->lpstrElementName = (LPWSTR) mop16->lpstrElementName;
if( ( dwFlags & MCI_OPEN_ALIAS))
mop32w->lpstrAlias = MCI_strdupAtoW(MapSL(mop16->lpstrAlias));
else
mop32w->lpstrAlias = (LPWSTR) mop16->lpstrAlias;
/* copy extended information if any...
* FIXME: this may seg fault if initial structure does not contain them and
* the reads after msip16 fail under LDT limits...
@ -2707,7 +2716,7 @@ static WINMM_MapType MCI_MapMsg16To32W(WORD uDevType, WORD wMsg, DWORD* lParam)
/**************************************************************************
* MCI_UnMapMsg16To32W [internal]
*/
static WINMM_MapType MCI_UnMapMsg16To32W(WORD uDevType, WORD wMsg, DWORD lParam)
static WINMM_MapType MCI_UnMapMsg16To32W(WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD lParam)
{
switch (wMsg) {
/* case MCI_CAPTURE */
@ -2798,8 +2807,11 @@ static WINMM_MapType MCI_UnMapMsg16To32W(WORD uDevType, WORD wMsg, DWORD lParam
LPMCI_OPEN_PARMS16 mop16 = *(LPMCI_OPEN_PARMS16*)((char*)mop32w - sizeof(LPMCI_OPEN_PARMS16));
mop16->wDeviceID = mop32w->wDeviceID;
if( ( dwFlags & ( MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID)) == MCI_OPEN_TYPE)
HeapFree(GetProcessHeap(), 0, mop32w->lpstrDeviceType);
if( ( dwFlags & ( MCI_OPEN_ELEMENT | MCI_OPEN_ELEMENT_ID)) == MCI_OPEN_ELEMENT)
HeapFree(GetProcessHeap(), 0, mop32w->lpstrElementName);
if( ( dwFlags & MCI_OPEN_ALIAS))
HeapFree(GetProcessHeap(), 0, mop32w->lpstrAlias);
if (!HeapFree(GetProcessHeap(), 0, (LPVOID)(lParam - sizeof(LPMCI_OPEN_PARMS16))))
FIXME("bad free line=%d\n", __LINE__);

View file

@ -109,7 +109,7 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
}
/**************************************************************************
* MMSYSTEM_WEP [MMSYSTEM.1]
* WEP [MMSYSTEM.1]
*/
int WINAPI MMSYSTEM_WEP(HINSTANCE16 hInstance, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpCmdLine)

View file

@ -28,7 +28,7 @@
#include "winbase.h"
#include "mmddk.h"
#define WINE_DEFAULT_WINMM_DRIVER "wineoss.drv"
#define WINE_DEFAULT_WINMM_DRIVER "oss"
#define WINE_DEFAULT_WINMM_MAPPER "msacm.drv"
#define WINE_DEFAULT_WINMM_MIDI "midimap.drv"
@ -301,8 +301,8 @@ extern WINE_MMTHREAD* (*pFnGetMMThread16)(UINT16);
extern LPWINE_DRIVER (*pFnOpenDriver16)(LPCWSTR,LPCWSTR,LPARAM);
extern LRESULT (*pFnCloseDriver16)(UINT16,LPARAM,LPARAM);
extern LRESULT (*pFnSendMessage16)(UINT16,UINT,LPARAM,LPARAM);
extern WINMM_MapType (*pFnMciMapMsg16To32W)(WORD,WORD,DWORD*);
extern WINMM_MapType (*pFnMciUnMapMsg16To32W)(WORD,WORD,DWORD);
extern WINMM_MapType (*pFnMciMapMsg16To32W)(WORD,WORD,DWORD,DWORD*);
extern WINMM_MapType (*pFnMciUnMapMsg16To32W)(WORD,WORD,DWORD,DWORD);
extern WINMM_MapType (*pFnMciMapMsg32WTo16)(WORD,WORD,DWORD,DWORD*);
extern WINMM_MapType (*pFnMciUnMapMsg32WTo16)(WORD,WORD,DWORD,DWORD);
extern LRESULT (*pFnCallMMDrvFunc16)(DWORD /* in fact FARPROC16 */,WORD,WORD,LONG,LONG,LONG);

View file

@ -3,7 +3,6 @@
3 stub @
4 stub @
@ stdcall PlaySoundA(ptr long long)
@ stdcall CloseDriver(long long long)
@ stdcall DefDriverProc(long long long long long)
@ stdcall DriverCallback(long long long long long long long)
@ -18,6 +17,7 @@
@ stdcall OpenDriver(wstr wstr long)
@ stdcall OpenDriverA(str str long)
@ stdcall PlaySound(ptr long long) PlaySoundA
@ stdcall PlaySoundA(ptr long long)
@ stdcall PlaySoundW(ptr long long)
@ stdcall SendDriverMessage(long long long long)
@ stdcall auxGetDevCapsA(long ptr long)
@ -42,9 +42,9 @@
@ stdcall mciFreeCommandResource(long)
@ stdcall mciGetCreatorTask(long)
@ stdcall mciGetDeviceIDA(str)
@ stdcall mciGetDeviceIDW(wstr)
@ stdcall mciGetDeviceIDFromElementIDA(long str)
@ stdcall mciGetDeviceIDFromElementIDW(long wstr)
@ stdcall mciGetDeviceIDW(wstr)
@ stdcall mciGetDriverData(long)
@ stdcall mciGetErrorStringA(long ptr long)
@ stdcall mciGetErrorStringW(long ptr long)
@ -114,6 +114,10 @@
@ stdcall mixerOpen(ptr long long long long)
@ stdcall mixerSetControlDetails(long ptr long)
@ stdcall mmGetCurrentTask()
@ stdcall mmTaskBlock(long)
@ stdcall mmTaskCreate(ptr ptr long)
@ stdcall mmTaskSignal(long)
@ stdcall mmTaskYield()
@ stdcall mmioAdvance(long ptr long)
@ stdcall mmioAscend(long ptr long)
@ stdcall mmioClose(long long)
@ -137,10 +141,6 @@
@ stdcall mmioStringToFOURCCW(wstr long)
@ stdcall mmioWrite(long ptr long)
@ stdcall mmsystemGetVersion()
@ stdcall mmTaskBlock(long)
@ stdcall mmTaskCreate(ptr ptr long)
@ stdcall mmTaskSignal(long)
@ stdcall mmTaskYield()
@ stdcall sndPlaySoundA(ptr long)
@ stdcall sndPlaySoundW(ptr long)
@ stdcall timeBeginPeriod(long)

View file

@ -57,7 +57,7 @@ MCIERR_OUT_OF_MEMORY, "Not enough memory available for this task. \nQuit one o
MCIERR_DEVICE_OPEN, "The device name is already being used as an alias by this application. Use a unique alias."
MCIERR_CANNOT_LOAD_DRIVER, "There is an undetectable problem in loading the specified device driver."
MCIERR_MISSING_COMMAND_STRING, "No command was specified."
MCIERR_PARAM_OVERFLOW, "The output string was to large to fit in the return buffer. Increase the size of the buffer."
MCIERR_PARAM_OVERFLOW, "The output string was too large to fit in the return buffer. Increase the size of the buffer."
MCIERR_MISSING_STRING_ARGUMENT, "The specified command requires a character-string parameter. Please provide one."
MCIERR_BAD_INTEGER, "The specified integer is invalid for this command."
MCIERR_PARSER_INTERNAL, "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver."