Commit cefdbd59 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

server: Avoid infinite loop when we're out of timers in set_win_timer server call.

parent 80eb2fa0
...@@ -2581,13 +2581,21 @@ DECL_HANDLER(set_win_timer) ...@@ -2581,13 +2581,21 @@ DECL_HANDLER(set_win_timer)
} }
else else
{ {
lparam_t end_id = queue->next_timer_id;
/* find a free id for it */ /* find a free id for it */
do while (1)
{ {
id = queue->next_timer_id; id = queue->next_timer_id;
if (--queue->next_timer_id <= 0x100) queue->next_timer_id = 0x7fff; if (--queue->next_timer_id <= 0x100) queue->next_timer_id = 0x7fff;
if (!find_timer( queue, 0, req->msg, id )) break;
if (queue->next_timer_id == end_id)
{
set_win32_error( ERROR_NO_MORE_USER_HANDLES );
return;
}
} }
while (find_timer( queue, 0, req->msg, id ));
} }
} }
......
...@@ -5136,6 +5136,7 @@ static const struct ...@@ -5136,6 +5136,7 @@ static const struct
{ "DIRECTORY_NOT_EMPTY", STATUS_DIRECTORY_NOT_EMPTY }, { "DIRECTORY_NOT_EMPTY", STATUS_DIRECTORY_NOT_EMPTY },
{ "DISK_FULL", STATUS_DISK_FULL }, { "DISK_FULL", STATUS_DISK_FULL },
{ "DLL_NOT_FOUND", STATUS_DLL_NOT_FOUND }, { "DLL_NOT_FOUND", STATUS_DLL_NOT_FOUND },
{ "ERROR_NO_MORE_USER_HANDLES", 0xc0010000 | ERROR_NO_MORE_USER_HANDLES },
{ "ERROR_CLASS_ALREADY_EXISTS", 0xc0010000 | ERROR_CLASS_ALREADY_EXISTS }, { "ERROR_CLASS_ALREADY_EXISTS", 0xc0010000 | ERROR_CLASS_ALREADY_EXISTS },
{ "ERROR_CLASS_DOES_NOT_EXIST", 0xc0010000 | ERROR_CLASS_DOES_NOT_EXIST }, { "ERROR_CLASS_DOES_NOT_EXIST", 0xc0010000 | ERROR_CLASS_DOES_NOT_EXIST },
{ "ERROR_CLASS_HAS_WINDOWS", 0xc0010000 | ERROR_CLASS_HAS_WINDOWS }, { "ERROR_CLASS_HAS_WINDOWS", 0xc0010000 | ERROR_CLASS_HAS_WINDOWS },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment