6 modified files
reactos/lib/winmm
diff -u -r1.4 -r1.5
--- driver.c 8 Aug 2004 21:36:20 -0000 1.4
+++ driver.c 20 Oct 2004 17:42:11 -0000 1.5
@@ -468,7 +468,7 @@
* DefDriverProc [WINMM.@]
* DrvDefDriverProc [WINMM.@]
*/
-LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hDrv,
+LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv,
UINT Msg, LPARAM lParam1, LPARAM lParam2)
{
switch (Msg) {
reactos/lib/winmm
diff -u -r1.2 -r1.3
--- mmsystem.c 19 Sep 2004 11:07:39 -0000 1.2
+++ mmsystem.c 20 Oct 2004 17:42:11 -0000 1.3
@@ -308,7 +308,7 @@
{
MIXERLINECONTROLSA mlcA;
DWORD ret;
- int i;
+ unsigned int i;
LPMIXERCONTROL16 lpmc16;
TRACE("(%04x, %p, %08lx)\n", hmix, lpmlc16, fdwControls);
@@ -2524,12 +2524,9 @@
*/
MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize)
{
- TRACE("(%p, %u);\n", lpTime, wSize);
-
if (wSize >= sizeof(*lpTime)) {
lpTime->wType = TIME_MS;
- TIME_MMTimeStart();
- lpTime->u.ms = WINMM_SysTimeMS;
+ lpTime->u.ms = GetTickCount();
TRACE("=> %lu\n", lpTime->u.ms);
}
reactos/lib/winmm
diff -u -r1.4 -r1.5
--- time.c 25 Feb 2004 20:00:42 -0000 1.4
+++ time.c 20 Oct 2004 17:42:11 -0000 1.5
@@ -45,23 +45,44 @@
static HANDLE TIME_hMMTimer;
static LPWINE_TIMERENTRY TIME_TimersList;
static HANDLE TIME_hKillEvent;
-DWORD WINMM_SysTimeMS;
+static HANDLE TIME_hWakeEvent;
+static BOOL TIME_TimeToDie = TRUE;
/*
- * FIXME
- * We're using "1" as the mininum resolution to the timer,
- * as Windows 95 does, according to the docs. Maybe it should
- * depend on the computers resources!
+ * Some observations on the behavior of winmm on Windows.
+ * First, the call to timeBeginPeriod(xx) can never be used
+ * to raise the timer resolution, only lower it.
+ *
+ * Second, a brief survey of a variety of Win 2k and Win X
+ * machines showed that a 'standard' (aka default) timer
+ * resolution was 1 ms (Win9x is documented as being 1). However, one
+ * machine had a standard timer resolution of 10 ms.
+ *
+ * Further, if we set our default resolution to 1,
+ * the implementation of timeGetTime becomes GetTickCount(),
+ * and we can optimize the code to reduce overhead.
+ *
+ * Additionally, a survey of Event behaviors shows that
+ * if we request a Periodic event every 50 ms, then Windows
+ * makes sure to trigger that event 20 times in the next
+ * second. If delays prevent that from happening on exact
+ * schedule, Windows will trigger the events as close
+ * to the original schedule as is possible, and will eventually
+ * bring the event triggers back onto a schedule that is
+ * consistent with what would have happened if there were
+ * no delays.
+ *
+ * Jeremy White, October 2004
*/
#define MMSYSTIME_MININTERVAL (1)
#define MMSYSTIME_MAXINTERVAL (65535)
-#define MMSYSTIME_STDINTERVAL (10) /* reasonable value? */
static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer)
{
- TRACE("before CallBack => lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
- lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
+ TRACE("%04lx:CallBack => lpFunc=%p wTimerID=%04X dwUser=%08lX dwTriggerTime %ld(delta %ld)\n",
+ GetCurrentThreadId(), lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser,
+ lpTimer->dwTriggerTime, GetTickCount() - lpTimer->dwTriggerTime);
/* - TimeProc callback that is called here is something strange, under Windows 3.1x it is called
* during interrupt time, is allowed to execute very limited number of API calls (like
@@ -87,83 +108,116 @@
lpTimer->wFlags, lpTimer->lpFunc);
break;
}
- TRACE("after CallBack !\n");
}
/**************************************************************************
* TIME_MMSysTimeCallback
*/
-static void CALLBACK TIME_MMSysTimeCallback(LPWINE_MM_IDATA iData)
+static DWORD CALLBACK TIME_MMSysTimeCallback(LPWINE_MM_IDATA iData)
{
static int nSizeLpTimers;
static LPWINE_TIMERENTRY lpTimers;
LPWINE_TIMERENTRY timer, *ptimer, *next_ptimer;
- DWORD delta = GetTickCount() - WINMM_SysTimeMS;
int idx;
+ DWORD cur_time;
+ DWORD delta_time;
+ DWORD ret_time = INFINITE;
+ DWORD adjust_time;
+
+
+ /* optimize for the most frequent case - no events */
+ if (! TIME_TimersList)
+ return(ret_time);
+
+ /* since timeSetEvent() and timeKillEvent() can be called
+ * from 16 bit code, there are cases where win16 lock is
+ * locked upon entering timeSetEvent(), and then the mm timer
+ * critical section is locked. This function cannot call the
+ * timer callback with the crit sect locked (because callback
+ * may need to acquire Win16 lock, thus providing a deadlock
+ * situation).
+ * To cope with that, we just copy the WINE_TIMERENTRY struct
+ * that need to trigger the callback, and call it without the
+ * mm timer crit sect locked.
+ * the hKillTimeEvent is used to mark the section where we
+ * handle the callbacks so we can do synchronous kills.
+ * EPP 99/07/13, updated 04/01/10
+ */
+ idx = 0;
+ cur_time = GetTickCount();
- TRACE("Time delta: %ld\n", delta);
-
- while (delta >= MMSYSTIME_MININTERVAL) {
- delta -= MMSYSTIME_MININTERVAL;
- WINMM_SysTimeMS += MMSYSTIME_MININTERVAL;
-
- /* since timeSetEvent() and timeKillEvent() can be called
- * from 16 bit code, there are cases where win16 lock is
- * locked upon entering timeSetEvent(), and then the mm timer
- * critical section is locked. This function cannot call the
- * timer callback with the crit sect locked (because callback
- * may need to acquire Win16 lock, thus providing a deadlock
- * situation).
- * To cope with that, we just copy the WINE_TIMERENTRY struct
- * that need to trigger the callback, and call it without the
- * mm timer crit sect locked.
- * the hKillTimeEvent is used to mark the section where we
- * handle the callbacks so we can do synchronous kills.
- * EPP 99/07/13, updated 04/01/10
- */
- idx = 0;
-
- EnterCriticalSection(&iData->cs);
- for (ptimer = &TIME_TimersList; *ptimer != NULL; ) {
- timer = *ptimer;
- next_ptimer = &timer->lpNext;
- if (timer->uCurTime < MMSYSTIME_MININTERVAL) {
- /* since lpTimer->wDelay is >= MININTERVAL, wCurTime value
- * shall be correct (>= 0)
- */
- timer->uCurTime += timer->wDelay - MMSYSTIME_MININTERVAL;
- if (timer->lpFunc) {
- if (idx == nSizeLpTimers) {
- if (lpTimers)
- lpTimers = (LPWINE_TIMERENTRY)
- HeapReAlloc(GetProcessHeap(), 0, lpTimers,
- ++nSizeLpTimers * sizeof(WINE_TIMERENTRY));
- else
- lpTimers = (LPWINE_TIMERENTRY)
- HeapAlloc(GetProcessHeap(), 0,
- ++nSizeLpTimers * sizeof(WINE_TIMERENTRY));
- }
- lpTimers[idx++] = *timer;
- }
- /* TIME_ONESHOT is defined as 0 */
- if (!(timer->wFlags & TIME_PERIODIC))
- {
- /* unlink timer from timers list */
- *ptimer = *next_ptimer;
- HeapFree(GetProcessHeap(), 0, timer);
+ EnterCriticalSection(&iData->cs);
+ for (ptimer = &TIME_TimersList; *ptimer != NULL; ) {
+ timer = *ptimer;
+ next_ptimer = &timer->lpNext;
+ if (cur_time >= timer->dwTriggerTime)
+ {
+ if (timer->lpFunc) {
+ if (idx == nSizeLpTimers) {
+ if (lpTimers)
+ lpTimers = (LPWINE_TIMERENTRY)
+ HeapReAlloc(GetProcessHeap(), 0, lpTimers,
+ ++nSizeLpTimers * sizeof(WINE_TIMERENTRY));
+ else
+ lpTimers = (LPWINE_TIMERENTRY)
+ HeapAlloc(GetProcessHeap(), 0,
+ ++nSizeLpTimers * sizeof(WINE_TIMERENTRY));
}
- } else {
- timer->uCurTime -= MMSYSTIME_MININTERVAL;
- }
- ptimer = next_ptimer;
- }
- if (TIME_hKillEvent) ResetEvent(TIME_hKillEvent);
- LeaveCriticalSection(&iData->cs);
+ lpTimers[idx++] = *timer;
+
+ }
- while (idx > 0) TIME_TriggerCallBack(&lpTimers[--idx]);
- if (TIME_hKillEvent) SetEvent(TIME_hKillEvent);
+ /* Update the time after we make the copy to preserve
+ the original trigger time */
+ timer->dwTriggerTime += timer->wDelay;
+
+ /* TIME_ONESHOT is defined as 0 */
+ if (!(timer->wFlags & TIME_PERIODIC))
+ {
+ /* unlink timer from timers list */
+ *ptimer = *next_ptimer;
+ HeapFree(GetProcessHeap(), 0, timer);
+
+ /* We don't need to trigger oneshots again */
+ delta_time = INFINITE;
+ }
+ else
+ {
+ /* Compute when this event needs this function
+ to be called again */
+ if (timer->dwTriggerTime <= cur_time)
+ delta_time = 0;
+ else
+ delta_time = timer->dwTriggerTime - cur_time;
+ }
+ }
+ else
+ delta_time = timer->dwTriggerTime - cur_time;
+
+ /* Determine when we need to return to this function */
+ ret_time = min(ret_time, delta_time);
+
+ ptimer = next_ptimer;
}
+ if (TIME_hKillEvent) ResetEvent(TIME_hKillEvent);
+ LeaveCriticalSection(&iData->cs);
+
+ while (idx > 0) TIME_TriggerCallBack(&lpTimers[--idx]);
+ if (TIME_hKillEvent) SetEvent(TIME_hKillEvent);
+
+ /* Finally, adjust the recommended wait time downward
+ by the amount of time the processing routines
+ actually took */
+ adjust_time = GetTickCount() - cur_time;
+ if (adjust_time > ret_time)
+ ret_time = 0;
+ else
+ ret_time -= adjust_time;
+
+ /* We return the amount of time our caller should sleep
+ before needing to check in on us again */
+ return(ret_time);
}
/**************************************************************************
@@ -172,23 +226,43 @@
static DWORD CALLBACK TIME_MMSysTimeThread(LPVOID arg)
{
LPWINE_MM_IDATA iData = (LPWINE_MM_IDATA)arg;
- volatile HANDLE *pActive = (volatile HANDLE *)&TIME_hMMTimer;
- DWORD last_time, cur_time;
+ DWORD sleep_time;
+ DWORD rc;
-#ifndef __REACTOS__
- usleep(MMSYSTIME_STDINTERVAL * 1000);
-#endif /* __REACTOS__ */
-
- last_time = GetTickCount();
- while (*pActive) {
- TIME_MMSysTimeCallback(iData);
- cur_time = GetTickCount();
- while (last_time < cur_time)
- last_time += MMSYSTIME_STDINTERVAL;
-#ifndef __REACTOS__
- usleep((last_time - cur_time) * 1000);
-#endif /* __REACTOS__ */
+ TRACE("Starting main winmm thread\n");
+
+ /* FIXME: As an optimization, we could have
+ this thread die when there are no more requests
+ pending, and then get recreated on the first
+ new event; it's not clear if that would be worth
+ it or not. */
+
+ while (! TIME_TimeToDie)
+ {
+ sleep_time = TIME_MMSysTimeCallback(iData);
+
+ if (sleep_time == 0)
+ {
+ /* This Sleep is controversial; it was added to make
+ Wine able to replicate a high speed (e.g. 1 ms)
+ timer event where the called event routine chews
+ a lot of CPU. This is required because of the
+ bias some Linux kernel versions have against threads that
+ chew a lot of the CPU; this Sleep(0) yields enough
+ in that spin case doesn't trigger the bias.
+ Further, it should do no harm, but an fyi. */
+ Sleep(0);
+ continue;
+ }
+
+ rc = WaitForSingleObject(TIME_hWakeEvent, sleep_time);
+ if (rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0)
+ {
+ FIXME("Unexpected error %ld(%ld) in timer thread\n", rc, GetLastError());
+ break;
+ }
}
+ TRACE("Exiting main winmm thread\n");
return 0;
}
@@ -197,13 +271,10 @@
*/
void TIME_MMTimeStart(void)
{
- /* one could think it's possible to stop the service thread activity when no more
- * mm timers are active, but this would require to keep mmSysTimeMS up-to-date
- * without being incremented within the service thread callback.
- */
if (!TIME_hMMTimer) {
- WINMM_SysTimeMS = GetTickCount();
TIME_TimersList = NULL;
+ TIME_hWakeEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+ TIME_TimeToDie = FALSE;
TIME_hMMTimer = CreateThread(NULL, 0, TIME_MMSysTimeThread, WINMM_IData, 0, NULL);
}
}
@@ -213,12 +284,18 @@
*/
void TIME_MMTimeStop(void)
{
- /* FIXME: in the worst case, we're going to wait 65 seconds here :-( */
if (TIME_hMMTimer) {
- HANDLE hMMTimer = TIME_hMMTimer;
+
+ TIME_TimeToDie = TRUE;
+ SetEvent(TIME_hWakeEvent);
+
+ /* FIXME: in the worst case, we're going to wait 65 seconds here :-( */
+ WaitForSingleObject(TIME_hMMTimer, INFINITE);
+
+ CloseHandle(TIME_hMMTimer);
+ CloseHandle(TIME_hWakeEvent);
TIME_hMMTimer = 0;
- WaitForSingleObject(hMMTimer, INFINITE);
- CloseHandle(hMMTimer);
+ TIME_TimersList = NULL;
}
}
@@ -227,14 +304,11 @@
*/
MMRESULT WINAPI timeGetSystemTime(LPMMTIME lpTime, UINT wSize)
{
- TRACE("(%p, %u);\n", lpTime, wSize);
if (wSize >= sizeof(*lpTime)) {
- TIME_MMTimeStart();
lpTime->wType = TIME_MS;
- lpTime->u.ms = WINMM_SysTimeMS;
+ lpTime->u.ms = GetTickCount();
- TRACE("=> %lu\n", lpTime->u.ms);
}
return 0;
@@ -261,8 +335,11 @@
TIME_MMTimeStart();
- lpNewTimer->uCurTime = wDelay;
lpNewTimer->wDelay = wDelay;
+ lpNewTimer->dwTriggerTime = GetTickCount() + wDelay;
+
+ /* FIXME - wResol is not respected, although it is not clear
+ that we could change our precision meaningfully */
lpNewTimer->wResol = wResol;
lpNewTimer->lpFunc = lpFunc;
lpNewTimer->dwUser = dwUser;
@@ -283,6 +360,9 @@
LeaveCriticalSection(&WINMM_IData->cs);
+ /* Wake the service thread in case there is work to be done */
+ SetEvent(TIME_hWakeEvent);
+
TRACE("=> %u\n", wNewID + 1);
return wNewID + 1;
@@ -337,7 +417,7 @@
*/
MMRESULT WINAPI timeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize)
{
- TRACE("(%p, %u) !\n", lpCaps, wSize);
+ TRACE("(%p, %u)\n", lpCaps, wSize);
lpCaps->wPeriodMin = MMSYSTIME_MININTERVAL;
lpCaps->wPeriodMax = MMSYSTIME_MAXINTERVAL;
@@ -349,10 +429,14 @@
*/
MMRESULT WINAPI timeBeginPeriod(UINT wPeriod)
{
- TRACE("(%u) !\n", wPeriod);
-
if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL)
return TIMERR_NOCANDO;
+
+ if (wPeriod > MMSYSTIME_MININTERVAL)
+ {
+ FIXME("Stub; we set our timer resolution at minimum\n");
+ }
+
return 0;
}
@@ -361,10 +445,13 @@
*/
MMRESULT WINAPI timeEndPeriod(UINT wPeriod)
{
- TRACE("(%u) !\n", wPeriod);
-
if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL)
return TIMERR_NOCANDO;
+
+ if (wPeriod > MMSYSTIME_MININTERVAL)
+ {
+ FIXME("Stub; we set our timer resolution at minimum\n");
+ }
return 0;
}
@@ -374,12 +461,15 @@
*/
DWORD WINAPI timeGetTime(void)
{
+#if defined(COMMENTOUTPRIORTODELETING)
DWORD count;
+
/* FIXME: releasing the win16 lock here is a temporary hack (I hope)
* that lets mciavi.drv run correctly
*/
if (pFnReleaseThunkLock) pFnReleaseThunkLock(&count);
- TIME_MMTimeStart();
if (pFnRestoreThunkLock) pFnRestoreThunkLock(count);
- return WINMM_SysTimeMS;
+#endif
+
+ return GetTickCount();
}
reactos/lib/winmm
diff -u -r1.8 -r1.9
--- winehq2ros.patch 19 Sep 2004 11:25:43 -0000 1.8
+++ winehq2ros.patch 20 Oct 2004 17:42:11 -0000 1.9
@@ -1,10 +1,10 @@
Index: lolvldrv.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/lolvldrv.c,v
-retrieving revision 1.59
-diff -u -r1.59 lolvldrv.c
---- lolvldrv.c 20 Aug 2004 20:01:31 -0000 1.59
-+++ lolvldrv.c 19 Sep 2004 11:38:37 -0000
+retrieving revision 1.61
+diff -u -r1.61 lolvldrv.c
+--- lolvldrv.c 22 Sep 2004 04:00:14 -0000 1.61
++++ lolvldrv.c 20 Oct 2004 17:54:30 -0000
@@ -758,11 +758,18 @@
{
TRACE("()\n");
@@ -26,41 +26,14 @@
return TRUE;
}
-Index: time.c
-===================================================================
-RCS file: /home/wine/wine/dlls/winmm/time.c,v
-retrieving revision 1.26
-diff -u -r1.26 time.c
---- time.c 12 Jan 2004 21:03:10 -0000 1.26
-+++ time.c 19 Sep 2004 11:38:41 -0000
-@@ -175,14 +175,19 @@
- volatile HANDLE *pActive = (volatile HANDLE *)&TIME_hMMTimer;
- DWORD last_time, cur_time;
-
-+#ifndef __REACTOS__
- usleep(MMSYSTIME_STDINTERVAL * 1000);
-+#endif /* __REACTOS__ */
-+
- last_time = GetTickCount();
- while (*pActive) {
- TIME_MMSysTimeCallback(iData);
- cur_time = GetTickCount();
- while (last_time < cur_time)
- last_time += MMSYSTIME_STDINTERVAL;
-+#ifndef __REACTOS__
- usleep((last_time - cur_time) * 1000);
-+#endif /* __REACTOS__ */
- }
- return 0;
- }
Index: winmm.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winmm.c,v
-retrieving revision 1.42
-diff -u -r1.42 winmm.c
---- winmm.c 16 Aug 2004 23:19:17 -0000 1.42
-+++ winmm.c 19 Sep 2004 11:38:42 -0000
-@@ -83,7 +83,9 @@
+retrieving revision 1.45
+diff -u -r1.45 winmm.c
+--- winmm.c 19 Oct 2004 23:55:15 -0000 1.45
++++ winmm.c 20 Oct 2004 17:54:32 -0000
+@@ -94,7 +94,9 @@
return FALSE;
WINMM_IData->hWinMM32Instance = hInstDLL;
InitializeCriticalSection(&WINMM_IData->cs);
@@ -70,7 +43,7 @@
WINMM_IData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
WINMM_IData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
TRACE("Created IData (%p)\n", WINMM_IData);
-@@ -126,10 +128,12 @@
+@@ -137,10 +139,12 @@
loaded = -1;
if (h)
{
@@ -89,7 +62,7 @@
retrieving revision 1.17
diff -u -r1.17 winmm_res.rc
--- winmm_res.rc 16 Aug 2004 20:02:09 -0000 1.17
-+++ winmm_res.rc 19 Sep 2004 11:38:45 -0000
++++ winmm_res.rc 20 Oct 2004 17:54:32 -0000
@@ -34,7 +34,7 @@
#include "winmm_Es.rc"
#include "winmm_Fr.rc"
reactos/lib/winmm
diff -u -r1.5 -r1.6
--- winemm.h 8 Aug 2004 21:36:20 -0000 1.5
+++ winemm.h 20 Oct 2004 17:42:11 -0000 1.6
@@ -162,7 +162,7 @@
DWORD dwUser;
UINT16 wFlags;
UINT16 wTimerID;
- UINT uCurTime;
+ DWORD dwTriggerTime;
struct tagWINE_TIMERENTRY* lpNext;
} WINE_TIMERENTRY, *LPWINE_TIMERENTRY;
@@ -250,25 +250,25 @@
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 dwParam1, DWORD dwParam2);
-DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
+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 WINMM_CheckForMMSystem(void);
const char* WINMM_ErrorToString(MMRESULT error);
-UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD dwCallback,
- DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
-UINT MIDI_OutOpen(HMIDIOUT* lphMidiOut, UINT uDeviceID, DWORD dwCallback,
- DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
-UINT MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD dwCallback,
- DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
+UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD fdwOpen, BOOL bFrom32);
+UINT MIDI_OutOpen(HMIDIOUT* lphMidiOut, UINT uDeviceID, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32);
+UINT MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32);
MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
- DWORD cMidi, DWORD dwCallback,
- DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
+ DWORD cMidi, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD fdwOpen, BOOL bFrom32);
UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
- const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
- DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
+ const LPWAVEFORMATEX lpFormat, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32);
HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo,
DWORD dwOpenFlags, enum mmioProcType type);
@@ -285,7 +285,6 @@
/* Global variables */
extern LPWINE_MM_IDATA WINMM_IData;
-extern DWORD WINMM_SysTimeMS;
/* pointers to 16 bit functions (if sibling MMSYSTEM.DLL is loaded
* NULL otherwise
reactos/lib/winmm
diff -u -r1.13 -r1.14
--- winmm.c 19 Sep 2004 11:25:43 -0000 1.13
+++ winmm.c 20 Oct 2004 17:42:11 -0000 1.14
@@ -28,6 +28,17 @@
* 99/9 added support for loadable low level drivers
*/
+/* TODO
+ * + it seems that some programs check what's installed in
+ * registry against the value returned by drivers. Wine is
+ * currently broken regarding this point.
+ * + check thread-safeness for MMSYSTEM and WINMM entry points
+ * + unicode entry points are badly supported (would require
+ * moving 32 bit drivers as Unicode as they are supposed to be)
+ * + allow joystick and timer external calls as we do for wave,
+ * midi, mixer and aux
+ */
+
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
@@ -430,7 +441,7 @@
MIXERCONTROLDETAILS_LISTTEXTW *pDetailsW = (MIXERCONTROLDETAILS_LISTTEXTW *)lpmcd->paDetails;
MIXERCONTROLDETAILS_LISTTEXTA *pDetailsA;
int size = max(1, lpmcd->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
- int i;
+ unsigned int i;
if (lpmcd->u.cMultipleItems != 0) {
size *= lpmcd->u.cMultipleItems;
@@ -495,7 +506,7 @@
{
MIXERLINECONTROLSA mlcA;
DWORD ret;
- int i;
+ unsigned int i;
TRACE("(%p, %p, %08lx)\n", hmix, lpmlcW, fdwControls);
@@ -1671,8 +1682,8 @@
return MIDI_GetErrorText(uError, lpText, uSize);
}
-UINT MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD dwCallback,
- DWORD dwInstance, DWORD dwFlags, BOOL bFrom32)
+UINT MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32)
{
HANDLE hMidiIn;
LPWINE_MIDI lpwm;
@@ -1710,7 +1721,7 @@
* midiInOpen [WINMM.@]
*/
UINT WINAPI midiInOpen(HMIDIIN* lphMidiIn, UINT uDeviceID,
- DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
+ DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
{
return MIDI_InOpen(lphMidiIn, uDeviceID, dwCallback, dwInstance, dwFlags, TRUE);
}
@@ -2219,7 +2230,7 @@
* MMSYSTEM_MidiStream_Open [internal]
*/
MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi,
- DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen,
+ DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen,
BOOL bFrom32)
{
WINE_MIDIStream* lpMidiStrm;
@@ -2286,8 +2297,8 @@
* midiStreamOpen [WINMM.@]
*/
MMRESULT WINAPI midiStreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID,
- DWORD cMidi, DWORD dwCallback,
- DWORD dwInstance, DWORD fdwOpen)
+ DWORD cMidi, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD fdwOpen)
{
return MIDI_StreamOpen(lphMidiStrm, lpuDeviceID, cMidi, dwCallback,
dwInstance, fdwOpen, TRUE);
@@ -2471,8 +2482,8 @@
}
UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
- const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
- DWORD dwInstance, DWORD dwFlags, BOOL bFrom32)
+ const LPWAVEFORMATEX lpFormat, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32)
{
HANDLE handle;
LPWINE_MLD wmld;
@@ -3039,8 +3050,8 @@
* waveInOpen [WINMM.@]
*/
UINT WINAPI waveInOpen(HWAVEIN* lphWaveIn, UINT uDeviceID,
- const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
- DWORD dwInstance, DWORD dwFlags)
+ const LPWAVEFORMATEX lpFormat, DWORD_PTR dwCallback,
+ DWORD_PTR dwInstance, DWORD dwFlags)
{
return WAVE_Open((HANDLE*)lphWaveIn, uDeviceID, MMDRV_WAVEIN, lpFormat,
dwCallback, dwInstance, dwFlags, TRUE);
CVSspam 0.2.8