Re: timeSetEvent() wraps after inteval of 429496



"Chris P." <msdn@xxxxxxxxxxxx> wrote in message
news:q9ca7uqmj1rd$.1v08n1w09vq3u.dlg@xxxxxxxxxxxxx
>
> There is a bug in timeSetEvent(), which is used to schedule a callback
> after a given period, in that if the period is greater than 429496
> milliseconds the actual time period will wrap back to x-429496. So for
> example, setting a period of 430000 which generate a callback in 504ms.
> This is despite the capabilities reported by timeGetDevCaps() reporting
the
> maximum supported value is 1000000.
>
> The actual exports for these time functions are in winmm.dll, and this bug
> seems to have been there for quite a while. I've tested on XP SP2 back to
> Win2K, but don't have anything older on hand. I don't see how it could be
> used as a security compromise in any way, but the behavior is definately
> unexpected.
>

You can always use IReferenceClock.

IReferenceClock* pRefClock;

CoCreateInstance(CLSID_SystemClock,NULL,CLSCTX_INPROC_SERVER,IID_IReferenceC
lock,(void**)&pRefClock);

Now you can use Advise() or AdvisePeriodic() method.

--
It is practically impossible to teach good programming to students that have
had a prior exposure to BASIC: as potential programmers they are mentally
mutilated beyond hope of regeneration. (Edsger Dijkstra 1930-2002)


.



Relevant Pages

  • Re: timeSetEvent() wraps after inteval of 429496
    ... setting a period of 430000 which generate a callback in 504ms. ... > The actual exports for these time functions are in winmm.dll, and this bug ... > // This code reproduces a bug in timeSetEvent() where if a periodic timing ... > void CALLBACK TimerProc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: re:IWMReader and HTTP Stream: Memory Leak?
    ... > OnStatus() callback and right before the second WMT_CONNECTING I get ... > about 15 trace messages that say: ... had a prior exposure to BASIC: as potential programmers they are mentally ...
    (microsoft.public.windowsmedia.sdk)
  • Re: WORKER_THREAD_RETURNED_AT_BAD_IRQL
    ... I will file a bug to either fix the bugcheck parameters to dump the callback ... pointer instead of the workitem object or make the _IO_WORKITEM structure ... such as spinlock/fastmutex and didn't release the lock or raised the IRQL ...
    (microsoft.public.development.device.drivers)
  • [PATCH] Use after free in drivers/media/video/videodev.c
    ... I think that there's a bug in videdev.c. ... call a ->release callback. ... if a driver switch to dynamically allocated video_device ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • __stdcall / CALLBACK
    ... the EnumWindows function, and I've got a function call defined as ... I've noticed that CALLBACK is defined as __stdcall, ... Oddly, if I *don't* include windows.h and use __stdcall, that's also fine. ... There's always at least one more bug. ...
    (microsoft.public.vc.language)