- 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)
This commit is contained in:
Eric Pouech 2005-02-09 22:26:25 +00:00 committed by Alexandre Julliard
parent e40af1ccd0
commit 1eed552b4d
22 changed files with 3760 additions and 2800 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

View File

@ -28,6 +28,7 @@
#include "wownt32.h"
#include "mmddk.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(mcianim);
@ -40,7 +41,7 @@ typedef struct {
int nUseCount; /* Incremented for each shared open */
BOOL fShareable; /* TRUE if first open was shareable */
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
MCI_OPEN_PARMSA openParms;
MCI_OPEN_PARMSW openParms;
DWORD dwTimeFormat;
int mode;
UINT nCurTrack;
@ -56,7 +57,7 @@ typedef struct {
/**************************************************************************
* MCIANIM_drvOpen [internal]
*/
static DWORD MCIANIM_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
static DWORD MCIANIM_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
{
WINE_MCIANIM* wma;
@ -105,7 +106,7 @@ static WINE_MCIANIM* MCIANIM_mciGetOpenDrv(UINT16 wDevID)
/**************************************************************************
* MCIANIM_mciOpen [internal]
*/
static DWORD MCIANIM_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpenParms)
static DWORD MCIANIM_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenParms)
{
DWORD dwDeviceID;
WINE_MCIANIM* wma = (WINE_MCIANIM*)mciGetDriverData(wDevID);
@ -136,8 +137,8 @@ static DWORD MCIANIM_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpO
/*TRACE("lpParms->wDevID=%04X\n", lpParms->wDeviceID);*/
if (dwFlags & MCI_OPEN_ELEMENT) {
TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpOpenParms->lpstrElementName);
if (lpOpenParms->lpstrElementName && strlen(lpOpenParms->lpstrElementName) > 0) {
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
if (lpOpenParms->lpstrElementName && strlenW(lpOpenParms->lpstrElementName) > 0) {
}
FIXME("element is not opened\n");
}
@ -343,11 +344,13 @@ static DWORD MCIANIM_CalcFrame(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwTi
/**************************************************************************
* MCIANIM_mciInfo [internal]
*/
static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSW lpParms)
{
WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
LPCSTR str = 0;
LPCWSTR str = 0;
DWORD ret = 0;
static const WCHAR wszAnimation[] = {'W','i','n','e','\'','s',' ','a','n','i','m','a','t','i','o','n',0};
static const WCHAR wszWindow [] = {'A','n','i','m','a','t','i','o','n',' ','W','i','n','d','o','w',0};
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
@ -360,26 +363,20 @@ static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpP
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch(dwFlags) {
case MCI_INFO_PRODUCT:
str = "Wine's animation";
break;
case MCI_INFO_FILE:
str = wma->openParms.lpstrElementName;
break;
case MCI_ANIM_INFO_TEXT:
str = "Animation Window";
break;
case MCI_INFO_PRODUCT: str = wszAnimation; break;
case MCI_INFO_FILE: str = wma->openParms.lpstrElementName; break;
case MCI_ANIM_INFO_TEXT: str = wszWindow; break;
default:
WARN("Don't know this info command (%lu)\n", dwFlags);
return MCIERR_UNRECOGNIZED_COMMAND;
}
if (str) {
if (lpParms->dwRetSize <= strlen(str)) {
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
if (lpParms->dwRetSize <= strlenW(str)) {
lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
ret = MCIERR_PARAM_OVERFLOW;
} else {
strcpy(lpParms->lpstrReturn, str);
strcpyW(lpParms->lpstrReturn, str);
}
} else {
*lpParms->lpstrReturn = 0;
@ -658,7 +655,7 @@ LONG WINAPI MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
switch (wMsg) {
case DRV_LOAD: return 1;
case DRV_FREE: return 1;
case DRV_OPEN: return MCIANIM_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
case DRV_OPEN: return MCIANIM_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
case DRV_CLOSE: return MCIANIM_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
@ -671,10 +668,10 @@ LONG WINAPI MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
switch (wMsg) {
case MCI_OPEN_DRIVER: return MCIANIM_mciOpen(dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)dwParam2);
case MCI_OPEN_DRIVER: return MCIANIM_mciOpen(dwDevID, dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
case MCI_CLOSE_DRIVER: return MCIANIM_mciClose(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
case MCI_GETDEVCAPS: return MCIANIM_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
case MCI_INFO: return MCIANIM_mciInfo(dwDevID, dwParam1, (LPMCI_INFO_PARMSA)dwParam2);
case MCI_INFO: return MCIANIM_mciInfo(dwDevID, dwParam1, (LPMCI_INFO_PARMSW)dwParam2);
case MCI_STATUS: return MCIANIM_mciStatus(dwDevID, dwParam1, (LPMCI_STATUS_PARMS)dwParam2);
case MCI_SET: return MCIANIM_mciSet(dwDevID, dwParam1, (LPMCI_SET_PARMS)dwParam2);
case MCI_PLAY: return MCIANIM_mciPlay(dwDevID, dwParam1, (LPMCI_PLAY_PARMS)dwParam2);

View File

@ -23,6 +23,7 @@
#include <string.h>
#include "private_mciavi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(mciavi);
@ -148,11 +149,12 @@ DWORD MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS l
/***************************************************************************
* MCIAVI_mciInfo [internal]
*/
DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms)
DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms)
{
LPCSTR str = 0;
LPCWSTR str = 0;
WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
DWORD ret = 0;
static const WCHAR wszAviPlayer[] = {'W','i','n','e','\'','s',' ','A','V','I',' ','p','l','a','y','e','r',0};
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
return MCIERR_NULL_PARAMETER_BLOCK;
@ -163,22 +165,18 @@ DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms)
EnterCriticalSection(&wma->cs);
switch (dwFlags) {
case MCI_INFO_PRODUCT:
str = "Wine's AVI player";
break;
case MCI_INFO_FILE:
str = wma->lpFileName;
break;
case MCI_INFO_PRODUCT: str = wszAviPlayer; break;
case MCI_INFO_FILE: str = wma->lpFileName; break;
default:
WARN("Don't know this info command (%lu)\n", dwFlags);
LeaveCriticalSection(&wma->cs);
return MCIERR_UNRECOGNIZED_COMMAND;
}
if (str) {
if (strlen(str) + 1 > lpParms->dwRetSize) {
if (strlenW(str) + 1 > lpParms->dwRetSize) {
ret = MCIERR_PARAM_OVERFLOW;
} else {
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize);
lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize);
}
} else {
lpParms->lpstrReturn[0] = 0;
@ -325,7 +323,7 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
/***************************************************************************
* MCIAVI_mciStatus [internal]
*/
DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpParms)
DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
{
WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
DWORD ret = 0;

View File

@ -1,4 +1,4 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* Digital video MCI Wine Driver
@ -40,6 +40,7 @@
#include <string.h>
#include "private_mciavi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(mciavi);
@ -135,12 +136,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
/**************************************************************************
* MCIAVI_drvOpen [internal]
*/
static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
static DWORD MCIAVI_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
{
WINE_MCIAVI* wma;
static const WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
TRACE("%s, %p\n", debugstr_a(str), modp);
TRACE("%s, %p\n", debugstr_w(str), modp);
/* session instance */
if (!modp) return 0xFFFFFFFF;
@ -274,7 +275,7 @@ static void MCIAVI_CleanUp(WINE_MCIAVI* wma)
* MCIAVI_mciOpen [internal]
*/
static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
LPMCI_DGV_OPEN_PARMSA lpOpenParms)
LPMCI_DGV_OPEN_PARMSW lpOpenParms)
{
WINE_MCIAVI *wma;
LRESULT dwRet = 0;
@ -314,20 +315,20 @@ static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
* contains the hFile value ?
*/
dwRet = MCIERR_UNRECOGNIZED_COMMAND;
} else if (strlen(lpOpenParms->lpstrElementName) > 0) {
} else if (strlenW(lpOpenParms->lpstrElementName) > 0) {
/* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpOpenParms->lpstrElementName);
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
if (lpOpenParms->lpstrElementName && (strlen(lpOpenParms->lpstrElementName) > 0))
if (lpOpenParms->lpstrElementName && (strlenW(lpOpenParms->lpstrElementName) > 0))
{
wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, strlen(lpOpenParms->lpstrElementName) + 1);
strcpy(wma->lpFileName, lpOpenParms->lpstrElementName);
wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpOpenParms->lpstrElementName) + 1) * sizeof(WCHAR));
strcpyW(wma->lpFileName, lpOpenParms->lpstrElementName);
wma->hFile = mmioOpenA(lpOpenParms->lpstrElementName, NULL,
wma->hFile = mmioOpenW(lpOpenParms->lpstrElementName, NULL,
MMIO_ALLOCBUF | MMIO_DENYWRITE | MMIO_READ);
if (wma->hFile == 0) {
WARN("can't find file='%s' !\n", lpOpenParms->lpstrElementName);
WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName));
dwRet = MCIERR_FILE_NOT_FOUND;
} else {
if (!MCIAVI_GetInfo(wma))
@ -750,7 +751,7 @@ static DWORD MCIAVI_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
/*****************************************************************************
* MCIAVI_mciLoad [internal]
*/
static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSA lpParms)
static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -769,7 +770,7 @@ static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSA lp
/******************************************************************************
* MCIAVI_mciSave [internal]
*/
static DWORD MCIAVI_mciSave(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SAVE_PARMSA lpParms)
static DWORD MCIAVI_mciSave(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SAVE_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -983,7 +984,7 @@ static DWORD MCIAVI_mciCue(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpPar
/******************************************************************************
* MCIAVI_mciCapture [internal]
*/
static DWORD MCIAVI_mciCapture(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CAPTURE_PARMSA lpParms)
static DWORD MCIAVI_mciCapture(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CAPTURE_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1021,7 +1022,7 @@ static DWORD MCIAVI_mciMonitor(UINT wDevID, DWORD dwFlags, LPMCI_DGV_MONITOR_PAR
/******************************************************************************
* MCIAVI_mciReserve [internal]
*/
static DWORD MCIAVI_mciReserve(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESERVE_PARMSA lpParms)
static DWORD MCIAVI_mciReserve(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESERVE_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1040,7 +1041,7 @@ static DWORD MCIAVI_mciReserve(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESERVE_PAR
/******************************************************************************
* MCIAVI_mciSetAudio [internal]
*/
static DWORD MCIAVI_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSA lpParms)
static DWORD MCIAVI_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1078,7 +1079,7 @@ static DWORD MCIAVI_mciSignal(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS
/******************************************************************************
* MCIAVI_mciSetVideo [internal]
*/
static DWORD MCIAVI_mciSetVideo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSA lpParms)
static DWORD MCIAVI_mciSetVideo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1097,7 +1098,7 @@ static DWORD MCIAVI_mciSetVideo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_P
/******************************************************************************
* MCIAVI_mciQuality [internal]
*/
static DWORD MCIAVI_mciQuality(UINT wDevID, DWORD dwFlags, LPMCI_DGV_QUALITY_PARMSA lpParms)
static DWORD MCIAVI_mciQuality(UINT wDevID, DWORD dwFlags, LPMCI_DGV_QUALITY_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1116,7 +1117,7 @@ static DWORD MCIAVI_mciQuality(UINT wDevID, DWORD dwFlags, LPMCI_DGV_QUALITY_PAR
/******************************************************************************
* MCIAVI_mciList [internal]
*/
static DWORD MCIAVI_mciList(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LIST_PARMSA lpParms)
static DWORD MCIAVI_mciList(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LIST_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1173,7 +1174,7 @@ static DWORD MCIAVI_mciConfigure(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS
/******************************************************************************
* MCIAVI_mciRestore [internal]
*/
static DWORD MCIAVI_mciRestore(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESTORE_PARMSA lpParms)
static DWORD MCIAVI_mciRestore(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESTORE_PARMSW lpParms)
{
WINE_MCIAVI *wma;
@ -1205,7 +1206,7 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
switch (wMsg) {
case DRV_LOAD: return 1;
case DRV_FREE: return 1;
case DRV_OPEN: return MCIAVI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
case DRV_OPEN: return MCIAVI_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
case DRV_CLOSE: return MCIAVI_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
@ -1219,7 +1220,7 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
if (dwDevID == 0xFFFFFFFF) return 1;
switch (wMsg) {
case MCI_OPEN_DRIVER: return MCIAVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSA) dwParam2);
case MCI_OPEN_DRIVER: return MCIAVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
case MCI_CLOSE_DRIVER: return MCIAVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
case MCI_RECORD: return MCIAVI_mciRecord (dwDevID, dwParam1, (LPMCI_DGV_RECORD_PARMS) dwParam2);
@ -1227,14 +1228,14 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_SET: return MCIAVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
case MCI_PAUSE: return MCIAVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_RESUME: return MCIAVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_STATUS: return MCIAVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSA) dwParam2);
case MCI_STATUS: return MCIAVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
case MCI_GETDEVCAPS: return MCIAVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
case MCI_INFO: return MCIAVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSA) dwParam2);
case MCI_INFO: return MCIAVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSW) dwParam2);
case MCI_SEEK: return MCIAVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
case MCI_PUT: return MCIAVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
case MCI_WINDOW: return MCIAVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSA) dwParam2);
case MCI_LOAD: return MCIAVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSA) dwParam2);
case MCI_SAVE: return MCIAVI_mciSave (dwDevID, dwParam1, (LPMCI_DGV_SAVE_PARMSA) dwParam2);
case MCI_WINDOW: return MCIAVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW) dwParam2);
case MCI_LOAD: return MCIAVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSW) dwParam2);
case MCI_SAVE: return MCIAVI_mciSave (dwDevID, dwParam1, (LPMCI_DGV_SAVE_PARMSW) dwParam2);
case MCI_FREEZE: return MCIAVI_mciFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
case MCI_REALIZE: return MCIAVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_UNFREEZE: return MCIAVI_mciUnFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
@ -1247,17 +1248,17 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_PASTE: return MCIAVI_mciPaste (dwDevID, dwParam1, (LPMCI_DGV_PASTE_PARMS) dwParam2);
case MCI_CUE: return MCIAVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2);
/* Digital Video specific */
case MCI_CAPTURE: return MCIAVI_mciCapture (dwDevID, dwParam1, (LPMCI_DGV_CAPTURE_PARMSA) dwParam2);
case MCI_CAPTURE: return MCIAVI_mciCapture (dwDevID, dwParam1, (LPMCI_DGV_CAPTURE_PARMSW) dwParam2);
case MCI_MONITOR: return MCIAVI_mciMonitor (dwDevID, dwParam1, (LPMCI_DGV_MONITOR_PARMS) dwParam2);
case MCI_RESERVE: return MCIAVI_mciReserve (dwDevID, dwParam1, (LPMCI_DGV_RESERVE_PARMSA) dwParam2);
case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSA) dwParam2);
case MCI_RESERVE: return MCIAVI_mciReserve (dwDevID, dwParam1, (LPMCI_DGV_RESERVE_PARMSW) dwParam2);
case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2);
case MCI_SIGNAL: return MCIAVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
case MCI_SETVIDEO: return MCIAVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSA) dwParam2);
case MCI_QUALITY: return MCIAVI_mciQuality (dwDevID, dwParam1, (LPMCI_DGV_QUALITY_PARMSA) dwParam2);
case MCI_LIST: return MCIAVI_mciList (dwDevID, dwParam1, (LPMCI_DGV_LIST_PARMSA) dwParam2);
case MCI_SETVIDEO: return MCIAVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSW) dwParam2);
case MCI_QUALITY: return MCIAVI_mciQuality (dwDevID, dwParam1, (LPMCI_DGV_QUALITY_PARMSW) dwParam2);
case MCI_LIST: return MCIAVI_mciList (dwDevID, dwParam1, (LPMCI_DGV_LIST_PARMSW) dwParam2);
case MCI_UNDO: return MCIAVI_mciUndo (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_CONFIGURE: return MCIAVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_RESTORE: return MCIAVI_mciRestore (dwDevID, dwParam1, (LPMCI_DGV_RESTORE_PARMSA) dwParam2);
case MCI_RESTORE: return MCIAVI_mciRestore (dwDevID, dwParam1, (LPMCI_DGV_RESTORE_PARMSW) dwParam2);
case MCI_SPIN:
case MCI_ESCAPE:

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ typedef struct {
BOOL fShareable; /* TRUE if first open was shareable */
WORD wCommandTable; /* custom MCI command table */
DWORD dwStatus; /* One of MCI_MODE_XXX */
LPSTR lpFileName;
LPWSTR lpFileName;
DWORD dwMciTimeFormat; /* current time format */
DWORD dwSet; /* what's turned on: video & audio l&r */
/* information on the loaded AVI file */
@ -90,9 +90,9 @@ extern HINSTANCE MCIAVI_hInstance;
DWORD MCIAVI_ConvertFrameToTimeFormat(WINE_MCIAVI* wma, DWORD val, LPDWORD lpRet);
DWORD MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI* wma, DWORD val);
DWORD MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms);
DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms);
DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms);
DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms);
DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpParms);
DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms);
/* mmoutput.c */
BOOL MCIAVI_GetInfo(WINE_MCIAVI* wma);
@ -108,9 +108,9 @@ DWORD MCIAVI_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
/* wnd.c */
BOOL MCIAVI_RegisterClass(void);
BOOL MCIAVI_UnregisterClass(void);
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms);
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms);
DWORD MCIAVI_mciPut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms);
DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms);
DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSA lpParms);
DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms);
#endif /* __WINE_PRIVATE_MCIAVI_H */

View File

@ -85,7 +85,6 @@ static LRESULT WINAPI MCIAVI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
default:
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
return 0;
}
BOOL MCIAVI_UnregisterClass(void)
@ -112,7 +111,7 @@ BOOL MCIAVI_RegisterClass(void)
return FALSE;
}
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms)
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms)
{
static const WCHAR captionW[] = {'W','i','n','e',' ','M','C','I','-','A','V','I',' ','p','l','a','y','e','r',0};
HWND hParent = 0;
@ -264,7 +263,7 @@ DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
/***************************************************************************
* MCIAVI_mciWindow [internal]
*/
DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSA lpParms)
DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms)
{
WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
@ -288,8 +287,8 @@ DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSA lpPar
ShowWindow(wma->hWndPaint, lpParms->nCmdShow);
}
if (dwFlags & MCI_DGV_WINDOW_TEXT) {
TRACE("Setting caption to '%s'\n", lpParms->lpstrText);
SetWindowTextA(wma->hWndPaint, lpParms->lpstrText);
TRACE("Setting caption to %s\n", debugstr_w(lpParms->lpstrText));
SetWindowTextW(wma->hWndPaint, lpParms->lpstrText);
}
LeaveCriticalSection(&wma->cs);

View File

@ -4,6 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mcicda.drv
IMPORTS = winmm user32 kernel32
EXTRALIBS = $(LIBUNICODE)
C_SRCS = \
mcicda.c

View File

@ -37,6 +37,7 @@
#include "ntddstor.h"
#include "ntddcdrm.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(mcicda);
@ -60,7 +61,7 @@ typedef struct {
/**************************************************************************
* MCICDA_drvOpen [internal]
*/
static DWORD MCICDA_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
static DWORD MCICDA_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
{
WINE_MCICDAUDIO* wmcda;
@ -264,14 +265,13 @@ static DWORD MCICDA_Stop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms
/**************************************************************************
* MCICDA_Open [internal]
*/
static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpenParms)
static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenParms)
{
DWORD dwDeviceID;
DWORD ret = MCIERR_HARDWARE;
WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(wDevID);
char root[7];
WCHAR root[7], drive = 0;
int count;
char drive = 0;
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpOpenParms);
@ -297,18 +297,18 @@ static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpenPar
WARN("MCI_OPEN_ELEMENT_ID %8lx ! Abort\n", (DWORD)lpOpenParms->lpstrElementName);
return MCIERR_NO_ELEMENT_ALLOWED;
}
TRACE("MCI_OPEN_ELEMENT element name: %s\n", debugstr_a(lpOpenParms->lpstrElementName));
TRACE("MCI_OPEN_ELEMENT element name: %s\n", debugstr_w(lpOpenParms->lpstrElementName));
if (!isalpha(lpOpenParms->lpstrElementName[0]) || lpOpenParms->lpstrElementName[1] != ':' ||
(lpOpenParms->lpstrElementName[2] && lpOpenParms->lpstrElementName[2] != '\\'))
{
WARN("MCI_OPEN_ELEMENT unsupported format: %s\n", lpOpenParms->lpstrElementName);
WARN("MCI_OPEN_ELEMENT unsupported format: %s\n",
debugstr_w(lpOpenParms->lpstrElementName));
ret = MCIERR_NO_ELEMENT_ALLOWED;
goto the_error;
}
drive = toupper(lpOpenParms->lpstrElementName[0]);
strcpy(root, "A:\\");
root[0] = drive;
if (GetDriveTypeA(root) != DRIVE_CDROM)
root[0] = drive; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
if (GetDriveTypeW(root) != DRIVE_CDROM)
{
ret = MCIERR_INVALID_DEVICE_NAME;
goto the_error;
@ -317,10 +317,10 @@ static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpenPar
else
{
/* drive letter isn't passed... get the dwDeviceID'th cdrom in the system */
strcpy(root, "A:\\");
root[0] = 'A'; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
for (count = 0; root[0] <= 'Z'; root[0]++)
{
if (GetDriveTypeA(root) == DRIVE_CDROM && ++count >= dwDeviceID)
if (GetDriveTypeW(root) == DRIVE_CDROM && ++count >= dwDeviceID)
{
drive = root[0];
break;
@ -337,9 +337,8 @@ static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpenPar
wmcda->dwTimeFormat = MCI_FORMAT_MSF;
/* now, open the handle */
strcpy(root, "\\\\.\\A:");
root[4] = drive;
wmcda->handle = CreateFileA(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
root[0] = root[1] = '\\'; root[2] = '.'; root[3] = '\\'; root[4] = drive; root[5] = ':'; root[6] = '\0';
wmcda->handle = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (wmcda->handle != INVALID_HANDLE_VALUE)
return 0;
@ -462,12 +461,12 @@ static DWORD CDROM_Audio_GetSerial(CDROM_TOC* toc)
/**************************************************************************
* MCICDA_Info [internal]
*/
static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSW lpParms)
{
LPCSTR str = NULL;
LPCWSTR str = NULL;
WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
DWORD ret = 0;
char buffer[16];
WCHAR buffer[16];
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
@ -478,13 +477,15 @@ static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
if (dwFlags & MCI_INFO_PRODUCT) {
str = "Wine's audio CD";
static const WCHAR wszAudioCd[] = {'W','i','n','e','\'','s',' ','a','u','d','i','o',' ','C','D',0};
str = wszAudioCd;
} else if (dwFlags & MCI_INFO_MEDIA_UPC) {
ret = MCIERR_NO_IDENTITY;
} else if (dwFlags & MCI_INFO_MEDIA_IDENTITY) {
DWORD res = 0;
CDROM_TOC toc;
DWORD br;
static const WCHAR wszLu[] = {'%','l','u',0};
if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
@ -492,23 +493,23 @@ static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
}
res = CDROM_Audio_GetSerial(&toc);
sprintf(buffer, "%lu", res);
sprintfW(buffer, wszLu, res);
str = buffer;
} else {
WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND;
}
if (str) {
if (lpParms->dwRetSize <= strlen(str)) {
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
if (lpParms->dwRetSize <= strlenW(str)) {
lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
ret = MCIERR_PARAM_OVERFLOW;
} else {
strcpy(lpParms->lpstrReturn, str);
strcpyW(lpParms->lpstrReturn, str);
}
} else {
*lpParms->lpstrReturn = 0;
}
TRACE("=> %s (%ld)\n", lpParms->lpstrReturn, ret);
TRACE("=> %s (%ld)\n", debugstr_w(lpParms->lpstrReturn), ret);
return ret;
}
@ -992,7 +993,7 @@ LONG CALLBACK MCICDA_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
switch(wMsg) {
case DRV_LOAD: return 1;
case DRV_FREE: return 1;
case DRV_OPEN: return MCICDA_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
case DRV_OPEN: return MCICDA_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
case DRV_CLOSE: return MCICDA_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
@ -1005,10 +1006,10 @@ LONG CALLBACK MCICDA_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
switch (wMsg) {
case MCI_OPEN_DRIVER: return MCICDA_Open(dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)dwParam2);
case MCI_OPEN_DRIVER: return MCICDA_Open(dwDevID, dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
case MCI_CLOSE_DRIVER: return MCICDA_Close(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
case MCI_GETDEVCAPS: return MCICDA_GetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
case MCI_INFO: return MCICDA_Info(dwDevID, dwParam1, (LPMCI_INFO_PARMSA)dwParam2);
case MCI_INFO: return MCICDA_Info(dwDevID, dwParam1, (LPMCI_INFO_PARMSW)dwParam2);
case MCI_STATUS: return MCICDA_Status(dwDevID, dwParam1, (LPMCI_STATUS_PARMS)dwParam2);
case MCI_SET: return MCICDA_Set(dwDevID, dwParam1, (LPMCI_SET_PARMS)dwParam2);
case MCI_PLAY: return MCICDA_Play(dwDevID, dwParam1, (LPMCI_PLAY_PARMS)dwParam2);

View File

@ -48,6 +48,7 @@
#include "wownt32.h"
#include "mmddk.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(mcimidi);
@ -74,9 +75,9 @@ typedef struct tagWINE_MCIMIDI {
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
HANDLE hCallback; /* Callback handle for pending notification */
HMMIO hFile; /* mmio file handle open as Element */
LPSTR lpstrElementName; /* Name of file (if any) */
LPSTR lpstrCopyright;
LPSTR lpstrName;
LPWSTR lpstrElementName; /* Name of file (if any) */
LPWSTR lpstrCopyright;
LPWSTR lpstrName;
WORD dwStatus; /* one from MCI_MODE_xxxx */
DWORD dwMciTimeFormat; /* One of the supported MCI_FORMAT_xxxx */
WORD wFormat; /* Format of MIDI hFile (0, 1 or 2) */
@ -171,7 +172,7 @@ static DWORD MIDI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
/**************************************************************************
* MIDI_drvOpen [internal]
*/
static DWORD MIDI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
static DWORD MIDI_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
{
WINE_MCIMIDI* wmm;
@ -416,18 +417,20 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
switch (HIBYTE(LOWORD(mmt->dwEventData))) {
case 0x02:
if (wmm->lpstrCopyright) {
WARN("Two copyright notices (%s|%s)\n", wmm->lpstrCopyright, buf);
WARN("Two copyright notices (%s|%s)\n", debugstr_w(wmm->lpstrCopyright), buf);
} else {
wmm->lpstrCopyright = HeapAlloc( GetProcessHeap(), 0, strlen(buf)+1 );
strcpy( wmm->lpstrCopyright, buf );
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
wmm->lpstrCopyright = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, wmm->lpstrCopyright, len );
}
break;
case 0x03:
if (wmm->lpstrName) {
WARN("Two names (%s|%s)\n", wmm->lpstrName, buf);
WARN("Two names (%s|%s)\n", debugstr_w(wmm->lpstrName), buf);
} else {
wmm->lpstrName = HeapAlloc( GetProcessHeap(), 0, strlen(buf)+1 );
strcpy( wmm->lpstrName, buf );
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
wmm->lpstrName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, wmm->lpstrName, len );
}
break;
}
@ -712,7 +715,7 @@ static DWORD MIDI_GetMThdLengthMS(WINE_MCIMIDI* wmm)
/**************************************************************************
* MIDI_mciOpen [internal]
*/
static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParms)
static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpParms)
{
DWORD dwRet = 0;
DWORD dwDeviceID;
@ -742,17 +745,18 @@ static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParms)
/* lpParms->wDeviceID = wDevID;*/
if (dwFlags & MCI_OPEN_ELEMENT) {
TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpParms->lpstrElementName);
if (lpParms->lpstrElementName && strlen(lpParms->lpstrElementName) > 0) {
wmm->hFile = mmioOpenA(lpParms->lpstrElementName, NULL,
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpParms->lpstrElementName));
if (lpParms->lpstrElementName && strlenW(lpParms->lpstrElementName) > 0) {
wmm->hFile = mmioOpenW(lpParms->lpstrElementName, NULL,
MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
if (wmm->hFile == 0) {
WARN("Can't find file '%s' !\n", lpParms->lpstrElementName);
WARN("Can't find file %s!\n", debugstr_w(lpParms->lpstrElementName));
wmm->nUseCount--;
return MCIERR_FILE_NOT_FOUND;
}
wmm->lpstrElementName = HeapAlloc(GetProcessHeap(), 0, strlen(lpParms->lpstrElementName) + 1);
strcpy(wmm->lpstrElementName, lpParms->lpstrElementName);
wmm->lpstrElementName = HeapAlloc(GetProcessHeap(), 0,
(strlenW(lpParms->lpstrElementName) + 1) * sizeof(WCHAR));
strcpyW(wmm->lpstrElementName, lpParms->lpstrElementName);
}
}
TRACE("hFile=%p\n", wmm->hFile);
@ -868,7 +872,7 @@ static DWORD MIDI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPar
TRACE("hFile closed !\n");
}
HeapFree(GetProcessHeap(), 0, wmm->tracks);
HeapFree(GetProcessHeap(), 0, (LPSTR)wmm->lpstrElementName);
HeapFree(GetProcessHeap(), 0, (LPWSTR)wmm->lpstrElementName);
HeapFree(GetProcessHeap(), 0, (LPSTR)wmm->lpstrCopyright);
HeapFree(GetProcessHeap(), 0, (LPSTR)wmm->lpstrName);
} else {
@ -925,7 +929,7 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
if (wmm->hFile == 0) {
WARN("Can't play: no file '%s' !\n", debugstr_a(wmm->lpstrElementName));
WARN("Can't play: no file %s!\n", debugstr_w(wmm->lpstrElementName));
return MCIERR_FILE_NOT_FOUND;
}
@ -1141,7 +1145,7 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
if (sf >= 0x80) TRACE("%d flats\n", -(char)sf);
else if (sf > 0) TRACE("%d sharps\n", (char)sf);
else TRACE("Key of C\n");
TRACE("Mode: %s\n", (mm = 0) ? "major" : "minor");
TRACE("Mode: %s\n", (mm == 0) ? "major" : "minor");
}
break;
default:
@ -1203,7 +1207,7 @@ static DWORD MIDI_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpPar
if (wmm == 0) return MCIERR_INVALID_DEVICE_ID;
if (wmm->hFile == 0) {
WARN("Can't find file='%s' !\n", debugstr_a(wmm->lpstrElementName));
WARN("Can't find file=%s!\n", debugstr_w(wmm->lpstrElementName));
return MCIERR_FILE_NOT_FOUND;
}
start = 1; end = 99999;
@ -1356,12 +1360,13 @@ static DWORD MIDI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
return MCIERR_BAD_INTEGER;
}
if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
TRACE("MCI_SET_AUDIO_ALL !\n");
if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
TRACE("MCI_SET_AUDIO_LEFT !\n");
if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
TRACE("MCI_SET_AUDIO_RIGHT !\n");
switch (lpParms->dwAudio)
{
case MCI_SET_AUDIO_ALL: TRACE("MCI_SET_AUDIO_ALL !\n"); break;
case MCI_SET_AUDIO_LEFT: TRACE("MCI_SET_AUDIO_LEFT !\n"); break;
case MCI_SET_AUDIO_RIGHT: TRACE("MCI_SET_AUDIO_RIGHT !\n"); break;
default: WARN("Unknown audio channel %lu\n", lpParms->dwAudio); break;
}
}
if (dwFlags & MCI_SEQ_SET_MASTER)
@ -1568,11 +1573,12 @@ static DWORD MIDI_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
/**************************************************************************
* MIDI_mciInfo [internal]
*/
static DWORD MIDI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
static DWORD MIDI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSW lpParms)
{
LPCSTR str = 0;
LPCWSTR str = 0;
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
DWORD ret = 0;
static const WCHAR wszMidiSeq[] = {'W','i','n','e','\'','s',' ','M','I','D','I',' ','s','e','q','u','e','n','c','e','r',0};
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
@ -1583,28 +1589,20 @@ static DWORD MIDI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch (dwFlags & ~(MCI_WAIT|MCI_NOTIFY)) {
case MCI_INFO_PRODUCT:
str = "Wine's MIDI sequencer";
break;
case MCI_INFO_FILE:
str = wmm->lpstrElementName;
break;
case MCI_INFO_COPYRIGHT:
str = wmm->lpstrCopyright;
break;
case MCI_INFO_NAME:
str = wmm->lpstrName;
break;
case MCI_INFO_PRODUCT: str = wszMidiSeq; break;
case MCI_INFO_FILE: str = wmm->lpstrElementName; break;
case MCI_INFO_COPYRIGHT: str = wmm->lpstrCopyright; break;
case MCI_INFO_NAME: str = wmm->lpstrName; break;
default:
WARN("Don't know this info command (%lu)\n", dwFlags);
return MCIERR_UNRECOGNIZED_COMMAND;
}
if (str) {
if (lpParms->dwRetSize <= strlen(str)) {
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
if (lpParms->dwRetSize <= strlenW(str)) {
lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
ret = MCIERR_PARAM_OVERFLOW;
} else {
strcpy(lpParms->lpstrReturn, str);
strcpyW(lpParms->lpstrReturn, str);
}
} else {
*lpParms->lpstrReturn = 0;
@ -1670,14 +1668,14 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_CONFIGURE: MessageBoxA(0, "Sample Midi Driver !", "OSS Driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: return DRVCNF_RESTART;
case DRV_OPEN: return MIDI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
case DRV_OPEN: return MIDI_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
case DRV_CLOSE: return MIDI_drvClose(dwDevID);
}
if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
switch (wMsg) {
case MCI_OPEN_DRIVER: return MIDI_mciOpen (dwDevID, dwParam1, (LPMCI_OPEN_PARMSA) dwParam2);
case MCI_OPEN_DRIVER: return MIDI_mciOpen (dwDevID, dwParam1, (LPMCI_OPEN_PARMSW) dwParam2);
case MCI_CLOSE_DRIVER: return MIDI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_PLAY: return MIDI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
case MCI_RECORD: return MIDI_mciRecord (dwDevID, dwParam1, (LPMCI_RECORD_PARMS) dwParam2);
@ -1687,7 +1685,7 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_RESUME: return MIDI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_STATUS: return MIDI_mciStatus (dwDevID, dwParam1, (LPMCI_STATUS_PARMS) dwParam2);
case MCI_GETDEVCAPS: return MIDI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
case MCI_INFO: return MIDI_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMSA) dwParam2);
case MCI_INFO: return MIDI_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMSW) dwParam2);
case MCI_SEEK: return MIDI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
/* commands that should be supported */
case MCI_LOAD:

View File

@ -32,6 +32,7 @@
#include "wownt32.h"
#include "digitalv.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(mciwave);
@ -41,7 +42,7 @@ typedef struct {
int nUseCount; /* Incremented for each shared open */
BOOL fShareable; /* TRUE if first open was shareable */
HMMIO hFile; /* mmio file handle open as Element */
MCI_WAVE_OPEN_PARMSA openParms;
MCI_WAVE_OPEN_PARMSW openParms;
WAVEFORMATEX wfxRef;
LPWAVEFORMATEX lpWaveFormat;
BOOL fInput; /* FALSE = Output, TRUE = Input */
@ -134,7 +135,7 @@ static DWORD WAVE_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
/**************************************************************************
* MCIWAVE_drvOpen [internal]
*/
static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
static DWORD WAVE_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
{
WINE_MCIWAVE* wmw;
@ -344,11 +345,11 @@ err:
/**************************************************************************
* WAVE_mciOpen [internal]
*/
static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA lpOpenParms)
static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSW lpOpenParms)
{
DWORD dwRet = 0;
WINE_MCIWAVE* wmw = (WINE_MCIWAVE*)mciGetDriverData(wDevID);
CHAR* pszTmpFileName = 0;
WCHAR* pszTmpFileName = 0;
TRACE("(%04X, %08lX, %p)\n", wDevID, dwFlags, lpOpenParms);
if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
@ -379,18 +380,18 @@ static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA lpO
*/
dwRet = MCIERR_UNRECOGNIZED_COMMAND;
} else {
if (strlen(lpOpenParms->lpstrElementName) > 0) {
if (strlenW(lpOpenParms->lpstrElementName) > 0) {
lpOpenParms->lpstrElementName = lpOpenParms->lpstrElementName;
/* FIXME : what should be done id wmw->hFile is already != 0, or the driver is playin' */
TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpOpenParms->lpstrElementName);
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
if (lpOpenParms->lpstrElementName && (strlen(lpOpenParms->lpstrElementName) > 0)) {
wmw->hFile = mmioOpenA((LPSTR)lpOpenParms->lpstrElementName, NULL,
if (lpOpenParms->lpstrElementName && (strlenW(lpOpenParms->lpstrElementName) > 0)) {
wmw->hFile = mmioOpenW((LPWSTR)lpOpenParms->lpstrElementName, NULL,
MMIO_ALLOCBUF | MMIO_DENYWRITE | MMIO_READWRITE);
if (wmw->hFile == 0) {
WARN("can't find file='%s' !\n", lpOpenParms->lpstrElementName);
WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName));
dwRet = MCIERR_FILE_NOT_FOUND;
}
else
@ -423,20 +424,24 @@ static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA lpO
}
}
else {
CHAR szTmpPath[MAX_PATH];
CHAR szPrefix[4] = "TMP\0";
WCHAR szTmpPath[MAX_PATH];
WCHAR szPrefix[4];
szPrefix[0] = 'T';
szPrefix[1] = 'M';
szPrefix[2] = 'P';
szPrefix[3] = '\0';
pszTmpFileName = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
MAX_PATH * sizeof(*pszTmpFileName));
if (!GetTempPathA(sizeof(szTmpPath), szTmpPath)) {
if (!GetTempPathW(sizeof(szTmpPath), szTmpPath)) {
WARN("can't retrieve temp path!\n");
HeapFree(GetProcessHeap(), 0, pszTmpFileName);
return MCIERR_FILE_NOT_FOUND;
}
if (!GetTempFileNameA(szTmpPath, szPrefix, 0, pszTmpFileName)) {
if (!GetTempFileNameW(szTmpPath, szPrefix, 0, pszTmpFileName)) {
WARN("can't retrieve temp file name!\n");
HeapFree(GetProcessHeap(), 0, pszTmpFileName);
return MCIERR_FILE_NOT_FOUND;
@ -444,17 +449,17 @@ static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA lpO
wmw->bTemporaryFile = TRUE;
TRACE("MCI_OPEN_ELEMENT '%s' !\n", pszTmpFileName);
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(pszTmpFileName));
if (pszTmpFileName && (strlen(pszTmpFileName) > 0)) {
if (pszTmpFileName && (strlenW(pszTmpFileName) > 0)) {
wmw->hFile = mmioOpenA(pszTmpFileName, NULL,
wmw->hFile = mmioOpenW(pszTmpFileName, NULL,
MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_CREATE);
if (wmw->hFile == 0) {
WARN("can't create file=%s!\n", debugstr_w(pszTmpFileName));
/* temporary file could not be created. clean filename. */
HeapFree(GetProcessHeap(), 0, pszTmpFileName);
WARN("can't create file='%s' !\n", pszTmpFileName);
dwRet = MCIERR_FILE_NOT_FOUND;
}
}
@ -617,7 +622,7 @@ static DWORD WAVE_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPar
*/
if (wmw->bTemporaryFile)
{
HeapFree(GetProcessHeap(), 0, (char*)wmw->openParms.lpstrElementName);
HeapFree(GetProcessHeap(), 0, (WCHAR*)wmw->openParms.lpstrElementName);
wmw->openParms.lpstrElementName = NULL;
}
@ -702,7 +707,7 @@ static DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
}
if (wmw->hFile == 0) {
WARN("Can't play: no file='%s' !\n", wmw->openParms.lpstrElementName);
WARN("Can't play: no file=%s!\n", debugstr_w(wmw->openParms.lpstrElementName));
return MCIERR_FILE_NOT_FOUND;
}
@ -1230,12 +1235,13 @@ static DWORD WAVE_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
return MCIERR_BAD_INTEGER;
}
if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
TRACE("MCI_SET_AUDIO_ALL !\n");
if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
TRACE("MCI_SET_AUDIO_LEFT !\n");
if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
TRACE("MCI_SET_AUDIO_RIGHT !\n");
switch (lpParms->dwAudio)
{
case MCI_SET_AUDIO_ALL: TRACE("MCI_SET_AUDIO_ALL !\n"); break;
case MCI_SET_AUDIO_LEFT: TRACE("MCI_SET_AUDIO_LEFT !\n"); break;
case MCI_SET_AUDIO_RIGHT: TRACE("MCI_SET_AUDIO_RIGHT !\n"); break;
default: WARN("Unknown audio channel %lu\n", lpParms->dwAudio); break;
}
}
if (dwFlags & MCI_WAVE_INPUT)
TRACE("MCI_WAVE_INPUT !\n");
@ -1275,7 +1281,7 @@ static DWORD WAVE_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
/**************************************************************************
* WAVE_mciSave [internal]
*/
static DWORD WAVE_mciSave(UINT wDevID, DWORD dwFlags, LPMCI_SAVE_PARMS lpParms)
static DWORD WAVE_mciSave(UINT wDevID, DWORD dwFlags, LPMCI_SAVE_PARMSW lpParms)
{
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
DWORD ret = MCIERR_FILE_NOT_SAVED, tmpRet;
@ -1306,10 +1312,10 @@ static DWORD WAVE_mciSave(UINT wDevID, DWORD dwFlags, LPMCI_SAVE_PARMS lpParms)
careful not to lose our previous error code.
*/
tmpRet = GetLastError();
DeleteFileA (lpParms->lpfilename);
DeleteFileW (lpParms->lpfilename);
SetLastError(tmpRet);
if (0 == mmioRenameA(wmw->openParms.lpstrElementName, lpParms->lpfilename, 0, 0 )) {
if (0 == mmioRenameW(wmw->openParms.lpstrElementName, lpParms->lpfilename, 0, 0 )) {
ret = ERROR_SUCCESS;
}
@ -1541,10 +1547,10 @@ static DWORD WAVE_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
/**************************************************************************
* WAVE_mciInfo [internal]
*/
static DWORD WAVE_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
static DWORD WAVE_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSW lpParms)
{
DWORD ret = 0;
LPCSTR str = 0;
LPCWSTR str = 0;
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
@ -1554,31 +1560,27 @@ static DWORD WAVE_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
} else if (wmw == NULL) {
ret = MCIERR_INVALID_DEVICE_ID;
} else {
static const WCHAR wszAudio [] = {'W','i','n','e','\'','s',' ','a','u','d','i','o',' ','p','l','a','y','e','r',0};
static const WCHAR wszWaveIn [] = {'W','i','n','e',' ','W','a','v','e',' ','I','n',0};
static const WCHAR wszWaveOut[] = {'W','i','n','e',' ','W','a','v','e',' ','O','u','t',0};
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch (dwFlags & ~(MCI_WAIT|MCI_NOTIFY)) {
case MCI_INFO_PRODUCT:
str = "Wine's audio player";
break;
case MCI_INFO_FILE:
str = wmw->openParms.lpstrElementName;
break;
case MCI_WAVE_INPUT:
str = "Wine Wave In";
break;
case MCI_WAVE_OUTPUT:
str = "Wine Wave Out";
break;
case MCI_INFO_PRODUCT: str = wszAudio; break;
case MCI_INFO_FILE: str = wmw->openParms.lpstrElementName; break;
case MCI_WAVE_INPUT: str = wszWaveIn; break;
case MCI_WAVE_OUTPUT: str = wszWaveOut; break;
default:
WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND;
}
}
if (str) {
if (strlen(str) + 1 > lpParms->dwRetSize) {
if (strlenW(str) + 1 > lpParms->dwRetSize) {
ret = MCIERR_PARAM_OVERFLOW;
} else {
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize);
lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize);
}
} else {
lpParms->lpstrReturn[0] = 0;
@ -1599,7 +1601,7 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
switch (wMsg) {
case DRV_LOAD: return 1;
case DRV_FREE: return 1;
case DRV_OPEN: return WAVE_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
case DRV_OPEN: return WAVE_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
case DRV_CLOSE: return WAVE_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
@ -1612,7 +1614,7 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
switch (wMsg) {
case MCI_OPEN_DRIVER: return WAVE_mciOpen (dwDevID, dwParam1, (LPMCI_WAVE_OPEN_PARMSA) dwParam2);
case MCI_OPEN_DRIVER: return WAVE_mciOpen (dwDevID, dwParam1, (LPMCI_WAVE_OPEN_PARMSW) dwParam2);
case MCI_CLOSE_DRIVER: return WAVE_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_CUE: return WAVE_mciCue (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_PLAY: return WAVE_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
@ -1623,9 +1625,9 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_RESUME: return WAVE_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_STATUS: return WAVE_mciStatus (dwDevID, dwParam1, (LPMCI_STATUS_PARMS) dwParam2);
case MCI_GETDEVCAPS: return WAVE_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
case MCI_INFO: return WAVE_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMSA) dwParam2);
case MCI_INFO: return WAVE_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMSW) dwParam2);
case MCI_SEEK: return WAVE_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
case MCI_SAVE: return WAVE_mciSave (dwDevID, dwParam1, (LPMCI_SAVE_PARMS) dwParam2);
case MCI_SAVE: return WAVE_mciSave (dwDevID, dwParam1, (LPMCI_SAVE_PARMSW) dwParam2);
/* commands that should be supported */
case MCI_LOAD:
case MCI_FREEZE:

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:
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;
}
@ -2614,13 +2622,43 @@ UINT16 WINAPI mciLoadCommandResource16(HINSTANCE16 hInst, LPCSTR resname, UINT16
{
HRSRC16 res;
HGLOBAL16 handle;
void *ptr;
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;
@ -223,8 +223,8 @@ typedef WINMM_MapType (*MMDRV_MAPFUNC)(UINT wMsg, LPDWORD lpdwUser, LPDW
typedef WINMM_MapType (*MMDRV_UNMAPFUNC)(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT ret);
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);
@ -244,15 +244,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);
@ -290,13 +293,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);
@ -775,469 +759,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.@]
*/
@ -1295,49 +816,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;
}
@ -1670,27 +1192,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)
{
@ -2625,48 +2126,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;
}
@ -3036,27 +2539,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

File diff suppressed because it is too large Load Diff

View File

@ -1649,15 +1649,19 @@ MMRESULT WINAPI mmioCreateChunk(HMMIO,MMCKINFO*,UINT);
typedef UINT (CALLBACK *YIELDPROC)(MCIDEVICEID,DWORD);
BOOL WINAPI mciExecute(LPCSTR);
DWORD WINAPI mciSendCommandA(MCIDEVICEID,UINT,DWORD_PTR,DWORD_PTR);
DWORD WINAPI mciSendCommandW(MCIDEVICEID,UINT,DWORD_PTR,DWORD_PTR);
#define mciSendCommand WINELIB_NAME_AW(mciSendCommand)
DWORD WINAPI mciSendStringA(LPCSTR,LPSTR,UINT,HWND);
DWORD WINAPI mciSendStringW(LPCWSTR,LPWSTR,UINT,HWND);
#define mciSendString WINELIB_NAME_AW(mciSendString)
UINT WINAPI mciGetDeviceIDA(LPCSTR);
UINT WINAPI mciGetDeviceIDW(LPCWSTR);
MCIDEVICEID WINAPI mciGetDeviceIDA(LPCSTR);
MCIDEVICEID WINAPI mciGetDeviceIDW(LPCWSTR);
#define mciGetDeviceID WINELIB_NAME_AW(mciGetDeviceID)
MCIDEVICEID WINAPI mciGetDeviceIDFromElementIDA(DWORD,LPCSTR);
MCIDEVICEID WINAPI mciGetDeviceIDFromElementIDW(DWORD,LPCWSTR);
#define mciGetDeviceIDFromElementID WINELIB_NAME_AW(mciGetDeviceIDFromElementID)
BOOL WINAPI mciGetErrorStringA(MCIERROR,LPSTR,UINT);
BOOL WINAPI mciGetErrorStringW(MCIERROR,LPWSTR,UINT);
#define mciGetErrorString WINELIB_NAME_AW(mciGetErrorString)
@ -1978,7 +1982,7 @@ typedef struct tagMCI_INFO_PARMSA {
typedef struct tagMCI_INFO_PARMSW {
DWORD_PTR dwCallback;
LPSTR lpstrReturn;
LPWSTR lpstrReturn;
DWORD dwRetSize;
} MCI_INFO_PARMSW, *LPMCI_INFO_PARMSW;
@ -1991,7 +1995,7 @@ typedef struct tagMCI_GETDEVCAPS_PARMS {
DWORD dwItem;
} MCI_GETDEVCAPS_PARMS, *LPMCI_GETDEVCAPS_PARMS;
typedef struct tagMCI_GETDEVCAPS_PARMSA {
typedef struct tagMCI_SYSINFO_PARMSA {
DWORD_PTR dwCallback;
LPSTR lpstrReturn;
DWORD dwRetSize;
@ -1999,7 +2003,7 @@ typedef struct tagMCI_GETDEVCAPS_PARMSA {
UINT wDeviceType;
} MCI_SYSINFO_PARMSA, *LPMCI_SYSINFO_PARMSA;
typedef struct tagMCI_GETDEVCAPS_PARMSW {
typedef struct tagMCI_SYSINFO_PARMSW {
DWORD_PTR dwCallback;
LPWSTR lpstrReturn;
DWORD dwRetSize;
@ -2023,15 +2027,31 @@ typedef struct tagMCI_BREAK_PARMS {
} MCI_BREAK_PARMS, *LPMCI_BREAK_PARMS;
typedef struct tagMCI_SOUND_PARMS {
typedef struct tagMCI_SOUND_PARMSA {
DWORD_PTR dwCallback;
LPCSTR lpstrSoundName;
} MCI_SOUND_PARMS, *LPMCI_SOUND_PARMS;
} MCI_SOUND_PARMSA, *LPMCI_SOUND_PARMSA;
typedef struct tagMCI_SAVE_PARMS {
typedef struct tagMCI_SOUND_PARMSW {
DWORD_PTR dwCallback;
LPCWSTR lpstrSoundName;
} MCI_SOUND_PARMSW, *LPMCI_SOUND_PARMSW;
DECL_WINELIB_TYPE_AW(MCI_SOUND_PARMS);
DECL_WINELIB_TYPE_AW(LPMCI_SOUND_PARMS);
typedef struct tagMCI_SAVE_PARMSA {
DWORD_PTR dwCallback;
LPCSTR lpfilename;
} MCI_SAVE_PARMS, *LPMCI_SAVE_PARMS;
} MCI_SAVE_PARMSA, *LPMCI_SAVE_PARMSA;
typedef struct tagMCI_SAVE_PARMSW {
DWORD_PTR dwCallback;
LPCWSTR lpfilename;
} MCI_SAVE_PARMSW, *LPMCI_SAVE_PARMSW;
DECL_WINELIB_TYPE_AW(MCI_SAVE_PARMS);
DECL_WINELIB_TYPE_AW(LPMCI_SAVE_PARMS);
typedef struct tagMCI_LOAD_PARMSA {
DWORD_PTR dwCallback;