Allow timeout of 0. Cap timer rate to SYS_TIMER_RATE.
diff --git a/windows/timer.c b/windows/timer.c
index cc71922..b46be52 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -31,6 +31,8 @@
#define NB_TIMERS 34
#define NB_RESERVED_TIMERS 2 /* for SetSystemTimer */
+#define SYS_TIMER_RATE 54925
+
static TIMER TimersArray[NB_TIMERS];
static CRITICAL_SECTION csTimer;
@@ -205,8 +207,11 @@
int i;
TIMER * pTimer;
- if (!timeout) return 0;
-
+ if (!timeout)
+ { /* timeout==0 is a legal argument UB 990821*/
+ WARN("Timeout== 0 not implemented, using timeout=1\n");
+ timeout=1;
+ }
EnterCriticalSection( &csTimer );
/* Check if there's already a timer with the same hwnd and id */
@@ -248,9 +253,9 @@
if (proc) WINPROC_SetProc( &pTimer->proc, proc, type, WIN_PROC_TIMER );
pTimer->expired = FALSE;
- pTimer->hService = SERVICE_AddTimer( timeout * 1000L,
- TIMER_CheckTimer, (ULONG_PTR)pTimer );
-
+ pTimer->hService = SERVICE_AddTimer( MAX( timeout * 1000L, SYS_TIMER_RATE ),
+ TIMER_CheckTimer, (ULONG_PTR)pTimer );
+
TRACE("Timer added: %p, %04x, %04x, %04x, %08lx\n",
pTimer, pTimer->hwnd, pTimer->msg, pTimer->id,
(DWORD)pTimer->proc );