Commit 26c8fb8c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntoskrnl.exe: Add tests for permanent objects.

These tests have to live in ntoskrnl, since only kernel drivers and processes running as LOCAL SYSTEM can create permanent objects. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0534beb3
......@@ -1378,7 +1378,7 @@
@ stdcall ZwClose(long) NtClose
@ stub ZwCloseObjectAuditAlarm
@ stdcall -private ZwConnectPort(ptr ptr ptr ptr ptr ptr ptr ptr) NtConnectPort
@ stdcall -private ZwCreateDirectoryObject(ptr long ptr) NtCreateDirectoryObject
@ stdcall ZwCreateDirectoryObject(ptr long ptr) NtCreateDirectoryObject
@ stdcall ZwCreateEvent(ptr long ptr long long) NtCreateEvent
@ stdcall ZwCreateFile(ptr long ptr ptr ptr long long long long ptr long) NtCreateFile
@ stdcall -private ZwCreateIoCompletion(ptr long ptr long) NtCreateIoCompletion
......@@ -1412,11 +1412,11 @@
@ stdcall -private ZwLoadKey(ptr ptr) NtLoadKey
@ stdcall -private ZwLockFile(long long ptr ptr ptr ptr ptr ptr long long) NtLockFile
@ stdcall -private ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
@ stdcall -private ZwMakeTemporaryObject(long) NtMakeTemporaryObject
@ stdcall ZwMakeTemporaryObject(long) NtMakeTemporaryObject
@ stdcall -private ZwMapViewOfSection(long long ptr long long ptr ptr long long long) NtMapViewOfSection
@ stdcall -private ZwNotifyChangeDirectoryFile(long long ptr ptr ptr ptr long long long) NtNotifyChangeDirectoryFile
@ stdcall -private ZwNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey
@ stdcall -private ZwOpenDirectoryObject(ptr long ptr) NtOpenDirectoryObject
@ stdcall ZwOpenDirectoryObject(ptr long ptr) NtOpenDirectoryObject
@ stdcall -private ZwOpenEvent(ptr long ptr) NtOpenEvent
@ stdcall ZwOpenFile(ptr long ptr ptr long long) NtOpenFile
@ stdcall -private ZwOpenJobObject(ptr long ptr) NtOpenJobObject
......
......@@ -2024,6 +2024,54 @@ static void test_process_memory(const struct test_input *test_input)
ObDereferenceObject(process);
}
static void test_permanence(void)
{
OBJECT_ATTRIBUTES attr;
HANDLE handle, handle2;
UNICODE_STRING str;
NTSTATUS status;
RtlInitUnicodeString(&str, L"\\BaseNamedObjects\\wine_test_dir");
InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr );
ok(!status, "got %#x\n", status);
status = ZwClose( handle );
ok(!status, "got %#x\n", status);
status = ZwOpenDirectoryObject( &handle, 0, &attr );
ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status);
attr.Attributes = OBJ_PERMANENT;
status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr );
ok(!status, "got %#x\n", status);
status = ZwClose( handle );
ok(!status, "got %#x\n", status);
attr.Attributes = 0;
status = ZwOpenDirectoryObject( &handle, 0, &attr );
todo_wine ok(!status, "got %#x\n", status);
status = ZwMakeTemporaryObject( handle );
ok(!status, "got %#x\n", status);
status = ZwMakeTemporaryObject( handle );
ok(!status, "got %#x\n", status);
status = ZwClose( handle );
todo_wine ok(!status, "got %#x\n", status);
status = ZwOpenDirectoryObject( &handle, 0, &attr );
ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status);
status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr );
ok(!status, "got %#x\n", status);
attr.Attributes = OBJ_PERMANENT;
status = ZwOpenDirectoryObject( &handle2, 0, &attr );
ok(status == STATUS_SUCCESS, "got %#x\n", status);
status = ZwClose( handle2 );
ok(!status, "got %#x\n", status);
status = ZwClose( handle );
ok(!status, "got %#x\n", status);
attr.Attributes = 0;
status = ZwOpenDirectoryObject( &handle, 0, &attr );
ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status);
}
static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *stack)
{
ULONG length = stack->Parameters.DeviceIoControl.OutputBufferLength;
......@@ -2080,6 +2128,7 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
test_affinity();
test_dpc();
test_process_memory(test_input);
test_permanence();
if (main_test_work_item) return STATUS_UNEXPECTED_IO_ERROR;
......
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