Author: arty Date: Wed Aug 29 09:57:00 2007 New Revision: 28643
URL: http://svn.reactos.org/svn/reactos?rev=28643&view=rev Log: Move creation of global objects to csrss as specified in the fixmes. Whatever was broken before that prevented this seems to have been resolved.
Modified: trunk/reactos/dll/win32/kernel32/misc/dllmain.c trunk/reactos/subsystems/win32/csrss/init.c
Modified: trunk/reactos/dll/win32/kernel32/misc/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/dll... ============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/dllmain.c (original) +++ trunk/reactos/dll/win32/kernel32/misc/dllmain.c Wed Aug 29 09:57:00 2007 @@ -66,10 +66,7 @@ { 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, @@ -83,44 +80,7 @@ &ObjectAttributes); if (!NT_SUCCESS(Status)) { - /* FIXME: It's not our job to create the BNO directory, csr does it */ - Status = NtCreateDirectoryObject(DirHandle, - DIRECTORY_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - 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"); - } + return Status; }
DPRINT("Opened BNO: %lx\n", *DirHandle);
Modified: trunk/reactos/subsystems/win32/csrss/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/init... ============================================================================== --- trunk/reactos/subsystems/win32/csrss/init.c (original) +++ trunk/reactos/subsystems/win32/csrss/init.c Wed Aug 29 09:57:00 2007 @@ -338,6 +338,73 @@ }
/* === INIT ROUTINES === */ + +/********************************************************************** + * CsrpCreateBNODirectory/3 + * + * These used to be part of kernel32 startup, but that clearly wasn't a good + * idea, as races were definately possible. These are moved (as in the + * previous fixmes). + */ +static NTSTATUS +CsrpCreateBNODirectory (int argc, char ** argv, char ** envp) +{ + NTSTATUS Status; + 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"); + HANDLE DirHandle, SymHandle; + + /* Seems like a good place to create these objects which are needed by + * win32 processes */ + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtCreateDirectoryObject(&DirHandle, + DIRECTORY_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateDirectoryObject() failed %08x\n", Status); + } + + /* Create the "local" Symbolic Link. + * FIXME: CSR should do this -- Fixed */ + InitializeObjectAttributes(&ObjectAttributes, + &SymName, + OBJ_CASE_INSENSITIVE, + DirHandle, + NULL); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &Name); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateDirectoryObject() failed %08x\n", Status); + } + + /* Create the "global" Symbolic Link. */ + InitializeObjectAttributes(&ObjectAttributes, + &SymName2, + OBJ_CASE_INSENSITIVE, + DirHandle, + NULL); + Status = NtCreateSymbolicLinkObject(&SymHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &Name); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateDirectoryObject() failed %08x\n", Status); + } + + return Status; +}
/********************************************************************** * CsrpCreateHeap/3 @@ -623,6 +690,7 @@ CSR_INIT_ROUTINE EntryPoint; PCHAR ErrorMessage; } InitRoutine [] = { + {TRUE, CsrpCreateBNODirectory, "create base named objects directory"}, {TRUE, CsrpCreateCallbackPort, "create the callback port \Windows\SbApiPort"}, {TRUE, CsrpRegisterSubsystem, "register with SM"}, {TRUE, CsrpCreateHeap, "create the CSR heap"},