- renamed winmm.OpenDriverW into winmm.OpenDriver
- replaced all inter-DLL calls (msacm and msvideo) to OpenDriverA with OpenDriver (unicode form) - as a consequence, driver name handling in msacm is now mostly unicode - moved UserYield16 and UnMapLS call out of the 32bit part of winmm
This commit is contained in:
parent
8ac6d20d1b
commit
5061d3a21d
|
@ -292,15 +292,12 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
|
|||
len = strlen("Drivers32") + 1;
|
||||
adod.pszSectionName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, (LPWSTR)adod.pszSectionName, len);
|
||||
len = strlen(padid->pszDriverAlias) + 1;
|
||||
adod.pszAliasName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, padid->pszDriverAlias, -1, (LPWSTR)adod.pszAliasName, len);
|
||||
adod.pszAliasName = padid->pszDriverAlias;
|
||||
adod.dnDevNode = 0;
|
||||
|
||||
pad->hDrvr = OpenDriverA(padid->pszDriverAlias, NULL, (DWORD)&adod);
|
||||
pad->hDrvr = OpenDriver(padid->pszDriverAlias, NULL, (DWORD)&adod);
|
||||
|
||||
HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszSectionName);
|
||||
HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszAliasName);
|
||||
if (!pad->hDrvr)
|
||||
{
|
||||
ret = adod.dwError;
|
||||
|
@ -314,7 +311,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
|
|||
|
||||
/* FIXME: Create a WINE_ACMDRIVER32 */
|
||||
*phad = (HACMDRIVER)pad;
|
||||
TRACE("'%s' => %08lx\n", padid->pszDriverAlias, (DWORD)pad);
|
||||
TRACE("'%s' => %08lx\n", debugstr_w(padid->pszDriverAlias), (DWORD)pad);
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
gotError:
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "msacmdrv.h"
|
||||
#include "wineacm.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
|
||||
|
||||
|
@ -112,7 +113,7 @@ static BOOL MSACM_FillCache(PWINE_ACMDRIVERID padid)
|
|||
for (ntag = 0; ntag < add.cFormatTags; ntag++) {
|
||||
aftd.dwFormatTagIndex = ntag;
|
||||
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)&aftd, ACM_FORMATTAGDETAILSF_INDEX)) {
|
||||
TRACE("IIOs (%s)\n", padid->pszDriverAlias);
|
||||
TRACE("IIOs (%s)\n", debugstr_w(padid->pszDriverAlias));
|
||||
goto errCleanUp;
|
||||
}
|
||||
padid->aFormatTag[ntag].dwFormatTag = aftd.dwFormatTag;
|
||||
|
@ -133,23 +134,25 @@ errCleanUp:
|
|||
/***********************************************************************
|
||||
* MSACM_GetRegistryKey
|
||||
*/
|
||||
static LPSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID* padid)
|
||||
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID* padid)
|
||||
{
|
||||
static const char* baseKey = "Software\\Microsoft\\AudioCompressionManager\\DriverCache\\";
|
||||
LPSTR ret;
|
||||
static const WCHAR baseKey[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
||||
'A','u','d','i','o','C','o','m','p','r','e','s','s','i','o','n','M','a','n','a','g','e','r','\\',
|
||||
'D','r','i','v','e','r','C','a','c','h','e','\\','\0'};
|
||||
LPWSTR ret;
|
||||
int len;
|
||||
|
||||
if (!padid->pszDriverAlias) {
|
||||
ERR("No alias needed for registry entry\n");
|
||||
return NULL;
|
||||
}
|
||||
len = strlen(baseKey);
|
||||
ret = HeapAlloc(MSACM_hHeap, 0, len + strlen(padid->pszDriverAlias) + 1);
|
||||
len = strlenW(baseKey);
|
||||
ret = HeapAlloc(MSACM_hHeap, 0, (len + strlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR));
|
||||
if (!ret) return NULL;
|
||||
|
||||
strcpy(ret, baseKey);
|
||||
strcpy(ret + len, padid->pszDriverAlias);
|
||||
CharLowerA(ret + len);
|
||||
strcpyW(ret, baseKey);
|
||||
strcpyW(ret + len, padid->pszDriverAlias);
|
||||
CharLowerW(ret + len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -158,7 +161,7 @@ static LPSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID* padid)
|
|||
*/
|
||||
static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
|
||||
{
|
||||
LPSTR key = MSACM_GetRegistryKey(padid);
|
||||
LPWSTR key = MSACM_GetRegistryKey(padid);
|
||||
HKEY hKey;
|
||||
DWORD type, size;
|
||||
|
||||
|
@ -166,7 +169,7 @@ static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
|
|||
|
||||
padid->aFormatTag = NULL;
|
||||
|
||||
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, key, &hKey))
|
||||
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
|
||||
goto errCleanUp;
|
||||
|
||||
size = sizeof(padid->cFormatTags);
|
||||
|
@ -202,12 +205,12 @@ static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
|
|||
*/
|
||||
static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid)
|
||||
{
|
||||
LPSTR key = MSACM_GetRegistryKey(padid);
|
||||
LPWSTR key = MSACM_GetRegistryKey(padid);
|
||||
HKEY hKey;
|
||||
|
||||
if (!key) return FALSE;
|
||||
|
||||
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, key, &hKey))
|
||||
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
|
||||
goto errCleanUp;
|
||||
|
||||
if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (void*)&padid->cFormatTags, sizeof(DWORD)))
|
||||
|
@ -231,12 +234,13 @@ static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid)
|
|||
/***********************************************************************
|
||||
* MSACM_RegisterDriver()
|
||||
*/
|
||||
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
||||
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPWSTR pszDriverAlias, LPWSTR pszFileName,
|
||||
HINSTANCE hinstModule)
|
||||
{
|
||||
PWINE_ACMDRIVERID padid;
|
||||
|
||||
TRACE("('%s', '%s', %p)\n", pszDriverAlias, pszFileName, hinstModule);
|
||||
TRACE("(%s, %s, %p)\n",
|
||||
debugstr_w(pszDriverAlias), debugstr_w(pszFileName), hinstModule);
|
||||
|
||||
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
|
||||
padid->obj.dwType = WINE_ACMOBJ_DRIVERID;
|
||||
|
@ -244,14 +248,14 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
|||
padid->pszDriverAlias = NULL;
|
||||
if (pszDriverAlias)
|
||||
{
|
||||
padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, strlen(pszDriverAlias)+1 );
|
||||
strcpy( padid->pszDriverAlias, pszDriverAlias );
|
||||
padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
|
||||
strcpyW( padid->pszDriverAlias, pszDriverAlias );
|
||||
}
|
||||
padid->pszFileName = NULL;
|
||||
if (pszFileName)
|
||||
{
|
||||
padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, strlen(pszFileName)+1 );
|
||||
strcpy( padid->pszFileName, pszFileName );
|
||||
padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) );
|
||||
strcpyW( padid->pszFileName, pszFileName );
|
||||
}
|
||||
padid->hInstModule = hinstModule;
|
||||
|
||||
|
@ -265,7 +269,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
|||
MSACM_pFirstACMDriverID = padid;
|
||||
/* disable the driver if we cannot load the cache */
|
||||
if (!MSACM_ReadCache(padid) && !MSACM_FillCache(padid)) {
|
||||
WARN("Couldn't load cache for ACM driver (%s)\n", pszFileName);
|
||||
WARN("Couldn't load cache for ACM driver (%s)\n", debugstr_w(pszFileName));
|
||||
MSACM_UnregisterDriver(padid);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -277,8 +281,12 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
|||
*/
|
||||
void MSACM_RegisterAllDrivers(void)
|
||||
{
|
||||
LPSTR pszBuffer;
|
||||
LPWSTR pszBuffer;
|
||||
DWORD dwBufferLength;
|
||||
static WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
|
||||
static WCHAR msacmW[] = {'M','S','A','C','M','.'};
|
||||
static WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
|
||||
static WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
|
||||
|
||||
/* FIXME
|
||||
* What if the user edits system.ini while the program is running?
|
||||
|
@ -291,26 +299,32 @@ void MSACM_RegisterAllDrivers(void)
|
|||
dwBufferLength = 1024;
|
||||
/* EPP GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini"); */
|
||||
|
||||
pszBuffer = (LPSTR) HeapAlloc(MSACM_hHeap, 0, dwBufferLength);
|
||||
if (GetPrivateProfileSectionA("drivers32", pszBuffer, dwBufferLength, "system.ini")) {
|
||||
char* s = pszBuffer;
|
||||
while (*s) {
|
||||
if (!strncasecmp("MSACM.", s, 6)) {
|
||||
char *s2 = s;
|
||||
pszBuffer = (LPWSTR) HeapAlloc(MSACM_hHeap, 0, dwBufferLength * sizeof(WCHAR));
|
||||
if (GetPrivateProfileSectionW(drv32, pszBuffer, dwBufferLength, sys))
|
||||
{
|
||||
LPWSTR s = pszBuffer, s2;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
CharUpperBuffW(s, 6);
|
||||
if (memcmp(s, msacmW, 6 * sizeof(WCHAR)) == 0)
|
||||
{
|
||||
s2 = s;
|
||||
while (*s2 != '\0' && *s2 != '=') s2++;
|
||||
if (*s2) {
|
||||
if (*s2)
|
||||
{
|
||||
*s2 = '\0';
|
||||
MSACM_RegisterDriver(s, s2 + 1, 0);
|
||||
*s2 = '=';
|
||||
}
|
||||
}
|
||||
s += strlen(s) + 1; /* Either next char or \0 */
|
||||
s += strlenW(s) + 1; /* Either next char or \0 */
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(MSACM_hHeap, 0, pszBuffer);
|
||||
|
||||
MSACM_RegisterDriver("msacm32.dll", "msacm32.dll", 0);
|
||||
MSACM_RegisterDriver(msacm32, msacm32, 0);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -216,7 +216,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
|
|||
was->hAcmDriver = had;
|
||||
|
||||
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
|
||||
TRACE("%s => %08x\n", wadi->pszDriverAlias, ret);
|
||||
TRACE("%s => %08x\n", debugstr_w(wadi->pszDriverAlias), ret);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
if (fdwOpen & ACM_STREAMOPENF_QUERY) {
|
||||
acmDriverClose(had, 0L);
|
||||
|
|
|
@ -317,8 +317,8 @@ typedef struct _WINE_ACMSTREAM
|
|||
typedef struct _WINE_ACMDRIVERID
|
||||
{
|
||||
WINE_ACMOBJ obj;
|
||||
LPSTR pszDriverAlias;
|
||||
LPSTR pszFileName;
|
||||
LPWSTR pszDriverAlias;
|
||||
LPWSTR pszFileName;
|
||||
HINSTANCE hInstModule; /* NULL if global */
|
||||
PWINE_ACMDRIVER pACMDriverList;
|
||||
PWINE_ACMDRIVERID pNextACMDriverID;
|
||||
|
@ -337,7 +337,7 @@ typedef struct _WINE_ACMDRIVERID
|
|||
extern HANDLE MSACM_hHeap;
|
||||
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
|
||||
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
|
||||
extern PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
|
||||
extern PWINE_ACMDRIVERID MSACM_RegisterDriver(LPWSTR pszDriverAlias, LPWSTR pszFileName,
|
||||
HINSTANCE hinstModule);
|
||||
extern void MSACM_RegisterAllDrivers(void);
|
||||
extern PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
|
||||
|
|
|
@ -48,12 +48,13 @@ LRESULT (CALLBACK *pFnCallTo16)(HDRVR, HIC, UINT, LPARAM, LPARAM) = NULL;
|
|||
static WINE_HIC* MSVIDEO_FirstHic /* = NULL */;
|
||||
|
||||
typedef struct _reg_driver reg_driver;
|
||||
struct _reg_driver{
|
||||
DWORD fccType;
|
||||
DWORD fccHandler;
|
||||
DRIVERPROC proc;
|
||||
char* name;
|
||||
reg_driver* next;
|
||||
struct _reg_driver
|
||||
{
|
||||
DWORD fccType;
|
||||
DWORD fccHandler;
|
||||
DRIVERPROC proc;
|
||||
LPWSTR name;
|
||||
reg_driver* next;
|
||||
};
|
||||
|
||||
static reg_driver* reg_driver_list = NULL;
|
||||
|
@ -164,34 +165,37 @@ static DWORD IC_HandleRef = 1;
|
|||
BOOL VFWAPI ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags)
|
||||
{
|
||||
reg_driver* driver;
|
||||
unsigned len;
|
||||
|
||||
TRACE("(%s,%s,%p,%p,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), (void*)lParam, szDesc, wFlags);
|
||||
|
||||
/* Check if a driver is already registered */
|
||||
driver = reg_driver_list;
|
||||
while(driver)
|
||||
for (driver = reg_driver_list; driver; driver = driver->next)
|
||||
{
|
||||
if (!compare_fourcc(fccType, driver->fccType) &&
|
||||
!compare_fourcc(fccHandler, driver->fccHandler))
|
||||
break;
|
||||
else
|
||||
driver = driver->next;
|
||||
if (driver)
|
||||
return FALSE;
|
||||
}
|
||||
if (driver) return FALSE;
|
||||
|
||||
/* Register the driver */
|
||||
driver = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(reg_driver));
|
||||
if (!driver) goto oom;
|
||||
driver->fccType = fccType;
|
||||
driver->fccHandler = fccHandler;
|
||||
|
||||
switch(wFlags) {
|
||||
switch(wFlags)
|
||||
{
|
||||
case ICINSTALL_FUNCTION:
|
||||
driver->proc = (DRIVERPROC)lParam;
|
||||
driver->name = NULL;
|
||||
break;
|
||||
case ICINSTALL_DRIVER:
|
||||
driver->proc = NULL;
|
||||
driver->name = HeapAlloc(GetProcessHeap(), 0, strlen((char*)lParam));
|
||||
strcpy(driver->name, (char*) lParam);
|
||||
len = MultiByteToWideChar(CP_ACP, 0, (char*)lParam, -1, NULL, 0);
|
||||
driver->name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (!driver->name) goto oom;
|
||||
MultiByteToWideChar(CP_ACP, 0, (char*)lParam, -1, driver->name, len);
|
||||
break;
|
||||
default:
|
||||
ERR("Invalid flags!\n");
|
||||
|
@ -204,6 +208,9 @@ BOOL VFWAPI ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDe
|
|||
reg_driver_list = driver;
|
||||
|
||||
return TRUE;
|
||||
oom:
|
||||
if (driver) HeapFree(GetProcessHeap(), 0, driver);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -211,30 +218,25 @@ BOOL VFWAPI ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDe
|
|||
*/
|
||||
BOOL VFWAPI ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags)
|
||||
{
|
||||
reg_driver* driver;
|
||||
reg_driver** previous;
|
||||
reg_driver** pdriver;
|
||||
|
||||
TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wFlags);
|
||||
|
||||
/* Check if a driver is already registered */
|
||||
driver = reg_driver_list;
|
||||
previous = ®_driver_list;
|
||||
while(driver)
|
||||
if (!compare_fourcc(fccType, driver->fccType) &&
|
||||
!compare_fourcc(fccHandler, driver->fccHandler))
|
||||
for (pdriver = ®_driver_list; *pdriver; pdriver = &(*pdriver)->next)
|
||||
{
|
||||
if (!compare_fourcc(fccType, (*pdriver)->fccType) &&
|
||||
!compare_fourcc(fccHandler, (*pdriver)->fccHandler))
|
||||
break;
|
||||
else {
|
||||
previous = &(driver->next);
|
||||
driver = driver->next;
|
||||
}
|
||||
if (!driver)
|
||||
}
|
||||
if (!*pdriver)
|
||||
return FALSE;
|
||||
|
||||
/* Remove the driver from the list */
|
||||
*previous = driver->next;
|
||||
if (driver->name)
|
||||
HeapFree(GetProcessHeap(), 0, driver->name);
|
||||
HeapFree(GetProcessHeap(), 0, driver);
|
||||
*pdriver = (*pdriver)->next;
|
||||
if ((*pdriver)->name)
|
||||
HeapFree(GetProcessHeap(), 0, (*pdriver)->name);
|
||||
HeapFree(GetProcessHeap(), 0, *pdriver);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -246,11 +248,12 @@ BOOL VFWAPI ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags)
|
|||
*/
|
||||
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
|
||||
{
|
||||
char codecname[10];
|
||||
WCHAR codecname[10];
|
||||
ICOPEN icopen;
|
||||
HDRVR hdrv;
|
||||
WINE_HIC* whic;
|
||||
BOOL bIs16;
|
||||
static WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'};
|
||||
reg_driver* driver;
|
||||
|
||||
TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode);
|
||||
|
@ -294,7 +297,7 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
|
|||
codecname[8] = HIBYTE(HIWORD(fccHandler));
|
||||
codecname[9] = '\0';
|
||||
|
||||
hdrv = OpenDriverA(codecname, "drivers32", (LPARAM)&icopen);
|
||||
hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
|
||||
if (!hdrv)
|
||||
{
|
||||
if (fccType == streamtypeVIDEO)
|
||||
|
@ -305,14 +308,14 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
|
|||
codecname[3] = 'c';
|
||||
|
||||
fccType = ICTYPE_VIDEO;
|
||||
hdrv = OpenDriverA(codecname, "drivers32", (LPARAM)&icopen);
|
||||
hdrv = OpenDriver(codecname, drv32W, (LPARAM)&icopen);
|
||||
}
|
||||
if (!hdrv)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
/* The driver has been registered at runtime with its name */
|
||||
hdrv = OpenDriverA(driver->name, NULL, (LPARAM)&icopen);
|
||||
hdrv = OpenDriver(driver->name, NULL, (LPARAM)&icopen);
|
||||
if (!hdrv)
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ LPMMIOPROC MMIO_InstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
|
|||
struct IOProcList* pListNode;
|
||||
struct IOProcList** ppListNode;
|
||||
|
||||
TRACE("(%ld, %p, %08lX, %i)\n", fccIOProc, pIOProc, dwFlags, type);
|
||||
TRACE("(%08lx, %p, %08lX, %i)\n", fccIOProc, pIOProc, dwFlags, type);
|
||||
|
||||
if (dwFlags & MMIO_GLOBALPROC)
|
||||
FIXME("Global procedures not implemented\n");
|
||||
|
@ -529,14 +529,16 @@ static LONG MMIO_GrabNextBuffer(LPWINE_MMIO wm, int for_read)
|
|||
wm->info.pchEndRead = wm->info.pchBuffer;
|
||||
wm->info.pchEndWrite = wm->info.pchBuffer + wm->info.cchBuffer;
|
||||
|
||||
wm->bBufferLoaded = TRUE;
|
||||
if (for_read) {
|
||||
size = send_message(wm->ioProc, &wm->info, MMIOM_READ,
|
||||
(LPARAM)wm->info.pchBuffer, size, MMIO_PROC_32A);
|
||||
if (size > 0)
|
||||
wm->info.pchEndRead += size;
|
||||
else
|
||||
wm->bBufferLoaded = FALSE;
|
||||
}
|
||||
|
||||
wm->bBufferLoaded = TRUE;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -562,13 +564,6 @@ static MMRESULT MMIO_SetBuffer(WINE_MMIO* wm, void* pchBuffer, LONG cchBuffer,
|
|||
wm->info.dwFlags &= ~MMIO_ALLOCBUF;
|
||||
}
|
||||
|
||||
/* free segmented ptr mapping, if any */
|
||||
if (wm->info.dwReserved1 != 0L)
|
||||
{
|
||||
UnMapLS(wm->info.dwReserved1);
|
||||
wm->info.dwReserved1 = 0L;
|
||||
}
|
||||
|
||||
if (pchBuffer) {
|
||||
wm->info.pchBuffer = pchBuffer;
|
||||
} else if (cchBuffer) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* MMSYTEM functions
|
||||
*
|
||||
* Copyright 1993 Martin Ayotte
|
||||
* 1998-2002 Eric Pouech
|
||||
* 1998-2003 Eric Pouech
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,10 +26,6 @@
|
|||
* 99/4 added mmTask and mmThread functions support
|
||||
*/
|
||||
|
||||
/* FIXME: I think there are some segmented vs. linear pointer weirdnesses
|
||||
* and long term pointers to 16 bit space in here
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
@ -2690,12 +2686,13 @@ static LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage
|
|||
* MMIO_ResetSegmentedData
|
||||
*
|
||||
*/
|
||||
static LRESULT MMIO_SetSegmentedBuffer(HMMIO hmmio, SEGPTR ptr)
|
||||
static LRESULT MMIO_SetSegmentedBuffer(HMMIO hmmio, SEGPTR ptr, BOOL release)
|
||||
{
|
||||
LPWINE_MMIO wm;
|
||||
|
||||
if ((wm = MMIO_Get(hmmio)) == NULL)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
if (release) UnMapLS(wm->segBuffer16);
|
||||
wm->segBuffer16 = ptr;
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
@ -2727,7 +2724,7 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
|
|||
mmioinfo.adwInfo[3] = lpmmioinfo16->adwInfo[3];
|
||||
|
||||
ret = MMIO_Open(szFileName, &mmioinfo, dwOpenFlags, MMIO_PROC_16);
|
||||
MMIO_SetSegmentedBuffer(mmioinfo.hmmio, (SEGPTR)lpmmioinfo16->pchBuffer);
|
||||
MMIO_SetSegmentedBuffer(mmioinfo.hmmio, (SEGPTR)lpmmioinfo16->pchBuffer, FALSE);
|
||||
|
||||
lpmmioinfo16->wErrorRet = mmioinfo.wErrorRet;
|
||||
lpmmioinfo16->hmmio = HMMIO_16(mmioinfo.hmmio);
|
||||
|
@ -2742,6 +2739,7 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
|
|||
*/
|
||||
MMRESULT16 WINAPI mmioClose16(HMMIO16 hmmio, UINT16 uFlags)
|
||||
{
|
||||
MMIO_SetSegmentedBuffer(HMMIO_32(hmmio), (SEGPTR)NULL, TRUE);
|
||||
return mmioClose(HMMIO_32(hmmio), uFlags);
|
||||
}
|
||||
|
||||
|
@ -2854,7 +2852,9 @@ MMRESULT16 WINAPI mmioSetBuffer16(HMMIO16 hmmio, LPSTR pchBuffer,
|
|||
cchBuffer, uFlags);
|
||||
|
||||
if (ret == MMSYSERR_NOERROR)
|
||||
MMIO_SetSegmentedBuffer(HMMIO_32(hmmio), (DWORD)pchBuffer);
|
||||
MMIO_SetSegmentedBuffer(HMMIO_32(hmmio), (DWORD)pchBuffer, TRUE);
|
||||
else
|
||||
UnMapLS((DWORD)pchBuffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define NONAMELESSSTRUCT
|
||||
#include "mmsystem.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/winuser16.h" /* FIXME: should be removed, only used for UserYield16 */
|
||||
#include "winuser.h"
|
||||
#include "heap.h"
|
||||
#include "winternl.h"
|
||||
#include "winemm.h"
|
||||
|
@ -43,6 +43,21 @@
|
|||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/* ========================================================================
|
||||
* G L O B A L S E T T I N G S
|
||||
* ========================================================================*/
|
||||
|
@ -812,7 +827,7 @@ UINT WINAPI MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data)
|
|||
|
||||
if ((HIWORD(data) != 0 && HWND_16(GetActiveWindow()) != HIWORD(data)) ||
|
||||
(GetAsyncKeyState(LOWORD(data)) & 1) == 0) {
|
||||
UserYield16();
|
||||
MyUserYield();
|
||||
ret = 0;
|
||||
} else {
|
||||
MSG msg;
|
||||
|
@ -906,7 +921,7 @@ UINT WINAPI mciDriverYield(UINT uDeviceID)
|
|||
TRACE("(%04x)\n", uDeviceID);
|
||||
|
||||
if (!(wmd = MCI_GetDriver(uDeviceID)) || !wmd->lpfnYieldProc || !wmd->bIs32) {
|
||||
UserYield16();
|
||||
MyUserYield();
|
||||
} else {
|
||||
ret = wmd->lpfnYieldProc(uDeviceID, wmd->dwYieldData);
|
||||
}
|
||||
|
|
|
@ -220,11 +220,13 @@ typedef struct {
|
|||
|
||||
LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hdrvr,
|
||||
UINT Msg, LPARAM lParam1, LPARAM lParam2);
|
||||
/* this sounds odd, but it's the way it is. OpenDriverA even disapeared
|
||||
* from latest SDK
|
||||
*/
|
||||
HDRVR WINAPI OpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName,
|
||||
LPARAM lParam2);
|
||||
HDRVR WINAPI OpenDriverW(LPCWSTR szDriverName, LPCWSTR szSectionName,
|
||||
LPARAM lParam2);
|
||||
#define OpenDriver WINELIB_NAME_AW(OpenDriver)
|
||||
HDRVR WINAPI OpenDriver(LPCWSTR szDriverName, LPCWSTR szSectionName,
|
||||
LPARAM lParam2);
|
||||
LRESULT WINAPI CloseDriver(HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
|
||||
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
|
||||
LPARAM lParam1, LPARAM lParam2);
|
||||
|
|
Loading…
Reference in New Issue