kernel: WaitForMultipleObjectsEx should accept up to MAXIMUM_WAIT_OBJECTS.

This commit is contained in:
Bryan Mayland 2006-03-21 16:45:40 -05:00 committed by Alexandre Julliard
parent b4ee2ad0e4
commit 98fd541de8
2 changed files with 15 additions and 2 deletions

View File

@ -173,7 +173,7 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
HANDLE hloc[MAXIMUM_WAIT_OBJECTS]; HANDLE hloc[MAXIMUM_WAIT_OBJECTS];
unsigned int i; unsigned int i;
if (count >= MAXIMUM_WAIT_OBJECTS) if (count > MAXIMUM_WAIT_OBJECTS)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return WAIT_FAILED; return WAIT_FAILED;

View File

@ -31,7 +31,8 @@ static void test_signalandwait(void)
DWORD (WINAPI *pSignalObjectAndWait)(HANDLE, HANDLE, DWORD, BOOL); DWORD (WINAPI *pSignalObjectAndWait)(HANDLE, HANDLE, DWORD, BOOL);
HMODULE kernel32; HMODULE kernel32;
DWORD r; DWORD r;
HANDLE event[2], semaphore[2], file; int i;
HANDLE event[2], maxevents[MAXIMUM_WAIT_OBJECTS], semaphore[2], file;
kernel32 = GetModuleHandle("kernel32"); kernel32 = GetModuleHandle("kernel32");
pSignalObjectAndWait = (void*) GetProcAddress(kernel32, "SignalObjectAndWait"); pSignalObjectAndWait = (void*) GetProcAddress(kernel32, "SignalObjectAndWait");
@ -83,6 +84,18 @@ static void test_signalandwait(void)
CloseHandle(event[0]); CloseHandle(event[0]);
CloseHandle(event[1]); 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 */ /* semaphores */
semaphore[0] = CreateSemaphore( NULL, 0, 1, NULL ); semaphore[0] = CreateSemaphore( NULL, 0, 1, NULL );