1 /* $Id: init.c,v 1.51 2003/11/14 17:13:32 weiden Exp $
3 * init.c - Session Manager initialization
5 * ReactOS Operating System
7 * --------------------------------------------------------------------
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this software; see the file COPYING.LIB. If not, write
21 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
24 * --------------------------------------------------------------------
26 * 19990530 (Emanuele Aliberti)
27 * Compiled successfully with egcs 1.1.2
30 /* INCLUDES *****************************************************************/
33 #include <ntdll/rtl.h>
34 #include <ntdll/ldr.h>
42 /* GLOBALS ******************************************************************/
44 HANDLE DbgSsApiPort
= INVALID_HANDLE_VALUE
;
45 HANDLE DbgUiApiPort
= INVALID_HANDLE_VALUE
;
47 PWSTR SmSystemEnvironment
= NULL
;
50 /* FUNCTIONS ****************************************************************/
52 static NTSTATUS STDCALL
53 SmObjectDirectoryQueryRoutine(PWSTR ValueName
,
60 OBJECT_ATTRIBUTES ObjectAttributes
;
61 UNICODE_STRING UnicodeString
;
62 HANDLE WindowsDirectory
;
63 NTSTATUS Status
= STATUS_SUCCESS
;
66 DbgPrint("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
67 DbgPrint("ValueData '%S'\n", (PWSTR
)ValueData
);
69 if (ValueType
!= REG_SZ
)
71 return(STATUS_SUCCESS
);
74 RtlInitUnicodeString(&UnicodeString
,
77 InitializeObjectAttributes(&ObjectAttributes
,
83 Status
= ZwCreateDirectoryObject(&WindowsDirectory
,
92 SmCreateObjectDirectories(VOID
)
94 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
97 RtlZeroMemory(&QueryTable
,
100 QueryTable
[0].Name
= L
"ObjectDirectories";
101 QueryTable
[0].QueryRoutine
= SmObjectDirectoryQueryRoutine
;
103 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
104 L
"\\Session Manager",
113 static NTSTATUS STDCALL
114 SmDosDevicesQueryRoutine(PWSTR ValueName
,
121 OBJECT_ATTRIBUTES ObjectAttributes
;
122 UNICODE_STRING DeviceName
;
123 UNICODE_STRING LinkName
;
125 WCHAR LinkBuffer
[80];
128 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
129 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
131 if (ValueType
!= REG_SZ
)
133 return(STATUS_SUCCESS
);
139 RtlInitUnicodeString(&LinkName
,
141 RtlInitUnicodeString(&DeviceName
,
144 DPRINT("SM: Linking %wZ --> %wZ\n",
148 /* create symbolic link */
149 InitializeObjectAttributes(&ObjectAttributes
,
154 Status
= NtCreateSymbolicLinkObject(&LinkHandle
,
155 SYMBOLIC_LINK_ALL_ACCESS
,
158 if (!NT_SUCCESS(Status
))
160 DPRINT1("SmDosDevicesQueryRoutine: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n",
171 SmInitDosDevices(VOID
)
173 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
176 RtlZeroMemory(&QueryTable
,
179 QueryTable
[0].QueryRoutine
= SmDosDevicesQueryRoutine
;
181 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
182 L
"\\Session Manager\\DOS Devices",
190 static NTSTATUS STDCALL
191 SmRunBootAppsQueryRoutine(PWSTR ValueName
,
198 PRTL_USER_PROCESS_PARAMETERS ProcessParameters
;
199 RTL_PROCESS_INFO ProcessInfo
;
200 UNICODE_STRING ImagePathString
;
201 UNICODE_STRING CommandLineString
;
202 WCHAR Description
[256];
203 WCHAR ImageName
[256];
204 WCHAR ImagePath
[256];
205 WCHAR CommandLine
[256];
210 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
211 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
213 if (ValueType
!= REG_SZ
)
215 return(STATUS_SUCCESS
);
218 /* Extract the description */
219 p1
= wcschr((PWSTR
)ValueData
, L
' ');
220 len
= p1
- (PWSTR
)ValueData
;
221 memcpy(Description
,ValueData
, len
* sizeof(WCHAR
));
222 Description
[len
] = 0;
224 /* Extract the image name */
226 p2
= wcschr(p1
, L
' ');
231 memcpy(ImageName
, p1
, len
* sizeof(WCHAR
));
234 /* Extract the command line */
242 wcscpy(CommandLine
, p2
);
245 DPRINT("Running %S...\n", Description
);
246 DPRINT("ImageName: '%S'\n", ImageName
);
247 DPRINT("CommandLine: '%S'\n", CommandLine
);
249 /* initialize executable path */
250 wcscpy(ImagePath
, L
"\\SystemRoot\\system32\\");
251 wcscat(ImagePath
, ImageName
);
252 wcscat(ImagePath
, L
".exe");
254 RtlInitUnicodeString(&ImagePathString
,
257 RtlInitUnicodeString(&CommandLineString
,
260 RtlCreateProcessParameters(&ProcessParameters
,
271 Status
= RtlCreateUserProcess(&ImagePathString
,
272 OBJ_CASE_INSENSITIVE
,
281 if (!NT_SUCCESS(Status
))
283 DPRINT1("Running %s failed (Status %lx)\n", Description
, Status
);
284 return(STATUS_SUCCESS
);
287 RtlDestroyProcessParameters(ProcessParameters
);
289 /* Wait for process termination */
290 NtWaitForSingleObject(ProcessInfo
.ProcessHandle
,
294 NtClose(ProcessInfo
.ThreadHandle
);
295 NtClose(ProcessInfo
.ProcessHandle
);
297 return(STATUS_SUCCESS
);
302 * Run native applications listed in the registry.
305 * \Registry\Machine\SYSTEM\CurrentControlSet\Control\Session Manager
307 * Value (format: "<description> <executable> <command line>":
308 * BootExecute = "autocheck autochk *"
313 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
316 RtlZeroMemory(&QueryTable
,
319 QueryTable
[0].Name
= L
"BootExecute";
320 QueryTable
[0].QueryRoutine
= SmRunBootAppsQueryRoutine
;
322 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
323 L
"\\Session Manager",
327 if (!NT_SUCCESS(Status
))
329 DPRINT1("SmRunBootApps: RtlQueryRegistryValues() failed! (Status %lx)\n", Status
);
337 SmProcessFileRenameList(VOID
)
339 DPRINT("SmProcessFileRenameList() called\n");
341 /* FIXME: implement it! */
343 DPRINT("SmProcessFileRenameList() done\n");
345 return(STATUS_SUCCESS
);
349 static NTSTATUS STDCALL
350 SmKnownDllsQueryRoutine(PWSTR ValueName
,
357 OBJECT_ATTRIBUTES ObjectAttributes
;
358 IO_STATUS_BLOCK IoStatusBlock
;
359 UNICODE_STRING ImageName
;
361 HANDLE SectionHandle
;
364 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
365 DPRINT("ValueData '%S' Context %p EntryContext %p\n", (PWSTR
)ValueData
, Context
, EntryContext
);
367 /* Ignore the 'DllDirectory' value */
368 if (!_wcsicmp(ValueName
, L
"DllDirectory"))
369 return STATUS_SUCCESS
;
371 /* Open the DLL image file */
372 RtlInitUnicodeString(&ImageName
,
374 InitializeObjectAttributes(&ObjectAttributes
,
376 OBJ_CASE_INSENSITIVE
,
379 Status
= NtOpenFile(&FileHandle
,
380 SYNCHRONIZE
| FILE_EXECUTE
,
384 FILE_SYNCHRONOUS_IO_NONALERT
| FILE_NON_DIRECTORY_FILE
);
385 if (!NT_SUCCESS(Status
))
387 DPRINT1("NtOpenFile() failed (Status %lx)\n", Status
);
388 return STATUS_SUCCESS
;
391 DPRINT("Opened file %wZ successfully\n", &ImageName
);
393 /* Check for valid image checksum */
394 Status
= LdrVerifyImageMatchesChecksum (FileHandle
,
398 if (Status
== STATUS_IMAGE_CHECKSUM_MISMATCH
)
400 /* Raise a hard error (crash the system/BSOD) */
401 NtRaiseHardError (Status
,
408 else if (!NT_SUCCESS(Status
))
410 DPRINT1("Failed to check the image checksum\n");
412 NtClose(SectionHandle
);
415 return STATUS_SUCCESS
;
418 InitializeObjectAttributes(&ObjectAttributes
,
420 OBJ_CASE_INSENSITIVE
| OBJ_PERMANENT
,
421 (HANDLE
)EntryContext
,
423 Status
= NtCreateSection(&SectionHandle
,
430 if (NT_SUCCESS(Status
))
432 DPRINT("Created section successfully\n");
433 NtClose(SectionHandle
);
438 return STATUS_SUCCESS
;
443 SmLoadKnownDlls(VOID
)
445 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
446 OBJECT_ATTRIBUTES ObjectAttributes
;
447 IO_STATUS_BLOCK IoStatusBlock
;
448 UNICODE_STRING DllDosPath
;
449 UNICODE_STRING DllNtPath
;
451 HANDLE ObjectDirHandle
;
452 HANDLE FileDirHandle
;
453 HANDLE SymlinkHandle
;
456 DPRINT("SmLoadKnownDlls() called\n");
458 /* Create 'KnownDlls' object directory */
459 RtlInitUnicodeString(&Name
,
461 InitializeObjectAttributes(&ObjectAttributes
,
463 OBJ_PERMANENT
| OBJ_CASE_INSENSITIVE
| OBJ_OPENIF
,
466 Status
= NtCreateDirectoryObject(&ObjectDirHandle
,
467 DIRECTORY_ALL_ACCESS
,
469 if (!NT_SUCCESS(Status
))
471 DPRINT1("NtCreateDirectoryObject() failed (Status %lx)\n", Status
);
475 RtlInitUnicodeString(&DllDosPath
, NULL
);
477 RtlZeroMemory(&QueryTable
,
480 QueryTable
[0].Name
= L
"DllDirectory";
481 QueryTable
[0].Flags
= RTL_QUERY_REGISTRY_DIRECT
;
482 QueryTable
[0].EntryContext
= &DllDosPath
;
484 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
485 L
"\\Session Manager\\KnownDlls",
488 SmSystemEnvironment
);
489 if (!NT_SUCCESS(Status
))
491 DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status
);
495 DPRINT("DllDosPath: '%wZ'\n", &DllDosPath
);
497 if (!RtlDosPathNameToNtPathName_U(DllDosPath
.Buffer
,
502 DPRINT1("RtlDosPathNameToNtPathName_U() failed\n");
503 return STATUS_OBJECT_NAME_INVALID
;
506 DPRINT("DllNtPath: '%wZ'\n", &DllNtPath
);
508 /* Open the dll path directory */
509 InitializeObjectAttributes(&ObjectAttributes
,
511 OBJ_CASE_INSENSITIVE
,
514 Status
= NtOpenFile(&FileDirHandle
,
515 SYNCHRONIZE
| FILE_READ_DATA
,
518 FILE_SHARE_READ
| FILE_SHARE_WRITE
,
519 FILE_SYNCHRONOUS_IO_NONALERT
| FILE_DIRECTORY_FILE
);
520 if (!NT_SUCCESS(Status
))
522 DPRINT("NtOpenFile() failed (Status %lx)\n", Status
);
526 /* Link 'KnownDllPath' the dll path directory */
527 RtlInitUnicodeString(&Name
,
529 InitializeObjectAttributes(&ObjectAttributes
,
531 OBJ_PERMANENT
| OBJ_CASE_INSENSITIVE
| OBJ_OPENIF
,
534 Status
= NtCreateSymbolicLinkObject(&SymlinkHandle
,
535 SYMBOLIC_LINK_ALL_ACCESS
,
538 if (!NT_SUCCESS(Status
))
540 DPRINT1("NtCreateSymbolicLink() failed (Status %lx)\n", Status
);
544 NtClose(SymlinkHandle
);
546 RtlZeroMemory(&QueryTable
,
549 QueryTable
[0].QueryRoutine
= SmKnownDllsQueryRoutine
;
550 QueryTable
[0].EntryContext
= ObjectDirHandle
;
552 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
553 L
"\\Session Manager\\KnownDlls",
555 (PVOID
)FileDirHandle
,
557 if (!NT_SUCCESS(Status
))
559 DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status
);
562 DPRINT("SmLoadKnownDlls() done\n");
568 static NTSTATUS STDCALL
569 SmPagingFilesQueryRoutine(PWSTR ValueName
,
576 UNICODE_STRING FileName
;
577 LARGE_INTEGER InitialSize
;
578 LARGE_INTEGER MaximumSize
;
582 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
583 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
585 if (ValueType
!= REG_SZ
)
587 return(STATUS_SUCCESS
);
591 * Format: "<path>[ <initial_size>[ <maximum_size>]]"
593 if ((p
= wcschr(ValueData
, ' ')) != NULL
)
596 InitialSize
.QuadPart
= wcstoul(p
+ 1, &p
, 0) * 256 * 4096;
599 MaximumSize
.QuadPart
= wcstoul(p
+ 1, NULL
, 0) * 256 * 4096;
602 MaximumSize
= InitialSize
;
606 InitialSize
.QuadPart
= 50 * 4096;
607 MaximumSize
.QuadPart
= 80 * 4096;
610 if (!RtlDosPathNameToNtPathName_U ((LPWSTR
)ValueData
,
615 return (STATUS_SUCCESS
);
618 DbgPrint("SMSS: Created paging file %wZ with size %dKB\n",
619 &FileName
, InitialSize
.QuadPart
/ 1024);
620 Status
= NtCreatePagingFile(&FileName
,
625 RtlFreeUnicodeString(&FileName
);
627 return(STATUS_SUCCESS
);
632 SmCreatePagingFiles(VOID
)
634 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
637 RtlZeroMemory(&QueryTable
,
640 QueryTable
[0].Name
= L
"PagingFiles";
641 QueryTable
[0].QueryRoutine
= SmPagingFilesQueryRoutine
;
643 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
644 L
"\\Session Manager\\Memory Management",
653 static NTSTATUS STDCALL
654 SmEnvironmentQueryRoutine(PWSTR ValueName
,
661 UNICODE_STRING EnvVariable
;
662 UNICODE_STRING EnvValue
;
664 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
665 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
667 if (ValueType
!= REG_SZ
)
669 return(STATUS_SUCCESS
);
672 RtlInitUnicodeString(&EnvVariable
,
674 RtlInitUnicodeString(&EnvValue
,
676 RtlSetEnvironmentVariable(Context
,
680 return(STATUS_SUCCESS
);
685 SmSetEnvironmentVariables(VOID
)
687 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
688 UNICODE_STRING EnvVariable
;
689 UNICODE_STRING EnvValue
;
690 WCHAR ValueBuffer
[MAX_PATH
];
694 * The following environment variables must be set prior to reading
695 * other variables from the registry.
697 * Variables (example):
698 * SystemRoot = "C:\reactos"
702 /* Copy system root into value buffer */
704 SharedUserData
->NtSystemRoot
);
706 /* Set SystemRoot = "C:\reactos" */
707 RtlInitUnicodeStringFromLiteral(&EnvVariable
,
709 RtlInitUnicodeString(&EnvValue
,
711 RtlSetEnvironmentVariable(&SmSystemEnvironment
,
715 /* Cut off trailing path */
718 /* Set SystemDrive = "C:" */
719 RtlInitUnicodeStringFromLiteral(&EnvVariable
,
721 RtlInitUnicodeString(&EnvValue
,
723 RtlSetEnvironmentVariable(&SmSystemEnvironment
,
727 /* Read system environment from the registry. */
728 RtlZeroMemory(&QueryTable
,
731 QueryTable
[0].QueryRoutine
= SmEnvironmentQueryRoutine
;
733 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
734 L
"\\Session Manager\\Environment",
736 &SmSystemEnvironment
,
737 SmSystemEnvironment
);
744 SmLoadSubsystems(VOID
)
746 SYSTEM_LOAD_AND_CALL_IMAGE ImageInfo
;
749 /* Load kernel mode subsystem (aka win32k.sys) */
750 RtlInitUnicodeStringFromLiteral(&ImageInfo
.ModuleName
,
751 L
"\\SystemRoot\\system32\\win32k.sys");
753 Status
= NtSetSystemInformation(SystemLoadAndCallImage
,
755 sizeof(SYSTEM_LOAD_AND_CALL_IMAGE
));
757 DPRINT("SMSS: Loaded win32k.sys (Status %lx)\n", Status
);
759 if (!NT_SUCCESS(Status
))
765 /* FIXME: load more subsystems (csrss!) */
775 OBJECT_ATTRIBUTES ObjectAttributes
;
776 UNICODE_STRING UnicodeString
;
777 HANDLE ReactOSInitEvent
;
779 RtlInitUnicodeStringFromLiteral(&UnicodeString
, L
"\\ReactOSInitDone");
780 InitializeObjectAttributes(&ObjectAttributes
,
785 Status
= NtOpenEvent(&ReactOSInitEvent
,
788 if (NT_SUCCESS(Status
))
790 LARGE_INTEGER Timeout
;
791 /* This will cause the boot screen image to go away (if displayed) */
792 NtPulseEvent(ReactOSInitEvent
, NULL
);
794 /* Wait for the display mode to be changed (if in graphics mode) */
795 Timeout
.QuadPart
= -50000000LL; /* 5 second timeout */
796 NtWaitForSingleObject(ReactOSInitEvent
, FALSE
, &Timeout
);
798 NtClose(ReactOSInitEvent
);
802 /* We don't really care if this fails */
803 DPRINT1("SM: Failed to open ReactOS init notification event\n");
809 InitSessionManager(HANDLE Children
[])
812 UNICODE_STRING UnicodeString
;
813 OBJECT_ATTRIBUTES ObjectAttributes
;
814 PRTL_USER_PROCESS_PARAMETERS ProcessParameters
;
815 RTL_PROCESS_INFO ProcessInfo
;
816 HANDLE CsrssInitEvent
;
817 WCHAR UnicodeBuffer
[MAX_PATH
];
819 /* Create object directories */
820 Status
= SmCreateObjectDirectories();
821 if (!NT_SUCCESS(Status
))
823 DPRINT1("SM: Failed to create object directories (Status %lx)\n", Status
);
827 /* Create the SmApiPort object (LPC) */
828 Status
= SmCreateApiPort();
829 if (!NT_SUCCESS(Status
))
831 DPRINT1("SM: Failed to create SmApiPort (Status %lx)\n", Status
);
835 /* Create the system environment */
836 Status
= RtlCreateEnvironment(FALSE
,
837 &SmSystemEnvironment
);
838 if (!NT_SUCCESS(Status
))
840 DPRINT1("SM: Failed to create the system environment (Status %lx)\n", Status
);
844 /* Set environment variables */
845 Status
= SmSetEnvironmentVariables();
846 if (!NT_SUCCESS(Status
))
848 DPRINT1("SM: Failed to set system environment variables (Status %lx)\n", Status
);
852 /* Define symbolic links to kernel devices (MS-DOS names) */
853 Status
= SmInitDosDevices();
854 if (!NT_SUCCESS(Status
))
856 DPRINT1("SM: Failed to create dos device links (Status %lx)\n", Status
);
860 /* Run all programs in the boot execution list */
861 Status
= SmRunBootApps();
862 if (!NT_SUCCESS(Status
))
864 DPRINT1("SM: Failed to run boot applications (Status %lx)\n", Status
);
868 /* Process the file rename list */
869 Status
= SmProcessFileRenameList();
870 if (!NT_SUCCESS(Status
))
872 DPRINT1("SM: Failed to process the file rename list (Status %lx)\n", Status
);
876 DPRINT("SM: loading well-known DLLs\n");
878 /* Load the well known DLLs */
879 Status
= SmLoadKnownDlls();
880 if (!NT_SUCCESS(Status
))
882 DPRINT1("SM: Failed to preload system DLLs (Status %lx)\n", Status
);
883 /* Don't crash ReactOS if DLLs cannot be loaded */
886 DPRINT("SM: creating system paging files\n");
888 /* Create paging files */
889 Status
= SmCreatePagingFiles();
890 if (!NT_SUCCESS(Status
))
892 DPRINT1("SM: Failed to create paging files (Status %lx)\n", Status
);
896 DPRINT("SM: initializing registry\n");
898 /* Load remaining registry hives */
899 NtInitializeRegistry(FALSE
);
901 /* Set environment variables from registry */
903 Status
= SmUpdateEnvironment();
904 if (!NT_SUCCESS(Status
))
906 DPRINT1("SM: Failed to update environment variables (Status %lx)\n", Status
);
911 DPRINT("SM: loading subsystems\n");
913 /* Load the subsystems */
914 Status
= SmLoadSubsystems();
915 if (!NT_SUCCESS(Status
))
917 DPRINT1("SM: Failed to load subsystems (Status %lx)\n", Status
);
925 DPRINT("SM: initializing csrss\n");
928 RtlInitUnicodeStringFromLiteral(&UnicodeString
,
930 InitializeObjectAttributes(&ObjectAttributes
,
935 Status
= NtCreateEvent(&CsrssInitEvent
,
940 if (!NT_SUCCESS(Status
))
942 DbgPrint("Failed to create csrss notification event\n");
946 * Start the Win32 subsystem (csrss.exe)
949 /* initialize executable path */
950 wcscpy(UnicodeBuffer
, L
"\\??\\");
951 wcscat(UnicodeBuffer
, SharedUserData
->NtSystemRoot
);
952 wcscat(UnicodeBuffer
, L
"\\system32\\csrss.exe");
953 RtlInitUnicodeString(&UnicodeString
,
956 RtlCreateProcessParameters(&ProcessParameters
,
967 Status
= RtlCreateUserProcess(&UnicodeString
,
968 OBJ_CASE_INSENSITIVE
,
978 RtlDestroyProcessParameters (ProcessParameters
);
980 if (!NT_SUCCESS(Status
))
982 DisplayString(L
"SM: Loading csrss.exe failed!\n");
986 NtWaitForSingleObject(CsrssInitEvent
,
990 Children
[CHILD_CSRSS
] = ProcessInfo
.ProcessHandle
;
993 * Start the logon process (winlogon.exe)
996 DPRINT("SM: starting winlogon\n");
998 /* initialize executable path */
999 wcscpy(UnicodeBuffer
, L
"\\??\\");
1000 wcscat(UnicodeBuffer
, SharedUserData
->NtSystemRoot
);
1001 wcscat(UnicodeBuffer
, L
"\\system32\\winlogon.exe");
1002 RtlInitUnicodeString(&UnicodeString
,
1005 RtlCreateProcessParameters(&ProcessParameters
,
1010 SmSystemEnvironment
,
1016 Status
= RtlCreateUserProcess(&UnicodeString
,
1017 OBJ_CASE_INSENSITIVE
,
1027 RtlDestroyProcessParameters(ProcessParameters
);
1029 if (!NT_SUCCESS(Status
))
1031 DisplayString(L
"SM: Loading winlogon.exe failed!\n");
1032 NtTerminateProcess(Children
[CHILD_CSRSS
],
1036 Children
[CHILD_WINLOGON
] = ProcessInfo
.ProcessHandle
;
1038 /* Create the \DbgSsApiPort object (LPC) */
1039 RtlInitUnicodeStringFromLiteral(&UnicodeString
,
1041 InitializeObjectAttributes(&ObjectAttributes
,
1047 Status
= NtCreatePort(&DbgSsApiPort
,
1053 if (!NT_SUCCESS(Status
))
1058 DisplayString(L
"SM: DbgSsApiPort created...\n");
1061 /* Create the \DbgUiApiPort object (LPC) */
1062 RtlInitUnicodeStringFromLiteral(&UnicodeString
,
1064 InitializeObjectAttributes(&ObjectAttributes
,
1070 Status
= NtCreatePort(&DbgUiApiPort
,
1075 if (!NT_SUCCESS(Status
))
1080 DisplayString (L
"SM: DbgUiApiPort created...\n");
1083 return(STATUS_SUCCESS
);