Commit 637e01e2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntoskrnl.exe: Implement file object constructor.

parent 85531444
......@@ -369,16 +369,26 @@ NTSTATUS WINAPI ObReferenceObjectByHandle( HANDLE handle, ACCESS_MASK access,
}
static void *create_file_object( HANDLE handle );
static const WCHAR file_type_name[] = {'F','i','l','e',0};
static struct _OBJECT_TYPE file_type = {
file_type_name,
NULL,
create_file_object,
free_kernel_object
};
POBJECT_TYPE IoFileObjectType = &file_type;
static void *create_file_object( HANDLE handle )
{
FILE_OBJECT *file;
if (!(file = alloc_kernel_object( IoFileObjectType, sizeof(*file), 0 ))) return NULL;
file->Type = 5; /* MSDN */
file->Size = sizeof(*file);
return file;
}
/* transfer result of IRP back to wineserver */
static NTSTATUS WINAPI dispatch_irp_completion( DEVICE_OBJECT *device, IRP *irp, void *context )
......
......@@ -664,6 +664,7 @@ static void test_ob_reference(const WCHAR *test_path)
{
OBJECT_ATTRIBUTES attr = { sizeof(attr) };
HANDLE event_handle, file_handle, file_handle2, thread_handle;
FILE_OBJECT *file;
void *obj1, *obj2;
UNICODE_STRING pathU;
IO_STATUS_BLOCK io;
......@@ -732,6 +733,9 @@ static void test_ob_reference(const WCHAR *test_path)
todo_wine
ok(obj1 == obj2, "obj1 != obj2\n");
file = obj1;
ok(file->Type == 5, "Type = %u\n", file->Type);
ObDereferenceObject(obj1);
ObDereferenceObject(obj2);
......
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