From 240f09391a18d8c84473b2aeaafa2199113d8a43 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 10 Oct 2002 23:28:22 +0000 Subject: [PATCH] Keep on moving 16 bit code out of winmm. --- dlls/winmm/driver.c | 54 -------------- dlls/winmm/mci.c | 76 ++------------------ dlls/winmm/mmsystem.c | 159 ++++++++++++++++++++++++++++++++++++++++++ dlls/winmm/time.c | 81 +-------------------- dlls/winmm/winemm.h | 2 + 5 files changed, 169 insertions(+), 203 deletions(-) diff --git a/dlls/winmm/driver.c b/dlls/winmm/driver.c index e386812cb22..89a385b207a 100644 --- a/dlls/winmm/driver.c +++ b/dlls/winmm/driver.c @@ -564,48 +564,6 @@ HMODULE WINAPI GetDriverModuleHandle(HDRVR hDrvr) return hModule; } -/************************************************************************** - * DrvOpen [MMSYSTEM.1100] - */ -HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) -{ - return OpenDriver16(lpDriverName, lpSectionName, lParam); -} - -/************************************************************************** - * DrvClose [MMSYSTEM.1101] - */ -LRESULT WINAPI DrvClose16(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2) -{ - return CloseDriver16(hDrv, lParam1, lParam2); -} - -/************************************************************************** - * DrvSendMessage [MMSYSTEM.1102] - */ -LRESULT WINAPI DrvSendMessage16(HDRVR16 hDrv, WORD msg, LPARAM lParam1, - LPARAM lParam2) -{ - return SendDriverMessage16(hDrv, msg, lParam1, lParam2); -} - -/************************************************************************** - * DrvGetModuleHandle [MMSYSTEM.1103] - */ -HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv) -{ - return GetDriverModuleHandle16(hDrv); -} - -/************************************************************************** - * DrvDefDriverProc [MMSYSTEM.1104] - */ -LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg, - DWORD dwParam1, DWORD dwParam2) -{ - return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2); -} - /************************************************************************** * DefDriverProc [WINMM.@] * DrvDefDriverProc [WINMM.@] @@ -626,15 +584,3 @@ LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hDrv, return 0; } } - -/************************************************************************** - * DriverProc [MMSYSTEM.6] - */ -LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg, - DWORD dwParam1, DWORD dwParam2) -{ - TRACE("dwDevID=%08lx hDrv=%04x wMsg=%04x dwParam1=%08lx dwParam2=%08lx\n", - dwDevID, hDrv, wMsg, dwParam1, dwParam2); - - return DrvDefDriverProc16(dwDevID, hDrv, wMsg, dwParam1, dwParam2); -} diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index 4739b18fbb7..1365cda3506 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c @@ -1084,15 +1084,6 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpwstrCommand, LPSTR lpstrRet, return ret; } -/************************************************************************** - * mciSendString [MMSYSTEM.702] - */ -DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet, - UINT16 uRetLen, HWND16 hwndCallback) -{ - return mciSendStringA(lpstrCommand, lpstrRet, uRetLen, HWND_32(hwndCallback)); -} - /************************************************************************** * mciExecute [WINMM.@] * mciExecute [MMSYSTEM.712] @@ -1115,52 +1106,6 @@ DWORD WINAPI mciExecute(LPCSTR lpstrCommand) return 0; } -/************************************************************************** - * mciLoadCommandResource [MMSYSTEM.705] - */ -UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hInst, LPCSTR resname, UINT16 type) -{ - HRSRC hRsrc = 0; - HGLOBAL hMem; - UINT16 ret = MCI_NO_COMMAND_TABLE; - LPWINE_MM_IDATA iData = MULTIMEDIA_GetIData(); - - TRACE("(%04x, %s, %d)!\n", hInst, resname, type); - - /* if file exists "resname.mci", then load resource "resname" from it - * otherwise directly from driver - * We don't support it (who uses this feature ?), but we check anyway - */ - if (!type) { - char buf[128]; - OFSTRUCT ofs; - - strcat(strcpy(buf, resname), ".mci"); - if (OpenFile(buf, &ofs, OF_EXIST) != HFILE_ERROR) { - FIXME("NIY: command table to be loaded from '%s'\n", ofs.szPathName); - } - } - if (!(hRsrc = FindResourceA(hInst, resname, (LPCSTR)RT_RCDATAA))) { - WARN("No command table found in resource\n"); - } else if ((hMem = LoadResource(hInst, hRsrc))) { - ret = MCI_SetCommandTable(iData, hMem, type); - } else { - WARN("Couldn't load resource.\n"); - } - TRACE("=> %04x\n", ret); - return ret; -} - -/************************************************************************** - * mciFreeCommandResource [MMSYSTEM.713] - */ -BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable) -{ - TRACE("(%04x)!\n", uTable); - - return MCI_DeleteCommandTable(uTable); -} - /************************************************************************** * mciLoadCommandResource [WINMM.@] * @@ -1175,12 +1120,15 @@ UINT WINAPI mciLoadCommandResource(HINSTANCE hInst, LPCWSTR resNameW, UINT type) TRACE("(%04x, %s, %d)!\n", hInst, debugstr_w(resNameW), type); -#if 0 - /* if file exists "resname.mci", then load resource "resname" from it + /* if a file named "resname.mci" exits, then load resource "resname" from it * otherwise directly from driver * We don't support it (who uses this feature ?), but we check anyway */ if (!type) { +#if 0 + /* FIXME: we should put this back into order, but I never found a program + * actually using this feature, so we not need it + */ char buf[128]; OFSTRUCT ofs; @@ -1188,8 +1136,8 @@ UINT WINAPI mciLoadCommandResource(HINSTANCE hInst, LPCWSTR resNameW, UINT type) if (OpenFile(buf, &ofs, OF_EXIST) != HFILE_ERROR) { FIXME("NIY: command table to be loaded from '%s'\n", ofs.szPathName); } - } #endif + } if (!(hRsrc = FindResourceW(hInst, resNameW, (LPCWSTR)RT_RCDATAA))) { WARN("No command table found in resource\n"); } else if ((hMem = LoadResource(hInst, hRsrc))) { @@ -1201,18 +1149,6 @@ UINT WINAPI mciLoadCommandResource(HINSTANCE hInst, LPCWSTR resNameW, UINT type) return ret; } -#if 0 - LPSTR resNameA; - UINT ret; - - TRACE("(%04x, %s, %d)!\n", hinst, debugstr_w(resNameW), type); - - resNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, resNameW); - ret = mciLoadCommandResource16(hinst, resNameA, type); - HeapFree(GetProcessHeap(), 0, resNameA); - return ret; -#endif - /************************************************************************** * mciFreeCommandResource [WINMM.@] */ diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c index 34dbea7c342..f85deb89de7 100644 --- a/dlls/winmm/mmsystem.c +++ b/dlls/winmm/mmsystem.c @@ -38,6 +38,7 @@ #include "wine/mmsystem16.h" #include "wine/winuser16.h" #include "winemm.h" +#include "heap.h" #include "wine/debug.h" @@ -2117,3 +2118,161 @@ void WINAPI OutputDebugStr16( { OutputDebugStringA( str ); } + +/************************************************************************** + * DrvOpen [MMSYSTEM.1100] + */ +HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) +{ + return OpenDriver16(lpDriverName, lpSectionName, lParam); +} + +/************************************************************************** + * DrvClose [MMSYSTEM.1101] + */ +LRESULT WINAPI DrvClose16(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2) +{ + return CloseDriver16(hDrv, lParam1, lParam2); +} + +/************************************************************************** + * DrvSendMessage [MMSYSTEM.1102] + */ +LRESULT WINAPI DrvSendMessage16(HDRVR16 hDrv, WORD msg, LPARAM lParam1, + LPARAM lParam2) +{ + return SendDriverMessage16(hDrv, msg, lParam1, lParam2); +} + +/************************************************************************** + * DrvGetModuleHandle [MMSYSTEM.1103] + */ +HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv) +{ + return GetDriverModuleHandle16(hDrv); +} + +/************************************************************************** + * DrvDefDriverProc [MMSYSTEM.1104] + */ +LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg, + DWORD dwParam1, DWORD dwParam2) +{ + return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2); +} + +/************************************************************************** + * DriverProc [MMSYSTEM.6] + */ +LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg, + DWORD dwParam1, DWORD dwParam2) +{ + TRACE("dwDevID=%08lx hDrv=%04x wMsg=%04x dwParam1=%08lx dwParam2=%08lx\n", + dwDevID, hDrv, wMsg, dwParam1, dwParam2); + + return DrvDefDriverProc16(dwDevID, hDrv, wMsg, dwParam1, dwParam2); +} + +/************************************************************************** + * timeGetSystemTime [MMSYSTEM.601] + */ +MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize) +{ + TRACE("(%p, %u);\n", lpTime, wSize); + + if (wSize >= sizeof(*lpTime)) { + lpTime->wType = TIME_MS; + lpTime->u.ms = TIME_MMTimeStart()->mmSysTimeMS; + + TRACE("=> %lu\n", lpTime->u.ms); + } + + return 0; +} + +/************************************************************************** + * timeSetEvent [MMSYSTEM.602] + */ +MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc, + DWORD dwUser, UINT16 wFlags) +{ + if (wFlags & WINE_TIMER_IS32) + WARN("Unknown windows flag... wine internally used.. ooch\n"); + + return timeSetEventInternal(wDelay, wResol, (FARPROC16)lpFunc, + dwUser, wFlags & ~WINE_TIMER_IS32); +} + +/************************************************************************** + * timeKillEvent [MMSYSTEM.603] + */ +MMRESULT16 WINAPI timeKillEvent16(UINT16 wID) +{ + return timeKillEvent(wID); +} + +/************************************************************************** + * timeGetDevCaps [MMSYSTEM.604] + */ +MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize) +{ + TIMECAPS caps; + MMRESULT ret; + + TRACE("(%p, %u) !\n", lpCaps, wSize); + + ret = timeGetDevCaps(&caps, sizeof(caps)); + lpCaps->wPeriodMin = caps.wPeriodMin; + lpCaps->wPeriodMax = caps.wPeriodMax; + return 0; +} + +/************************************************************************** + * timeBeginPeriod [MMSYSTEM.605] + */ +MMRESULT16 WINAPI timeBeginPeriod16(UINT16 wPeriod) +{ + TRACE("(%u) !\n", wPeriod); + + return timeBeginPeriod(wPeriod); +} + +/************************************************************************** + * timeEndPeriod [MMSYSTEM.606] + */ +MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod) +{ + TRACE("(%u) !\n", wPeriod); + + return timeEndPeriod(wPeriod); +} + +/************************************************************************** + * mciSendString [MMSYSTEM.702] + */ +DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet, + UINT16 uRetLen, HWND16 hwndCallback) +{ + return mciSendStringA(lpstrCommand, lpstrRet, uRetLen, HWND_32(hwndCallback)); +} + +/************************************************************************** + * mciLoadCommandResource [MMSYSTEM.705] + */ +UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hInst, LPCSTR resname, UINT16 type) +{ + LPCWSTR ptr = HEAP_strdupAtoW(GetProcessHeap(), 0, resname); + UINT ret = mciLoadCommandResource(hInst, ptr, type); + HeapFree(GetProcessHeap(), 0, (LPWSTR)ptr); + return ret; +} + +/************************************************************************** + * mciFreeCommandResource [MMSYSTEM.713] + */ +BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable) +{ + TRACE("(%04x)!\n", uTable); + + return mciFreeCommandResource(uTable); +} diff --git a/dlls/winmm/time.c b/dlls/winmm/time.c index efe266599d7..9b6e5d0df5f 100644 --- a/dlls/winmm/time.c +++ b/dlls/winmm/time.c @@ -34,10 +34,7 @@ #include "mmsystem.h" #include "windef.h" #include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "wine/mmsystem16.h" #include "winemm.h" #include "wine/debug.h" @@ -236,28 +233,11 @@ MMRESULT WINAPI timeGetSystemTime(LPMMTIME lpTime, UINT wSize) return 0; } -/************************************************************************** - * timeGetSystemTime [MMSYSTEM.601] - */ -MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize) -{ - TRACE("(%p, %u);\n", lpTime, wSize); - - if (wSize >= sizeof(*lpTime)) { - lpTime->wType = TIME_MS; - lpTime->u.ms = TIME_MMTimeStart()->mmSysTimeMS; - - TRACE("=> %lu\n", lpTime->u.ms); - } - - return 0; -} - /************************************************************************** * timeSetEventInternal [internal] */ -static WORD timeSetEventInternal(UINT wDelay, UINT wResol, - FARPROC16 lpFunc, DWORD dwUser, UINT wFlags) +WORD timeSetEventInternal(UINT wDelay, UINT wResol, + FARPROC16 lpFunc, DWORD dwUser, UINT wFlags) { WORD wNewID = 0; LPWINE_TIMERENTRY lpNewTimer; @@ -312,19 +292,6 @@ MMRESULT WINAPI timeSetEvent(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc, dwUser, wFlags|WINE_TIMER_IS32); } -/************************************************************************** - * timeSetEvent [MMSYSTEM.602] - */ -MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc, - DWORD dwUser, UINT16 wFlags) -{ - if (wFlags & WINE_TIMER_IS32) - WARN("Unknown windows flag... wine internally used.. ooch\n"); - - return timeSetEventInternal(wDelay, wResol, (FARPROC16)lpFunc, - dwUser, wFlags & ~WINE_TIMER_IS32); -} - /************************************************************************** * timeKillEvent [WINMM.@] */ @@ -358,14 +325,6 @@ MMRESULT WINAPI timeKillEvent(UINT wID) return ret; } -/************************************************************************** - * timeKillEvent [MMSYSTEM.603] - */ -MMRESULT16 WINAPI timeKillEvent16(UINT16 wID) -{ - return timeKillEvent(wID); -} - /************************************************************************** * timeGetDevCaps [WINMM.@] */ @@ -378,18 +337,6 @@ MMRESULT WINAPI timeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize) return 0; } -/************************************************************************** - * timeGetDevCaps [MMSYSTEM.604] - */ -MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize) -{ - TRACE("(%p, %u) !\n", lpCaps, wSize); - - lpCaps->wPeriodMin = MMSYSTIME_MININTERVAL; - lpCaps->wPeriodMax = MMSYSTIME_MAXINTERVAL; - return 0; -} - /************************************************************************** * timeBeginPeriod [WINMM.@] */ @@ -402,18 +349,6 @@ MMRESULT WINAPI timeBeginPeriod(UINT wPeriod) return 0; } -/************************************************************************** - * timeBeginPeriod [MMSYSTEM.605] - */ -MMRESULT16 WINAPI timeBeginPeriod16(UINT16 wPeriod) -{ - TRACE("(%u) !\n", wPeriod); - - if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL) - return TIMERR_NOCANDO; - return 0; -} - /************************************************************************** * timeEndPeriod [WINMM.@] */ @@ -426,18 +361,6 @@ MMRESULT WINAPI timeEndPeriod(UINT wPeriod) return 0; } -/************************************************************************** - * timeEndPeriod [MMSYSTEM.606] - */ -MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod) -{ - TRACE("(%u) !\n", wPeriod); - - if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL) - return TIMERR_NOCANDO; - return 0; -} - /************************************************************************** * timeGetTime [MMSYSTEM.607] * timeGetTime [WINMM.@] diff --git a/dlls/winmm/winemm.h b/dlls/winmm/winemm.h index af16d237b3f..41392f484f5 100644 --- a/dlls/winmm/winemm.h +++ b/dlls/winmm/winemm.h @@ -230,6 +230,8 @@ MMRESULT MMSYSTEM_MidiStream_Open(HMIDISTRM* lphMidiStrm, UINT MMSYSTEM_waveOpen(HANDLE* lphndl, UINT uDeviceID, UINT uType, const LPWAVEFORMATEX lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags, BOOL bFrom32); +WORD timeSetEventInternal(UINT wDelay, UINT wResol, + FARPROC16 lpFunc, DWORD dwUser, UINT wFlags); BOOL MULTIMEDIA_MciInit(void); LPWINE_MM_IDATA MULTIMEDIA_GetIData(void);