Commit 98fd541d authored by Bryan Mayland's avatar Bryan Mayland Committed by Alexandre Julliard

kernel: WaitForMultipleObjectsEx should accept up to MAXIMUM_WAIT_OBJECTS.

parent b4ee2ad0
......@@ -173,7 +173,7 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
HANDLE hloc[MAXIMUM_WAIT_OBJECTS];
unsigned int i;
if (count >= MAXIMUM_WAIT_OBJECTS)
if (count > MAXIMUM_WAIT_OBJECTS)
{
SetLastError(ERROR_INVALID_PARAMETER);
return WAIT_FAILED;
......
......@@ -31,7 +31,8 @@ static void test_signalandwait(void)
DWORD (WINAPI *pSignalObjectAndWait)(HANDLE, HANDLE, DWORD, BOOL);
HMODULE kernel32;
DWORD r;
HANDLE event[2], semaphore[2], file;
int i;
HANDLE event[2], maxevents[MAXIMUM_WAIT_OBJECTS], semaphore[2], file;
kernel32 = GetModuleHandle("kernel32");
pSignalObjectAndWait = (void*) GetProcAddress(kernel32, "SignalObjectAndWait");
......@@ -83,6 +84,18 @@ static void test_signalandwait(void)
CloseHandle(event[0]);
CloseHandle(event[1]);
/* create the maximum number of events and make sure
* we can wait on that many */
for (i=0; i<MAXIMUM_WAIT_OBJECTS; i++)
{
maxevents[i] = CreateEvent(NULL, 1, 1, NULL);
ok( maxevents[i] != 0, "should create enough events\n");
}
r = WaitForMultipleObjects(MAXIMUM_WAIT_OBJECTS, maxevents, 0, 0);
ok( r != WAIT_FAILED && r != WAIT_TIMEOUT, "should succeed\n");
for (i=0; i<MAXIMUM_WAIT_OBJECTS; i++)
if (maxevents[i]) CloseHandle(maxevents[i]);
/* semaphores */
semaphore[0] = CreateSemaphore( NULL, 0, 1, NULL );
......
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