fix over/underflow issues in win32_msgwait