From 3b67ad9bd47b553c82a85bdf6b205555acc496d2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 18 Jan 2010 20:34:54 +0100 Subject: [PATCH] ntdll: Fix the NtCreateEvent prototype. It takes an event type, not a manual reset flag. --- dlls/kernel32/console.c | 2 +- dlls/kernel32/except.c | 2 +- dlls/kernel32/sync.c | 3 ++- dlls/krnl386.exe16/task.c | 2 +- dlls/ntdll/reg.c | 2 +- dlls/ntdll/serial.c | 2 +- dlls/ntdll/sync.c | 10 +++------- dlls/ntdll/threadpool.c | 8 ++++---- include/winternl.h | 2 +- 9 files changed, 15 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index 4aa0b443838..eb3e21d54b1 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -1195,7 +1195,7 @@ static BOOL start_console_renderer(STARTUPINFOA* si) attr.SecurityDescriptor = NULL; attr.SecurityQualityOfService = NULL; - NtCreateEvent(&hEvent, EVENT_ALL_ACCESS, &attr, TRUE, FALSE); + NtCreateEvent(&hEvent, EVENT_ALL_ACCESS, &attr, NotificationEvent, FALSE); if (!hEvent) return FALSE; /* first try environment variable */ diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c index 701f921641c..d6dea99ae34 100644 --- a/dlls/kernel32/except.c +++ b/dlls/kernel32/except.c @@ -366,7 +366,7 @@ static int start_debugger_atomic(PEXCEPTION_POINTERS epointers) /* ask for manual reset, so that once the debugger is started, * every thread will know it */ - NtCreateEvent( &hEvent, EVENT_ALL_ACCESS, &attr, TRUE, FALSE ); + NtCreateEvent( &hEvent, EVENT_ALL_ACCESS, &attr, NotificationEvent, FALSE ); if (InterlockedCompareExchangePointer( &hRunOnce, hEvent, 0 ) == 0) { /* ok, our event has been set... we're the winning thread */ diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c index 8918f3df2ae..fbe055d8431 100644 --- a/dlls/kernel32/sync.c +++ b/dlls/kernel32/sync.c @@ -489,7 +489,8 @@ HANDLE WINAPI CreateEventExW( SECURITY_ATTRIBUTES *sa, LPCWSTR name, DWORD flags attr.RootDirectory = get_BaseNamedObjects_handle(); } - status = NtCreateEvent( &ret, access, &attr, (flags & CREATE_EVENT_MANUAL_RESET) != 0, + status = NtCreateEvent( &ret, access, &attr, + (flags & CREATE_EVENT_MANUAL_RESET) ? NotificationEvent : SynchronizationEvent, (flags & CREATE_EVENT_INITIAL_SET) != 0 ); if (status == STATUS_OBJECT_NAME_EXISTS) SetLastError( ERROR_ALREADY_EXISTS ); diff --git a/dlls/krnl386.exe16/task.c b/dlls/krnl386.exe16/task.c index 06f9d9484f0..1b252e94dc9 100644 --- a/dlls/krnl386.exe16/task.c +++ b/dlls/krnl386.exe16/task.c @@ -350,7 +350,7 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT /* Create scheduler event for 16-bit tasks */ if ( !(pTask->flags & TDBF_WIN32) ) - NtCreateEvent( &pTask->hEvent, EVENT_ALL_ACCESS, NULL, TRUE, FALSE ); + NtCreateEvent( &pTask->hEvent, EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE ); if (!initial_task) initial_task = hTask; diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index cb214a7ee62..50ec0815e99 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -651,7 +651,7 @@ NTSTATUS WINAPI NtNotifyChangeKey( { OBJECT_ATTRIBUTES attr; InitializeObjectAttributes( &attr, NULL, 0, NULL, NULL ); - ret = NtCreateEvent( &Event, EVENT_ALL_ACCESS, &attr, FALSE, FALSE ); + ret = NtCreateEvent( &Event, EVENT_ALL_ACCESS, &attr, SynchronizationEvent, FALSE ); if (ret != STATUS_SUCCESS) return ret; } diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c index 1936428ba2f..0c003039d38 100644 --- a/dlls/ntdll/serial.c +++ b/dlls/ntdll/serial.c @@ -1363,7 +1363,7 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDevice, attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF; attr.SecurityDescriptor = NULL; attr.SecurityQualityOfService = NULL; - status = NtCreateEvent(&hev, EVENT_ALL_ACCESS, &attr, FALSE, FALSE); + status = NtCreateEvent(&hev, EVENT_ALL_ACCESS, &attr, SynchronizationEvent, FALSE); if (status) goto done; } diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index f3f969a4319..3e27d09d7ee 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -247,12 +247,8 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, PULONG previous * NtCreateEvent (NTDLL.@) * ZwCreateEvent (NTDLL.@) */ -NTSTATUS WINAPI NtCreateEvent( - OUT PHANDLE EventHandle, - IN ACCESS_MASK DesiredAccess, - IN const OBJECT_ATTRIBUTES *attr, - IN BOOLEAN ManualReset, - IN BOOLEAN InitialState) +NTSTATUS WINAPI NtCreateEvent( PHANDLE EventHandle, ACCESS_MASK DesiredAccess, + const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN InitialState) { DWORD len = attr && attr->ObjectName ? attr->ObjectName->Length : 0; NTSTATUS ret; @@ -274,7 +270,7 @@ NTSTATUS WINAPI NtCreateEvent( { req->access = DesiredAccess; req->attributes = (attr) ? attr->Attributes : 0; - req->manual_reset = ManualReset; + req->manual_reset = (type == NotificationEvent); req->initial_state = InitialState; wine_server_add_data( req, &objattr, sizeof(objattr) ); if (objattr.sd_len) wine_server_add_data( req, sd, objattr.sd_len ); diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c index 31a1a5605e0..44afb018ff9 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c @@ -440,7 +440,7 @@ NTSTATUS WINAPI RtlRegisterWait(PHANDLE NewWaitObject, HANDLE Object, wait_work_item->DeleteCount = 0; wait_work_item->CompletionEvent = NULL; - status = NtCreateEvent( &wait_work_item->CancelEvent, EVENT_ALL_ACCESS, NULL, TRUE, FALSE ); + status = NtCreateEvent( &wait_work_item->CancelEvent, EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE ); if (status != STATUS_SUCCESS) { RtlFreeHeap( GetProcessHeap(), 0, wait_work_item ); @@ -485,7 +485,7 @@ NTSTATUS WINAPI RtlDeregisterWaitEx(HANDLE WaitHandle, HANDLE CompletionEvent) { if (CompletionEvent == INVALID_HANDLE_VALUE) { - status = NtCreateEvent( &CompletionEvent, EVENT_ALL_ACCESS, NULL, TRUE, FALSE ); + status = NtCreateEvent( &CompletionEvent, EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE ); if (status != STATUS_SUCCESS) return status; interlocked_xchg_ptr( &wait_work_item->CompletionEvent, CompletionEvent ); @@ -778,7 +778,7 @@ NTSTATUS WINAPI RtlCreateTimerQueue(PHANDLE NewTimerQueue) RtlInitializeCriticalSection(&q->cs); list_init(&q->timers); q->quit = FALSE; - status = NtCreateEvent(&q->event, EVENT_ALL_ACCESS, NULL, FALSE, FALSE); + status = NtCreateEvent(&q->event, EVENT_ALL_ACCESS, NULL, SynchronizationEvent, FALSE); if (status != STATUS_SUCCESS) { RtlFreeHeap(GetProcessHeap(), 0, q); @@ -1013,7 +1013,7 @@ NTSTATUS WINAPI RtlDeleteTimer(HANDLE TimerQueue, HANDLE Timer, return STATUS_INVALID_PARAMETER_1; q = t->q; if (CompletionEvent == INVALID_HANDLE_VALUE) - status = NtCreateEvent(&event, EVENT_ALL_ACCESS, NULL, FALSE, FALSE); + status = NtCreateEvent(&event, EVENT_ALL_ACCESS, NULL, SynchronizationEvent, FALSE); else if (CompletionEvent) event = CompletionEvent; diff --git a/include/winternl.h b/include/winternl.h index 315becf38b9..686095061d8 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1902,7 +1902,7 @@ NTSYSAPI NTSTATUS WINAPI NtCompleteConnectPort(HANDLE); NTSYSAPI NTSTATUS WINAPI NtConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PLPC_SECTION_READ,PULONG,PVOID,PULONG); NTSYSAPI NTSTATUS WINAPI NtContinue(PCONTEXT,BOOLEAN); NTSYSAPI NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES); -NTSYSAPI NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN); +NTSYSAPI NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,EVENT_TYPE,BOOLEAN); NTSYSAPI NTSTATUS WINAPI NtCreateEventPair(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES); NTSYSAPI NTSTATUS WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtCreateIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,ULONG);