Sync to Wine-20050211

Eric Pouech <pouech-eric@wanadoo.fr>
- rewrite MCI interfaces as Unicode interface (as it should be)
- made some winmm APIs rely on the Unicode version for the core
  implementation (instead of Ansi flavor)
Klemens Friedl <klemens_friedl@gmx.net>
Henning Gerhardt <henning.gerhardt@web.de>
- Spelling fixes.

svn path=/trunk/; revision=13671
This commit is contained in:
Gé van Geldorp 2005-02-20 11:03:14 +00:00
parent 4d728cef69
commit d32375b57f
12 changed files with 2962 additions and 2019 deletions

View file

@ -5,6 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winmm.dll
IMPORTS = user32 advapi32 kernel32 ntdll
EXTRALIBS = $(LIBUNICODE)
C_SRCS = \
driver.c \

View file

@ -1,5 +1,3 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* WINE Drivers functions
*
@ -33,15 +31,16 @@
#include "mmddk.h"
#include "winemm.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(driver);
#define HKLM_BASE "Software\\Microsoft\\Windows NT\\CurrentVersion"
static LPWINE_DRIVER lpDrvItemList /* = NULL */;
static const WCHAR HKLM_BASE[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
WINE_MMTHREAD* (*pFnGetMMThread16)(UINT16 h) /* = NULL */;
LPWINE_DRIVER (*pFnOpenDriver16)(LPCSTR,LPCSTR,LPARAM) /* = NULL */;
LPWINE_DRIVER (*pFnOpenDriver16)(LPCWSTR,LPCWSTR,LPARAM) /* = NULL */;
LRESULT (*pFnCloseDriver16)(UINT16,LPARAM,LPARAM) /* = NULL */;
LRESULT (*pFnSendMessage16)(UINT16,UINT,LPARAM,LPARAM) /* = NULL */;
@ -207,16 +206,19 @@ static BOOL DRIVER_AddToList(LPWINE_DRIVER lpNewDrv, LPARAM lParam1, LPARAM lPar
* DRIVER_GetLibName [internal]
*
*/
BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz)
BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz)
{
HKEY hKey, hSecKey;
DWORD bufLen, lRet;
static const WCHAR wszSystemIni[] = {'S','Y','S','T','E','M','.','I','N','I',0};
WCHAR wsznull = '\0';
lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_BASE, 0, KEY_QUERY_VALUE, &hKey);
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, HKLM_BASE, 0, KEY_QUERY_VALUE, &hKey);
if (lRet == ERROR_SUCCESS) {
lRet = RegOpenKeyExA(hKey, sectName, 0, KEY_QUERY_VALUE, &hSecKey);
lRet = RegOpenKeyExW(hKey, sectName, 0, KEY_QUERY_VALUE, &hSecKey);
if (lRet == ERROR_SUCCESS) {
lRet = RegQueryValueExA(hSecKey, keyName, 0, 0, buf, &bufLen);
bufLen = sz;
lRet = RegQueryValueExW(hSecKey, keyName, 0, 0, (void*)buf, &bufLen);
RegCloseKey( hSecKey );
}
RegCloseKey( hKey );
@ -224,7 +226,7 @@ BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz)
if (lRet == ERROR_SUCCESS) return TRUE;
/* default to system.ini if we can't find it in the registry,
* to support native installations where system.ini is still used */
return GetPrivateProfileStringA(sectName, keyName, "", buf, sz, "SYSTEM.INI");
return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf, sz, wszSystemIni);
}
/**************************************************************************
@ -232,16 +234,16 @@ BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz)
*
* Tries to load a 32 bit driver whose DLL's (module) name is fn
*/
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCWSTR fn, LPARAM lParam2)
{
LPWINE_DRIVER lpDrv = NULL;
HMODULE hModule = 0;
LPSTR ptr;
LPWSTR ptr;
LPCSTR cause = 0;
TRACE("(%s, %08lX);\n", debugstr_a(fn), lParam2);
TRACE("(%s, %08lX);\n", debugstr_w(fn), lParam2);
if ((ptr = strchr(fn, ' ')) != NULL) {
if ((ptr = strchrW(fn, ' ')) != NULL) {
*ptr++ = '\0';
while (*ptr == ' ') ptr++;
if (*ptr == '\0') ptr = NULL;
@ -250,7 +252,7 @@ LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv == NULL) {cause = "OOM"; goto exit;}
if ((hModule = LoadLibraryA(fn)) == 0) {cause = "Not a 32 bit lib"; goto exit;}
if ((hModule = LoadLibraryW(fn)) == 0) {cause = "Not a 32 bit lib"; goto exit;}
lpDrv->d.d32.lpDrvProc = (DRIVERPROC)GetProcAddress(hModule, "DriverProc");
if (lpDrv->d.d32.lpDrvProc == NULL) {cause = "no DriverProc"; goto exit;}
@ -290,7 +292,7 @@ LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
exit:
FreeLibrary(hModule);
HeapFree(GetProcessHeap(), 0, lpDrv);
TRACE("Unable to load 32 bit module %s: %s\n", debugstr_a(fn), cause);
TRACE("Unable to load 32 bit module %s: %s\n", debugstr_w(fn), cause);
return NULL;
}
@ -301,23 +303,59 @@ LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
* (0,1,DRV_ENABLE,0 ,0)
* (0,1,DRV_OPEN ,buf[256],0)
*/
HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam2)
HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)
{
INT len;
LPWSTR dn = NULL;
LPWSTR sn = NULL;
HDRVR ret;
if (lpDriverName)
{
len = MultiByteToWideChar( CP_ACP, 0, lpDriverName, -1, NULL, 0 );
dn = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if (!dn) return 0;
MultiByteToWideChar( CP_ACP, 0, lpDriverName, -1, dn, len );
}
if (lpSectionName)
{
len = MultiByteToWideChar( CP_ACP, 0, lpSectionName, -1, NULL, 0 );
sn = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if (!sn) return 0;
MultiByteToWideChar( CP_ACP, 0, lpSectionName, -1, sn, len );
}
ret = OpenDriver(dn, sn, lParam);
if (dn) HeapFree(GetProcessHeap(), 0, dn);
if (sn) HeapFree(GetProcessHeap(), 0, sn);
return ret;
}
/**************************************************************************
* OpenDriver [WINMM.@]
* DrvOpen [WINMM.@]
*/
HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
{
LPWINE_DRIVER lpDrv = NULL;
char libName[128];
LPCSTR lsn = lpSectionName;
WCHAR libName[128];
LPCWSTR lsn = lpSectionName;
TRACE("(%s, %s, 0x%08lx);\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName), lParam2);
TRACE("(%s, %s, 0x%08lx);\n",
debugstr_w(lpDriverName), debugstr_w(lpSectionName), lParam);
if (lsn == NULL) {
lstrcpynA(libName, lpDriverName, sizeof(libName));
static const WCHAR wszDrivers32[] = {'D','r','i','v','e','r','s','3','2',0};
lstrcpynW(libName, lpDriverName, sizeof(libName) / sizeof(WCHAR));
if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam2)))
if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam)))
goto the_end;
lsn = "Drivers32";
lsn = wszDrivers32;
}
if (DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) &&
(lpDrv = DRIVER_TryOpenDriver32(libName, lParam2)))
(lpDrv = DRIVER_TryOpenDriver32(libName, lParam)))
goto the_end;
/* now we will try a 16 bit driver (and add all the glue to make it work... which
@ -326,12 +364,13 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
*/
WINMM_CheckForMMSystem();
if (pFnOpenDriver16 &&
(lpDrv = pFnOpenDriver16(lpDriverName, lpSectionName, lParam2)))
(lpDrv = pFnOpenDriver16(lpDriverName, lpSectionName, lParam)))
{
if (DRIVER_AddToList(lpDrv, 0, lParam2)) goto the_end;
if (DRIVER_AddToList(lpDrv, 0, lParam)) goto the_end;
HeapFree(GetProcessHeap(), 0, lpDrv);
}
TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName));
TRACE("Failed to open driver %s from system.ini file, section %s\n",
debugstr_w(lpDriverName), debugstr_w(lpSectionName));
return 0;
the_end:
@ -339,40 +378,6 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
return (HDRVR)lpDrv;
}
/**************************************************************************
* OpenDriver [WINMM.@]
* DrvOpen [WINMM.@]
*/
HDRVR WINAPI OpenDriverW(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
{
INT len;
LPSTR dn = NULL;
LPSTR sn = NULL;
HDRVR ret;
if (lpDriverName)
{
len = WideCharToMultiByte( CP_ACP, 0, lpDriverName, -1, NULL, 0, NULL, NULL );
dn = HeapAlloc( GetProcessHeap(), 0, len );
if (!dn) return 0;
WideCharToMultiByte( CP_ACP, 0, lpDriverName, -1, dn, len, NULL, NULL );
}
if (lpSectionName)
{
len = WideCharToMultiByte( CP_ACP, 0, lpSectionName, -1, NULL, 0, NULL, NULL );
sn = HeapAlloc( GetProcessHeap(), 0, len );
if (!sn) return 0;
WideCharToMultiByte( CP_ACP, 0, lpSectionName, -1, sn, len, NULL, NULL );
}
ret = OpenDriverA(dn, sn, lParam);
HeapFree(GetProcessHeap(), 0, dn);
HeapFree(GetProcessHeap(), 0, sn);
return ret;
}
/**************************************************************************
* CloseDriver [WINMM.@]
* DrvClose [WINMM.@]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,3 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MMIO functions
*
@ -221,8 +220,6 @@ static LRESULT CALLBACK mmioMemIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage,
FIXME("unexpected message %u\n", uMessage);
return 0;
}
return 0;
}
/* This array will be the entire list for most apps
@ -1351,7 +1348,7 @@ MMRESULT WINAPI mmioRenameA(LPCSTR szFileName, LPCSTR szNewFileName,
/* FIXME: should we actually pass lpmmioinfo down the drain ???
* or make a copy of it because it's const ???
*/
return send_message(ioProc, (LPMMIOINFO)lpmmioinfo, MMIOM_RENAME,
return send_message(ioProc, (MMIOINFO*)lpmmioinfo, MMIOM_RENAME,
(LPARAM)szFileName, (LPARAM)szNewFileName, MMIO_PROC_32A);
}

View file

@ -48,7 +48,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmsys);
static WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16);
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCSTR, LPCSTR, LPARAM);
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCWSTR, LPCWSTR, LPARAM);
static LRESULT DRIVER_CloseDriver16(HDRVR16, LPARAM, LPARAM);
static LRESULT DRIVER_SendMessage16(HDRVR16, UINT, LPARAM, LPARAM);
static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
@ -597,7 +597,7 @@ UINT16 WINAPI mciGetDeviceID16(LPCSTR lpstrName)
{
TRACE("(\"%s\")\n", lpstrName);
return MCI_GetDriverFromString(lpstrName);
return mciGetDeviceIDA(lpstrName);
}
/**************************************************************************
@ -731,6 +731,7 @@ UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID, LPMIDIOUTCAPS16 lpCaps,
/**************************************************************************
* midiOutGetErrorText [MMSYSTEM.203]
* midiInGetErrorText [MMSYSTEM.203]
*/
UINT16 WINAPI midiOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
{
@ -948,14 +949,6 @@ UINT16 WINAPI midiInGetDevCaps16(UINT16 uDeviceID, LPMIDIINCAPS16 lpCaps,
return ret;
}
/**************************************************************************
* midiInGetErrorText [MMSYSTEM.303]
*/
UINT16 WINAPI midiInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
{
return midiInGetErrorTextA(uError, lpText, uSize);
}
/**************************************************************************
* midiInOpen [MMSYSTEM.304]
*/
@ -1238,6 +1231,7 @@ UINT16 WINAPI waveOutGetDevCaps16(UINT16 uDeviceID,
/**************************************************************************
* waveOutGetErrorText [MMSYSTEM.403]
* waveInGetErrorText [MMSYSTEM.403]
*/
UINT16 WINAPI waveOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
{
@ -1535,14 +1529,6 @@ UINT16 WINAPI waveInGetDevCaps16(UINT16 uDeviceID, LPWAVEINCAPS16 lpCaps,
return ret;
}
/**************************************************************************
* waveInGetErrorText [MMSYSTEM.503]
*/
UINT16 WINAPI waveInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
{
return waveInGetErrorTextA(uError, lpText, uSize);
}
/**************************************************************************
* waveInOpen [MMSYSTEM.504]
*/
@ -2371,30 +2357,52 @@ static WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lPara
*
* Tries to load a 16 bit driver whose DLL's (module) name is lpFileName.
*/
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2)
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCWSTR fn, LPCWSTR sn, LPARAM lParam2)
{
LPWINE_DRIVER lpDrv = NULL;
LPCSTR cause = 0;
LPCSTR cause = NULL;
LPSTR fnA = NULL, snA = NULL;
unsigned len;
TRACE("(%s, %08lX);\n", debugstr_a(sn), lParam2);
TRACE("(%s, %s, %08lX);\n", debugstr_w(fn), debugstr_w(sn), lParam2);
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv == NULL) {cause = "OOM"; goto exit;}
if (fn)
{
len = WideCharToMultiByte( CP_ACP, 0, fn, -1, NULL, 0, NULL, NULL );
fnA = HeapAlloc(GetProcessHeap(), 0, len);
if (fnA == NULL) {cause = "OOM"; goto exit;}
WideCharToMultiByte( CP_ACP, 0, fn, -1, fnA, len, NULL, NULL );
}
if (sn)
{
len = WideCharToMultiByte( CP_ACP, 0, sn, -1, NULL, 0, NULL, NULL );
snA = HeapAlloc(GetProcessHeap(), 0, len);
if (snA == NULL) {cause = "OOM"; goto exit;}
WideCharToMultiByte( CP_ACP, 0, sn, -1, snA, len, NULL, NULL );
}
/* FIXME: shall we do some black magic here on sn ?
* drivers32 => drivers
* mci32 => mci
* ...
*/
lpDrv->d.d16.hDriver16 = OpenDriver16(fn, sn, lParam2);
lpDrv->d.d16.hDriver16 = OpenDriver16(fnA, snA, lParam2);
if (lpDrv->d.d16.hDriver16 == 0) {cause = "Not a 16 bit driver"; goto exit;}
lpDrv->dwFlags = WINE_GDF_16BIT;
TRACE("=> %p\n", lpDrv);
return lpDrv;
exit:
exit:
HeapFree(GetProcessHeap(), 0, lpDrv);
TRACE("Unable to load 16 bit module %s: %s\n", debugstr_a(fn), cause);
HeapFree(GetProcessHeap(), 0, fnA);
HeapFree(GetProcessHeap(), 0, snA);
TRACE("Unable to load 16 bit module %s[%s]: %s\n",
debugstr_w(fn), debugstr_w(sn), cause);
return NULL;
}
@ -2612,15 +2620,45 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet,
*/
UINT16 WINAPI mciLoadCommandResource16(HINSTANCE16 hInst, LPCSTR resname, UINT16 type)
{
HRSRC16 res;
HGLOBAL16 handle;
void *ptr;
HRSRC16 res;
HGLOBAL16 handle;
const BYTE* ptr16;
BYTE* ptr32;
unsigned pos = 0, size = 1024, len;
const char* str;
DWORD flg;
WORD eid;
UINT16 ret = MCIERR_OUT_OF_MEMORY;
if (!(res = FindResource16( hInst, resname, (LPSTR)RT_RCDATA))) return MCI_NO_COMMAND_TABLE;
if (!(handle = LoadResource16( hInst, res ))) return MCI_NO_COMMAND_TABLE;
ptr = LockResource16(handle);
return MCI_SetCommandTable(ptr, type);
/* FIXME: FreeResource */
ptr16 = LockResource16(handle);
/* converting the 16 bit resource table into a 32W one */
if ((ptr32 = HeapAlloc(GetProcessHeap(), 0, size)))
{
do {
str = (LPCSTR)ptr16;
ptr16 += strlen(str) + 1;
flg = *(const DWORD*)ptr16;
eid = *(const WORD*)(ptr16 + sizeof(DWORD));
ptr16 += sizeof(DWORD) + sizeof(WORD);
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0) * sizeof(WCHAR);
if (pos + len + sizeof(DWORD) + sizeof(WORD) > size)
{
while (pos + len * sizeof(WCHAR) + sizeof(DWORD) + sizeof(WORD) > size) size += 1024;
ptr32 = HeapReAlloc(GetProcessHeap(), 0, ptr32, size);
if (!ptr32) goto the_end;
}
MultiByteToWideChar(CP_ACP, 0, str, -1, (LPWSTR)(ptr32 + pos), len / sizeof(WCHAR));
*(DWORD*)(ptr32 + pos + len) = flg;
*(WORD*)(ptr32 + pos + len + sizeof(DWORD)) = eid;
pos += len + sizeof(DWORD) + sizeof(WORD);
} while (eid != MCI_END_COMMAND_LIST);
}
the_end:
FreeResource16( handle );
if (ptr32) ret = MCI_SetCommandTable(ptr32, type);
return ret;
}
/**************************************************************************
@ -2630,7 +2668,7 @@ BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable)
{
TRACE("(%04x)!\n", uTable);
return mciFreeCommandResource(uTable);
return MCI_DeleteCommandTable(uTable, TRUE);
}
/* ###################################################

View file

@ -45,7 +45,7 @@
257 pascal midiStreamStop(word) midiStreamStop16
301 pascal midiInGetNumDevs() midiInGetNumDevs16
302 pascal midiInGetDevCaps(word ptr word) midiInGetDevCaps16
303 pascal midiInGetErrorText(word ptr word) midiInGetErrorText16
303 pascal midiInGetErrorText(word ptr word) midiOutGetErrorText16
304 pascal midiInOpen(ptr word long long long) midiInOpen16
305 pascal midiInClose(word) midiInClose16
306 pascal midiInPrepareHeader(word segptr word) midiInPrepareHeader16
@ -84,7 +84,7 @@
421 pascal waveOutMessage(word word long long) waveOutMessage16
501 pascal waveInGetNumDevs() waveInGetNumDevs16
502 pascal waveInGetDevCaps(word ptr word) waveInGetDevCaps16
503 pascal waveInGetErrorText(word ptr word) waveInGetErrorText16
503 pascal waveInGetErrorText(word ptr word) waveOutGetErrorText16
504 pascal waveInOpen(ptr word ptr long long long) waveInOpen16
505 pascal waveInClose(word) waveInClose16
506 pascal waveInPrepareHeader(word segptr word) waveInPrepareHeader16

View file

@ -87,7 +87,7 @@ typedef struct tagWINE_MM_DRIVER_PART {
typedef struct tagWINE_MM_DRIVER {
HDRVR hDriver;
LPSTR drvname; /* name of the driver */
BOOL bIs32 : 1, /* TRUE if 32 bit driver, FALSE for 16 */
unsigned bIs32 : 1, /* TRUE if 32 bit driver, FALSE for 16 */
bIsMapper : 1; /* TRUE if mapper */
WINE_MM_DRIVER_PART parts[MMDRV_MAX];/* Information for all known types */
} WINE_MM_DRIVER, *LPWINE_MM_DRIVER;
@ -139,9 +139,9 @@ typedef struct {
typedef struct tagWINE_MCIDRIVER {
UINT wDeviceID;
UINT wType;
LPSTR lpstrElementName;
LPSTR lpstrDeviceType;
LPSTR lpstrAlias;
LPWSTR lpstrElementName;
LPWSTR lpstrDeviceType;
LPWSTR lpstrAlias;
HDRVR hDriver;
DWORD dwPrivate;
YIELDPROC lpfnYieldProc;
@ -181,14 +181,14 @@ typedef struct tagWINE_MMIO {
MMIOINFO info;
struct tagWINE_MMIO* lpNext;
struct IOProcList* ioProc;
BOOL bTmpIOProc : 1,
unsigned bTmpIOProc : 1,
bBufferLoaded : 1;
DWORD segBuffer16;
DWORD dwFileSize;
} WINE_MMIO, *LPWINE_MMIO;
typedef struct tagWINE_PLAYSOUND {
BOOL bLoop : 1,
unsigned bLoop : 1,
bAlloc : 1;
LPCWSTR pszSound;
HMODULE hMod;
@ -224,8 +224,8 @@ typedef WINMM_MapType (*MMDRV_UNMAPFUNC)(UINT wMsg, LPDWORD lpdwUser, LP
HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam2);
LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr);
BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz);
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2);
BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz);
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCWSTR fn, LPARAM lParam2);
void DRIVER_UnloadAll(void);
BOOL MMDRV_Init(void);
@ -245,15 +245,18 @@ void MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_UNMAPFUNC,
MMDRV_MAPFUNC, MMDRV_UNMAPFUNC, LPDRVCALLBACK);
WINE_MCIDRIVER* MCI_GetDriver(UINT16 uDevID);
UINT MCI_GetDriverFromString(LPCSTR str);
DWORD MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
const char* MCI_MessageToString(UINT16 wMsg);
UINT MCI_GetDriverFromString(LPCWSTR str);
DWORD MCI_WriteString(LPWSTR lpDstStr, DWORD dstSize, LPCWSTR lpSrcStr);
const char* MCI_MessageToString(UINT wMsg);
UINT WINAPI MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data);
LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2);
DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
DWORD MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
UINT MCI_SetCommandTable(void *table, UINT uDevType);
BOOL MCI_DeleteCommandTable(UINT uTbl, BOOL delete);
LPWSTR MCI_strdupAtoW(LPCSTR str);
LPSTR MCI_strdupWtoA(LPCWSTR str);
BOOL WINMM_CheckForMMSystem(void);
const char* WINMM_ErrorToString(MMRESULT error);
@ -291,13 +294,13 @@ extern LPWINE_MM_IDATA WINMM_IData;
* NULL otherwise
*/
extern WINE_MMTHREAD* (*pFnGetMMThread16)(UINT16);
extern LPWINE_DRIVER (*pFnOpenDriver16)(LPCSTR,LPCSTR,LPARAM);
extern LPWINE_DRIVER (*pFnOpenDriver16)(LPCWSTR,LPCWSTR,LPARAM);
extern LRESULT (*pFnCloseDriver16)(UINT16,LPARAM,LPARAM);
extern LRESULT (*pFnSendMessage16)(UINT16,UINT,LPARAM,LPARAM);
extern WINMM_MapType (*pFnMciMapMsg16To32A)(WORD,WORD,DWORD*);
extern WINMM_MapType (*pFnMciUnMapMsg16To32A)(WORD,WORD,DWORD);
extern WINMM_MapType (*pFnMciMapMsg32ATo16)(WORD,WORD,DWORD,DWORD*);
extern WINMM_MapType (*pFnMciUnMapMsg32ATo16)(WORD,WORD,DWORD,DWORD);
extern WINMM_MapType (*pFnMciMapMsg16To32W)(WORD,WORD,DWORD*);
extern WINMM_MapType (*pFnMciUnMapMsg16To32W)(WORD,WORD,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);
extern unsigned (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER);
extern LRESULT (*pFnMmioCallback16)(DWORD,LPMMIOINFO,UINT,LPARAM,LPARAM);

View file

@ -53,27 +53,11 @@
#include "winreg.h"
#include "winternl.h"
#include "winemm.h"
#include "wownt32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winmm);
/******************************************************************
* MyUserYield
*
* Internal wrapper to call USER.UserYield16 (in fact through a Wine only export from USER32).
*/
static void MyUserYield(void)
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
if (mod)
{
FARPROC proc = GetProcAddress( mod, "UserYield16" );
if (proc) proc();
}
}
void (WINAPI *pFnReleaseThunkLock)(DWORD*);
void (WINAPI *pFnRestoreThunkLock)(DWORD);
@ -779,469 +763,6 @@ UINT WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD_PTR dw1, DWORD_PT
return MMDRV_Message(wmld, uMessage, dw1, dw2, TRUE);
}
/**************************************************************************
* mciGetErrorStringW [WINMM.@]
*/
BOOL WINAPI mciGetErrorStringW(MCIERROR wError, LPWSTR lpstrBuffer, UINT uLength)
{
char bufstr[MAXERRORLENGTH];
BOOL ret = mciGetErrorStringA(wError, bufstr, MAXERRORLENGTH);
MultiByteToWideChar( CP_ACP, 0, bufstr, -1, lpstrBuffer, uLength );
return ret;
}
/**************************************************************************
* mciGetErrorStringA [WINMM.@]
*/
BOOL WINAPI mciGetErrorStringA(MCIERROR dwError, LPSTR lpstrBuffer, UINT uLength)
{
BOOL ret = FALSE;
if (lpstrBuffer != NULL && uLength > 0 &&
dwError >= MCIERR_BASE && dwError <= MCIERR_CUSTOM_DRIVER_BASE) {
if (LoadStringA(WINMM_IData->hWinMM32Instance,
dwError, lpstrBuffer, uLength) > 0) {
ret = TRUE;
}
}
return ret;
}
/**************************************************************************
* mciDriverNotify [WINMM.@]
*/
BOOL WINAPI mciDriverNotify(HWND hWndCallBack, MCIDEVICEID wDevID, UINT wStatus)
{
TRACE("(%p, %04x, %04X)\n", hWndCallBack, wDevID, wStatus);
return PostMessageW(hWndCallBack, MM_MCINOTIFY, wStatus, wDevID);
}
/**************************************************************************
* mciGetDriverData [WINMM.@]
*/
DWORD WINAPI mciGetDriverData(MCIDEVICEID uDeviceID)
{
LPWINE_MCIDRIVER wmd;
TRACE("(%04x)\n", uDeviceID);
wmd = MCI_GetDriver(uDeviceID);
if (!wmd) {
WARN("Bad uDeviceID\n");
return 0L;
}
return wmd->dwPrivate;
}
/**************************************************************************
* mciSetDriverData [WINMM.@]
*/
BOOL WINAPI mciSetDriverData(MCIDEVICEID uDeviceID, DWORD data)
{
LPWINE_MCIDRIVER wmd;
TRACE("(%04x, %08lx)\n", uDeviceID, data);
wmd = MCI_GetDriver(uDeviceID);
if (!wmd) {
WARN("Bad uDeviceID\n");
return FALSE;
}
wmd->dwPrivate = data;
return TRUE;
}
/**************************************************************************
* mciSendCommandA [WINMM.@]
*/
DWORD WINAPI mciSendCommandA(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
DWORD dwRet;
TRACE("(%08x, %s, %08lx, %08lx)\n",
wDevID, MCI_MessageToString(wMsg), dwParam1, dwParam2);
dwRet = MCI_SendCommand(wDevID, wMsg, dwParam1, dwParam2, TRUE);
dwRet = MCI_CleanUp(dwRet, wMsg, dwParam2);
TRACE("=> %08lx\n", dwRet);
return dwRet;
}
inline static LPSTR strdupWtoA( LPCWSTR str )
{
LPSTR ret;
INT len;
if (!str) return NULL;
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
ret = HeapAlloc( GetProcessHeap(), 0, len );
if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
return ret;
}
static int MCI_MapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2)
{
switch(msg)
{
case MCI_CLOSE:
case MCI_PLAY:
case MCI_SEEK:
case MCI_STOP:
case MCI_PAUSE:
case MCI_GETDEVCAPS:
case MCI_SPIN:
case MCI_SET:
case MCI_STEP:
case MCI_RECORD:
case MCI_BREAK:
case MCI_SOUND:
case MCI_STATUS:
case MCI_CUE:
case MCI_REALIZE:
case MCI_PUT:
case MCI_WHERE:
case MCI_FREEZE:
case MCI_UNFREEZE:
case MCI_CUT:
case MCI_COPY:
case MCI_PASTE:
case MCI_UPDATE:
case MCI_RESUME:
case MCI_DELETE:
return 0;
case MCI_OPEN:
{
MCI_OPEN_PARMSW *mci_openW = (MCI_OPEN_PARMSW *)*dwParam2;
MCI_OPEN_PARMSA *mci_openA;
DWORD_PTR *ptr;
ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_openA) + sizeof(DWORD_PTR));
if (!ptr) return -1;
*ptr++ = *dwParam2; /* save the previous pointer */
*dwParam2 = (DWORD_PTR)ptr;
mci_openA = (MCI_OPEN_PARMSA *)ptr;
if (dwParam1 & MCI_NOTIFY)
mci_openA->dwCallback = mci_openW->dwCallback;
if (dwParam1 & MCI_OPEN_TYPE)
{
if (dwParam1 & MCI_OPEN_TYPE_ID)
mci_openA->lpstrDeviceType = (LPSTR)mci_openW->lpstrDeviceType;
else
mci_openA->lpstrDeviceType = strdupWtoA(mci_openW->lpstrDeviceType);
}
if (dwParam1 & MCI_OPEN_ELEMENT)
{
if (dwParam1 & MCI_OPEN_ELEMENT_ID)
mci_openA->lpstrElementName = (LPSTR)mci_openW->lpstrElementName;
else
mci_openA->lpstrElementName = strdupWtoA(mci_openW->lpstrElementName);
}
if (dwParam1 & MCI_OPEN_ALIAS)
mci_openA->lpstrAlias = strdupWtoA(mci_openW->lpstrAlias);
}
return 1;
case MCI_WINDOW:
if (dwParam1 & MCI_ANIM_WINDOW_TEXT)
{
MCI_ANIM_WINDOW_PARMSW *mci_windowW = (MCI_ANIM_WINDOW_PARMSW *)*dwParam2;
MCI_ANIM_WINDOW_PARMSA *mci_windowA;
mci_windowA = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_windowA));
if (!mci_windowA) return -1;
*dwParam2 = (DWORD_PTR)mci_windowA;
mci_windowA->lpstrText = strdupWtoA(mci_windowW->lpstrText);
if (dwParam1 & MCI_NOTIFY)
mci_windowA->dwCallback = mci_windowW->dwCallback;
if (dwParam1 & MCI_ANIM_WINDOW_HWND)
mci_windowA->hWnd = mci_windowW->hWnd;
if (dwParam1 & MCI_ANIM_WINDOW_STATE)
mci_windowA->nCmdShow = mci_windowW->nCmdShow;
return 1;
}
return 0;
case MCI_SYSINFO:
{
MCI_SYSINFO_PARMSW *mci_sysinfoW = (MCI_SYSINFO_PARMSW *)*dwParam2;
MCI_SYSINFO_PARMSA *mci_sysinfoA;
DWORD_PTR *ptr;
ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_sysinfoA) + sizeof(DWORD_PTR));
if (!ptr) return -1;
*ptr++ = *dwParam2; /* save the previous pointer */
*dwParam2 = (DWORD_PTR)ptr;
mci_sysinfoA = (MCI_SYSINFO_PARMSA *)ptr;
if (dwParam1 & MCI_NOTIFY)
mci_sysinfoA->dwCallback = mci_sysinfoW->dwCallback;
mci_sysinfoA->dwRetSize = mci_sysinfoW->dwRetSize; /* FIXME */
mci_sysinfoA->lpstrReturn = HeapAlloc(GetProcessHeap(), 0, mci_sysinfoA->dwRetSize);
return 1;
}
case MCI_INFO:
case MCI_SAVE:
case MCI_LOAD:
case MCI_ESCAPE:
default:
FIXME("Message 0x%04x needs translation\n", msg);
return -1;
}
}
static DWORD MCI_UnmapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2,
DWORD result)
{
switch(msg)
{
case MCI_OPEN:
{
DWORD_PTR *ptr = (DWORD_PTR *)dwParam2 - 1;
MCI_OPEN_PARMSW *mci_openW = (MCI_OPEN_PARMSW *)*ptr;
MCI_OPEN_PARMSA *mci_openA = (MCI_OPEN_PARMSA *)(ptr + 1);
mci_openW->wDeviceID = mci_openA->wDeviceID;
if (dwParam1 & MCI_OPEN_TYPE)
{
if (!(dwParam1 & MCI_OPEN_TYPE_ID))
HeapFree(GetProcessHeap(), 0, mci_openA->lpstrDeviceType);
}
if (dwParam1 & MCI_OPEN_ELEMENT)
{
if (!(dwParam1 & MCI_OPEN_ELEMENT_ID))
HeapFree(GetProcessHeap(), 0, mci_openA->lpstrElementName);
}
if (dwParam1 & MCI_OPEN_ALIAS)
HeapFree(GetProcessHeap(), 0, mci_openA->lpstrAlias);
HeapFree(GetProcessHeap(), 0, ptr);
}
break;
case MCI_WINDOW:
if (dwParam1 & MCI_ANIM_WINDOW_TEXT)
{
MCI_ANIM_WINDOW_PARMSA *mci_windowA = (MCI_ANIM_WINDOW_PARMSA *)dwParam2;
HeapFree(GetProcessHeap(), 0, (void *)mci_windowA->lpstrText);
HeapFree(GetProcessHeap(), 0, mci_windowA);
}
break;
case MCI_SYSINFO:
{
DWORD_PTR *ptr = (DWORD_PTR *)dwParam2 - 1;
MCI_SYSINFO_PARMSW *mci_sysinfoW = (MCI_SYSINFO_PARMSW *)*ptr;
MCI_SYSINFO_PARMSA *mci_sysinfoA = (MCI_SYSINFO_PARMSA *)(ptr + 1);
if (!result)
{
mci_sysinfoW->dwNumber = mci_sysinfoA->dwNumber;
mci_sysinfoW->wDeviceType = mci_sysinfoA->wDeviceType;
MultiByteToWideChar(CP_ACP, 0,
mci_sysinfoA->lpstrReturn, mci_sysinfoA->dwRetSize,
mci_sysinfoW->lpstrReturn, mci_sysinfoW->dwRetSize);
}
HeapFree(GetProcessHeap(), 0, mci_sysinfoA->lpstrReturn);
HeapFree(GetProcessHeap(), 0, ptr);
}
break;
default:
FIXME("Message 0x%04x needs unmapping\n", msg);
break;
}
return result;
}
/**************************************************************************
* mciSendCommandW [WINMM.@]
*
* FIXME: we should do the things other way around, but since our
* MM subsystem is not unicode aware...
*/
DWORD WINAPI mciSendCommandW(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
DWORD ret;
int mapped;
TRACE("(%08x, %s, %08lx, %08lx)\n",
wDevID, MCI_MessageToString(wMsg), dwParam1, dwParam2);
mapped = MCI_MapMsgWtoA(wMsg, dwParam1, &dwParam2);
if (mapped == -1)
{
FIXME("message %04x mapping failed\n", wMsg);
return MMSYSERR_NOMEM;
}
ret = mciSendCommandA(wDevID, wMsg, dwParam1, dwParam2);
if (mapped)
MCI_UnmapMsgWtoA(wMsg, dwParam1, dwParam2, ret);
return ret;
}
/**************************************************************************
* mciGetDeviceIDA [WINMM.@]
*/
UINT WINAPI mciGetDeviceIDA(LPCSTR lpstrName)
{
return MCI_GetDriverFromString(lpstrName);
}
/**************************************************************************
* mciGetDeviceIDW [WINMM.@]
*/
UINT WINAPI mciGetDeviceIDW(LPCWSTR lpwstrName)
{
LPSTR lpstrName = NULL;
UINT ret;
INT len;
if (lpwstrName) {
len = WideCharToMultiByte( CP_ACP, 0, lpwstrName, -1, NULL, 0, NULL, NULL );
lpstrName = HeapAlloc( GetProcessHeap(), 0, len );
if (lpstrName) WideCharToMultiByte( CP_ACP, 0, lpwstrName, -1, lpstrName, len, NULL, NULL );
}
ret = MCI_GetDriverFromString(lpstrName);
HeapFree(GetProcessHeap(), 0, lpstrName);
return ret;
}
/**************************************************************************
* MCI_DefYieldProc [internal]
*/
UINT WINAPI MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data)
{
INT16 ret;
TRACE("(0x%04x, 0x%08lx)\n", wDevID, data);
if ((HIWORD(data) != 0 && HWND_16(GetActiveWindow()) != HIWORD(data)) ||
(GetAsyncKeyState(LOWORD(data)) & 1) == 0) {
MyUserYield();
ret = 0;
} else {
MSG msg;
msg.hwnd = HWND_32(HIWORD(data));
while (!PeekMessageA(&msg, msg.hwnd, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE));
ret = -1;
}
return ret;
}
/**************************************************************************
* mciSetYieldProc [WINMM.@]
*/
BOOL WINAPI mciSetYieldProc(MCIDEVICEID uDeviceID, YIELDPROC fpYieldProc, DWORD dwYieldData)
{
LPWINE_MCIDRIVER wmd;
TRACE("(%u, %p, %08lx)\n", uDeviceID, fpYieldProc, dwYieldData);
if (!(wmd = MCI_GetDriver(uDeviceID))) {
WARN("Bad uDeviceID\n");
return FALSE;
}
wmd->lpfnYieldProc = fpYieldProc;
wmd->dwYieldData = dwYieldData;
wmd->bIs32 = TRUE;
return TRUE;
}
/**************************************************************************
* mciGetDeviceIDFromElementIDW [WINMM.@]
*/
UINT WINAPI mciGetDeviceIDFromElementIDW(DWORD dwElementID, LPCWSTR lpstrType)
{
/* FIXME: that's rather strange, there is no
* mciGetDeviceIDFromElementID32A in winmm.spec
*/
FIXME("(%lu, %p) stub\n", dwElementID, lpstrType);
return 0;
}
/**************************************************************************
* mciGetYieldProc [WINMM.@]
*/
YIELDPROC WINAPI mciGetYieldProc(MCIDEVICEID uDeviceID, DWORD* lpdwYieldData)
{
LPWINE_MCIDRIVER wmd;
TRACE("(%u, %p)\n", uDeviceID, lpdwYieldData);
if (!(wmd = MCI_GetDriver(uDeviceID))) {
WARN("Bad uDeviceID\n");
return NULL;
}
if (!wmd->lpfnYieldProc) {
WARN("No proc set\n");
return NULL;
}
if (!wmd->bIs32) {
WARN("Proc is 32 bit\n");
return NULL;
}
return wmd->lpfnYieldProc;
}
/**************************************************************************
* mciGetCreatorTask [WINMM.@]
*/
HTASK WINAPI mciGetCreatorTask(MCIDEVICEID uDeviceID)
{
LPWINE_MCIDRIVER wmd;
HTASK ret = 0;
if ((wmd = MCI_GetDriver(uDeviceID))) ret = (HTASK)wmd->CreatorThread;
TRACE("(%u) => %p\n", uDeviceID, ret);
return ret;
}
/**************************************************************************
* mciDriverYield [WINMM.@]
*/
UINT WINAPI mciDriverYield(MCIDEVICEID uDeviceID)
{
LPWINE_MCIDRIVER wmd;
UINT ret = 0;
TRACE("(%04x)\n", uDeviceID);
if (!(wmd = MCI_GetDriver(uDeviceID)) || !wmd->lpfnYieldProc || !wmd->bIs32) {
MyUserYield();
} else {
ret = wmd->lpfnYieldProc(uDeviceID, wmd->dwYieldData);
}
return ret;
}
/**************************************************************************
* midiOutGetNumDevs [WINMM.@]
*/
@ -1299,49 +820,50 @@ UINT WINAPI midiOutGetDevCapsA(UINT_PTR uDeviceID, LPMIDIOUTCAPSA lpCaps,
}
/**************************************************************************
* MIDI_GetErrorText [internal]
* midiOutGetErrorTextA [WINMM.@]
* midiInGetErrorTextA [WINMM.@]
*/
static UINT16 MIDI_GetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
UINT WINAPI midiOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
{
UINT16 ret = MMSYSERR_BADERRNUM;
UINT ret;
if (lpText == NULL) {
ret = MMSYSERR_INVALPARAM;
} else if (uSize == 0) {
ret = MMSYSERR_NOERROR;
} else if (
/* test has been removed 'coz MMSYSERR_BASE is 0, and gcc did emit
* a warning for the test was always true */
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
(uError >= MIDIERR_BASE && uError <= MIDIERR_LASTERROR)) {
if (LoadStringA(WINMM_IData->hWinMM32Instance,
uError, lpText, uSize) > 0) {
ret = MMSYSERR_NOERROR;
}
if (lpText == NULL) ret = MMSYSERR_INVALPARAM;
else if (uSize == 0) ret = MMSYSERR_NOERROR;
else
{
LPWSTR xstr = HeapAlloc(GetProcessHeap(), 0, uSize * sizeof(WCHAR));
if (!xstr) ret = MMSYSERR_NOMEM;
else
{
ret = midiOutGetErrorTextW(uError, xstr, uSize);
if (ret == MMSYSERR_NOERROR)
WideCharToMultiByte(CP_ACP, 0, xstr, -1, lpText, uSize, NULL, NULL);
HeapFree(GetProcessHeap(), 0, xstr);
}
}
return ret;
}
/**************************************************************************
* midiOutGetErrorTextA [WINMM.@]
*/
UINT WINAPI midiOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
{
return MIDI_GetErrorText(uError, lpText, uSize);
}
/**************************************************************************
* midiOutGetErrorTextW [WINMM.@]
* midiInGetErrorTextW [WINMM.@]
*/
UINT WINAPI midiOutGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
{
LPSTR xstr = HeapAlloc(GetProcessHeap(), 0, uSize);
UINT ret;
UINT ret = MMSYSERR_BADERRNUM;
ret = MIDI_GetErrorText(uError, xstr, uSize);
MultiByteToWideChar( CP_ACP, 0, xstr, -1, lpText, uSize );
HeapFree(GetProcessHeap(), 0, xstr);
if (lpText == NULL) ret = MMSYSERR_INVALPARAM;
else if (uSize == 0) ret = MMSYSERR_NOERROR;
else if (
/* test has been removed 'coz MMSYSERR_BASE is 0, and gcc did emit
* a warning for the test was always true */
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
(uError >= MIDIERR_BASE && uError <= MIDIERR_LASTERROR)) {
if (LoadStringW(WINMM_IData->hWinMM32Instance,
uError, lpText, uSize) > 0) {
ret = MMSYSERR_NOERROR;
}
}
return ret;
}
@ -1674,27 +1196,6 @@ UINT WINAPI midiInGetDevCapsA(UINT_PTR uDeviceID, LPMIDIINCAPSA lpCaps, UINT uSi
return ret;
}
/**************************************************************************
* midiInGetErrorTextW [WINMM.@]
*/
UINT WINAPI midiInGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
{
LPSTR xstr = HeapAlloc(GetProcessHeap(), 0, uSize);
UINT ret = MIDI_GetErrorText(uError, xstr, uSize);
MultiByteToWideChar( CP_ACP, 0, xstr, -1, lpText, uSize );
HeapFree(GetProcessHeap(), 0, xstr);
return ret;
}
/**************************************************************************
* midiInGetErrorTextA [WINMM.@]
*/
UINT WINAPI midiInGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
{
return MIDI_GetErrorText(uError, lpText, uSize);
}
UINT MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD_PTR dwCallback,
DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32)
{
@ -2629,48 +2130,50 @@ UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps,
}
/**************************************************************************
* WAVE_GetErrorText [internal]
* waveOutGetErrorTextA [WINMM.@]
* waveInGetErrorTextA [WINMM.@]
*/
static UINT16 WAVE_GetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
UINT WINAPI waveOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
{
UINT16 ret = MMSYSERR_BADERRNUM;
UINT ret;
if (lpText == NULL) {
ret = MMSYSERR_INVALPARAM;
} else if (uSize == 0) {
ret = MMSYSERR_NOERROR;
} else if (
/* test has been removed 'coz MMSYSERR_BASE is 0, and gcc did emit
* a warning for the test was always true */
(/*uError >= MMSYSERR_BASE && */uError <= MMSYSERR_LASTERROR) ||
(uError >= WAVERR_BASE && uError <= WAVERR_LASTERROR)) {
if (LoadStringA(WINMM_IData->hWinMM32Instance,
uError, lpText, uSize) > 0) {
ret = MMSYSERR_NOERROR;
}
if (lpText == NULL) ret = MMSYSERR_INVALPARAM;
else if (uSize == 0) ret = MMSYSERR_NOERROR;
else
{
LPWSTR xstr = HeapAlloc(GetProcessHeap(), 0, uSize * sizeof(WCHAR));
if (!xstr) ret = MMSYSERR_NOMEM;
else
{
ret = waveOutGetErrorTextW(uError, xstr, uSize);
if (ret == MMSYSERR_NOERROR)
WideCharToMultiByte(CP_ACP, 0, xstr, -1, lpText, uSize, NULL, NULL);
HeapFree(GetProcessHeap(), 0, xstr);
}
}
return ret;
}
/**************************************************************************
* waveOutGetErrorTextA [WINMM.@]
*/
UINT WINAPI waveOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
{
return WAVE_GetErrorText(uError, lpText, uSize);
}
/**************************************************************************
* waveOutGetErrorTextW [WINMM.@]
* waveInGetErrorTextW [WINMM.@]
*/
UINT WINAPI waveOutGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
{
LPSTR xstr = HeapAlloc(GetProcessHeap(), 0, uSize);
UINT ret = WAVE_GetErrorText(uError, xstr, uSize);
UINT ret = MMSYSERR_BADERRNUM;
MultiByteToWideChar( CP_ACP, 0, xstr, -1, lpText, uSize );
HeapFree(GetProcessHeap(), 0, xstr);
if (lpText == NULL) ret = MMSYSERR_INVALPARAM;
else if (uSize == 0) ret = MMSYSERR_NOERROR;
else if (
/* test has been removed 'coz MMSYSERR_BASE is 0, and gcc did emit
* a warning for the test was always true */
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
(uError >= WAVERR_BASE && uError <= WAVERR_LASTERROR)) {
if (LoadStringW(WINMM_IData->hWinMM32Instance,
uError, lpText, uSize) > 0) {
ret = MMSYSERR_NOERROR;
}
}
return ret;
}
@ -3040,27 +2543,6 @@ UINT WINAPI waveInGetDevCapsA(UINT_PTR uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSi
return ret;
}
/**************************************************************************
* waveInGetErrorTextA [WINMM.@]
*/
UINT WINAPI waveInGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
{
return WAVE_GetErrorText(uError, lpText, uSize);
}
/**************************************************************************
* waveInGetErrorTextW [WINMM.@]
*/
UINT WINAPI waveInGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
{
LPSTR txt = HeapAlloc(GetProcessHeap(), 0, uSize);
UINT ret = WAVE_GetErrorText(uError, txt, uSize);
MultiByteToWideChar( CP_ACP, 0, txt, -1, lpText, uSize );
HeapFree(GetProcessHeap(), 0, txt);
return ret;
}
/**************************************************************************
* waveInOpen [WINMM.@]
*/

View file

@ -10,12 +10,12 @@
@ stdcall DrvClose(long long long) CloseDriver
@ stdcall DrvDefDriverProc(long long long long long) DefDriverProc
@ stdcall DrvGetModuleHandle(long) GetDriverModuleHandle
@ stdcall DrvOpen(wstr wstr long) OpenDriverW
@ stdcall DrvOpen(wstr wstr long) OpenDriver
@ stdcall DrvOpenA(str str long) OpenDriverA
@ stdcall DrvSendMessage(long long long long) SendDriverMessage
@ stdcall GetDriverFlags(long)
@ stdcall GetDriverModuleHandle(long)
@ stdcall OpenDriver(wstr wstr long) OpenDriverW
@ stdcall OpenDriver(wstr wstr long)
@ stdcall OpenDriverA(str str long)
@ stdcall PlaySound(ptr long long) PlaySoundA
@ stdcall PlaySoundW(ptr long long)
@ -42,8 +42,9 @@
@ stdcall mciFreeCommandResource(long)
@ stdcall mciGetCreatorTask(long)
@ stdcall mciGetDeviceIDA(str)
@ stdcall mciGetDeviceIDFromElementIDW(long str)
@ stdcall mciGetDeviceIDW(str)
@ stdcall mciGetDeviceIDW(wstr)
@ stdcall mciGetDeviceIDFromElementIDA(long str)
@ stdcall mciGetDeviceIDFromElementIDW(long wstr)
@ stdcall mciGetDriverData(long)
@ stdcall mciGetErrorStringA(long ptr long)
@ stdcall mciGetErrorStringW(long ptr long)
@ -61,8 +62,8 @@
@ stdcall midiInClose(long)
@ stdcall midiInGetDevCapsA(long ptr long)
@ stdcall midiInGetDevCapsW(long ptr long)
@ stdcall midiInGetErrorTextA(long ptr long)
@ stdcall midiInGetErrorTextW(long ptr long)
@ stdcall midiInGetErrorTextA(long ptr long) midiOutGetErrorTextA
@ stdcall midiInGetErrorTextW(long ptr long) midiOutGetErrorTextW
@ stdcall midiInGetID(long ptr)
@ stdcall midiInGetNumDevs()
@ stdcall midiInMessage(long long long long)
@ -153,8 +154,8 @@
@ stdcall waveInClose(long)
@ stdcall waveInGetDevCapsA(long ptr long)
@ stdcall waveInGetDevCapsW(long ptr long)
@ stdcall waveInGetErrorTextA(long ptr long)
@ stdcall waveInGetErrorTextW(long ptr long)
@ stdcall waveInGetErrorTextA(long ptr long) waveOutGetErrorTextA
@ stdcall waveInGetErrorTextW(long ptr long) waveOutGetErrorTextW
@ stdcall waveInGetID(long ptr)
@ stdcall waveInGetNumDevs()
@ stdcall waveInGetPosition(long ptr long)
@ -188,3 +189,23 @@
@ stdcall waveOutSetVolume(long long)
@ stdcall waveOutUnprepareHeader(long ptr long)
@ stdcall waveOutWrite(long ptr long)
# MigrateAllDrivers
# MigrateSoundEvents
# NotifyCallbackData
# WOW32DriverCallback
# WOW32ResolveMultiMediaHandle
# WOWAppExit
# WinmmLogoff
# WinmmLogon
# mid32Message
# mmDrvInstall
# aux32Message
# joy32Message
# mci32Message
# mod32Message
# mxd32Message
# tid32Message
# wid32Message
# winmmDbgOut
# winmmSetDebugLevel
# wod32Message

View file

@ -71,8 +71,8 @@ MCIERR_DRIVER, "Es gibt ein Problem mit dem Ger
MCIERR_CANNOT_USE_ALL, "Der Gerätename 'all' ist nicht in diesem Befehl erlaubt."
MCIERR_MULTIPLE, "Es traten Fehler in mehr als einem Gerät auf. Geben Sie jeden Befehl für jedes Gerät einzeln an, um zu bestimmen, welches Gerät die Fehler verursachte."
MCIERR_EXTENSION_NOT_FOUND, "Kann keinen Gerätetyp aus der angegebenen Dateinamenerweiterung ermitteln."
MCIERR_OUTOFRANGE, "Der angegebene Paramter liegt außerhalb des zulässigen Bereichs für diesen Befehl."
MCIERR_FLAGS_NOT_COMPATIBLE, "Die Paramter können nicht zusammen verwendet werden."
MCIERR_OUTOFRANGE, "Der angegebene Parameter liegt außerhalb des zulässigen Bereichs für diesen Befehl."
MCIERR_FLAGS_NOT_COMPATIBLE, "Die Parameter können nicht zusammen verwendet werden."
MCIERR_FILE_NOT_SAVED, "Die Datei kann nicht gespeichert werden. Stellen Sie sicher, dass genügend Platz auf dem Datenträger verfügbar ist oder Ihre Netzwerkverbindung noch besteht."
MCIERR_DEVICE_TYPE_REQUIRED, "Das angegebene Gerät wurde nicht gefunden. Stellen Sie sicher, dass es installiert ist oder der Gerätename richtig geschrieben ist."
MCIERR_DEVICE_LOCKED, "Das angegebene Gerät wird geschlossen. Warten Sie einige Sekunden, und versuchen Sie es erneut."

File diff suppressed because it is too large Load diff