ntoskrnl.exe: Implement IoCreateSynchronizationEvent.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46804
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-03-27 17:43:39 +01:00 committed by Alexandre Julliard
parent b4f78d6896
commit fd8bc0c16d
6 changed files with 57 additions and 11 deletions

View File

@ -402,7 +402,7 @@ static CRITICAL_SECTION_DEBUG handle_map_critsect_debug =
};
static CRITICAL_SECTION handle_map_cs = { &handle_map_critsect_debug, -1, 0, 0, 0, 0 };
static NTSTATUS kernel_object_from_handle( HANDLE handle, POBJECT_TYPE type, void **ret )
NTSTATUS kernel_object_from_handle( HANDLE handle, POBJECT_TYPE type, void **ret )
{
struct object_header *header;
void *obj;
@ -3290,15 +3290,6 @@ BOOLEAN WINAPI Ke386SetIoAccessMap(ULONG flag, PVOID buffer)
return FALSE;
}
/*****************************************************
* IoCreateSynchronizationEvent (NTOSKRNL.EXE.@)
*/
PKEVENT WINAPI IoCreateSynchronizationEvent(PUNICODE_STRING name, PHANDLE handle)
{
FIXME("(%p %p) stub\n", name, handle);
return (KEVENT *)0xdeadbeaf;
}
/*****************************************************
* IoStartNextPacket (NTOSKRNL.EXE.@)
*/

View File

@ -1395,7 +1395,7 @@
@ stdcall -private ZwSetDefaultLocale(long long) NtSetDefaultLocale
@ stdcall -private ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage
@ stdcall -private ZwSetEaFile(long ptr ptr long) NtSetEaFile
@ stdcall -private ZwSetEvent(long ptr) NtSetEvent
@ stdcall ZwSetEvent(long ptr) NtSetEvent
@ stdcall -private ZwSetInformationFile(long ptr ptr long long) NtSetInformationFile
@ stdcall -private ZwSetInformationJobObject(long long ptr long) NtSetInformationJobObject
@ stdcall -private ZwSetInformationObject(long long ptr long) NtSetInformationObject

View File

@ -29,6 +29,7 @@ struct _OBJECT_TYPE {
void *alloc_kernel_object( POBJECT_TYPE type, HANDLE handle, SIZE_T size, LONG ref ) DECLSPEC_HIDDEN;
HANDLE kernel_object_handle( void *obj, unsigned int access ) DECLSPEC_HIDDEN;
NTSTATUS kernel_object_from_handle( HANDLE handle, POBJECT_TYPE type, void **ret ) DECLSPEC_HIDDEN;
extern POBJECT_TYPE ExEventObjectType;
extern POBJECT_TYPE ExSemaphoreObjectType;

View File

@ -218,6 +218,32 @@ static struct _OBJECT_TYPE event_type = {
POBJECT_TYPE ExEventObjectType = &event_type;
/***********************************************************************
* IoCreateSynchronizationEvent (NTOSKRNL.EXE.@)
*/
PKEVENT WINAPI IoCreateSynchronizationEvent( UNICODE_STRING *name, HANDLE *ret_handle )
{
OBJECT_ATTRIBUTES attr;
HANDLE handle;
KEVENT *event;
NTSTATUS ret;
TRACE( "(%p %p)\n", name, ret_handle );
InitializeObjectAttributes( &attr, name, 0, 0, NULL );
ret = NtCreateEvent( &handle, EVENT_ALL_ACCESS, &attr, SynchronizationEvent, TRUE );
if (ret) return NULL;
if (kernel_object_from_handle( handle, ExEventObjectType, (void**)&event ))
{
NtClose( handle);
return NULL;
}
*ret_handle = handle;
return event;
}
/***********************************************************************
* KeSetEvent (NTOSKRNL.EXE.@)
*/

View File

@ -474,6 +474,33 @@ static void test_sync(void)
ZwClose(handle);
ObDereferenceObject(event);
event = IoCreateSynchronizationEvent(NULL, &handle);
ok(event != NULL, "IoCreateSynchronizationEvent failed\n");
ret = wait_single(event, 0);
ok(ret == 0, "got %#x\n", ret);
KeResetEvent(event);
ret = wait_single(event, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
ret = wait_single_handle(handle, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
ret = ZwSetEvent(handle, NULL);
ok(!ret, "NtSetEvent returned %#x\n", ret);
ret = wait_single(event, 0);
ok(ret == 0, "got %#x\n", ret);
ret = wait_single_handle(handle, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
KeSetEvent(event, 0, FALSE);
ret = wait_single_handle(handle, 0);
ok(!ret, "got %#x\n", ret);
ret = wait_single(event, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
ret = ZwClose(handle);
ok(!ret, "ZwClose returned %#x\n", ret);
/* test semaphores */
KeInitializeSemaphore(&semaphore, 0, 5);

View File

@ -1488,6 +1488,7 @@ VOID WINAPI IoCompleteRequest(IRP*,UCHAR);
NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);
NTSTATUS WINAPI IoCreateDriver(UNICODE_STRING*,PDRIVER_INITIALIZE);
NTSTATUS WINAPI IoCreateSymbolicLink(UNICODE_STRING*,UNICODE_STRING*);
PKEVENT WINAPI IoCreateSynchronizationEvent(UNICODE_STRING*,HANDLE*);
void WINAPI IoDeleteDevice(DEVICE_OBJECT*);
void WINAPI IoDeleteDriver(DRIVER_OBJECT*);
NTSTATUS WINAPI IoDeleteSymbolicLink(UNICODE_STRING*);