From bc5d1b05819ec394263140e37b4c9a4208bf0aef Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Tue, 27 Jun 2006 03:06:26 +0000 Subject: [PATCH] - Catch illegal call to Ob functions when ObjectAttributes == NULL and return distinguished status code for this situation (STATUS_INVALID_PARAMETER), instead of failing due to access violation. - Create the BNO Global and Local symbolic links in kernel32. - We pass all the Ob+Native tests in ntdll_winetest om now (we fail some named pipe ones, but I have no idea why WINE calls them "Object Manager" related...) svn path=/trunk/; revision=22652 --- reactos/dll/win32/kernel32/misc/dllmain.c | 33 +++++++++++++++++++++++ reactos/ntoskrnl/ob/obhandle.c | 8 ++++++ 2 files changed, 41 insertions(+) diff --git a/reactos/dll/win32/kernel32/misc/dllmain.c b/reactos/dll/win32/kernel32/misc/dllmain.c index bb609a8419f..16f7fa582c8 100644 --- a/reactos/dll/win32/kernel32/misc/dllmain.c +++ b/reactos/dll/win32/kernel32/misc/dllmain.c @@ -66,7 +66,10 @@ OpenBaseDirectory(PHANDLE DirHandle) { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\BaseNamedObjects"); + UNICODE_STRING SymName = RTL_CONSTANT_STRING(L"Local"); + UNICODE_STRING SymName2 = RTL_CONSTANT_STRING(L"Global"); NTSTATUS Status; + HANDLE SymHandle; InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -88,6 +91,36 @@ OpenBaseDirectory(PHANDLE DirHandle) { DPRINT1("NtCreateDirectoryObject() failed\n"); } + + /* Create the "local" Symbolic Link. FIXME: CSR should do this */ + InitializeObjectAttributes(&ObjectAttributes, + &SymName, + OBJ_CASE_INSENSITIVE, + *DirHandle, + NULL); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &Name); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateSymbolicLinkObject() failed\n"); + } + + /* Create the "global" Symbolic Link. FIXME: CSR should do this */ + InitializeObjectAttributes(&ObjectAttributes, + &SymName2, + OBJ_CASE_INSENSITIVE, + *DirHandle, + NULL); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &Name); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateSymbolicLinkObject() failed\n"); + } } DPRINT("Opened BNO: %lx\n", *DirHandle); diff --git a/reactos/ntoskrnl/ob/obhandle.c b/reactos/ntoskrnl/ob/obhandle.c index 4c72ac32801..eca177bfe9a 100644 --- a/reactos/ntoskrnl/ob/obhandle.c +++ b/reactos/ntoskrnl/ob/obhandle.c @@ -1455,6 +1455,14 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, OB_OPEN_REASON OpenReason; PAGED_CODE(); + /* Check if we didn't get any Object Attributes */ + if (!ObjectAttributes) + { + /* Fail with special status code */ + *Handle = NULL; + return STATUS_INVALID_PARAMETER; + } + /* Capture all the info */ Status = ObpCaptureObjectAttributes(ObjectAttributes, AccessMode,