Re: ole32: fix wrong timeout check

2007-12-23 Thread Alexandre Julliard
Alexander Dorofeyev <[EMAIL PROTECTED]> writes: > Yeah these calculations are a headache. I could probably write > > now < start_time || now >= start_time + dwTimeout The right way is to write now - start_time > dwTimeout using unsigned variables everywhere. Then you don't have to worry about

Re: ole32: fix wrong timeout check

2007-12-22 Thread Alexander Dorofeyev
Yeah these calculations are a headache. I could probably write now < start_time || now >= start_time + dwTimeout to at least avoid a "hang" if GetTickCount counter overflows. This won't solve not waiting the required time if, say, start_time + dwTimeout overflows, and that can also be a problem

re: ole32: fix wrong timeout check

2007-12-21 Thread Dan Kegel
>-if ((dwTimeout != INFINITE) && (start_time + dwTimeout >= now)) >+if ((dwTimeout != INFINITE) && (now >= start_time + dwTimeout)) >From time immemorial, it has been drummed into me that one should always handle wraparound when checking timers. So something like DWORD delta =