ReactOS 0.4.17-dev-1133-gc25e4fd
init.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ex/init.c
5 * PURPOSE: Executive Initialization Code
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Eric Kohl
8 */
9
10/* INCLUDES ******************************************************************/
11
12#include <ntoskrnl.h>
13#include <reactos/buildno.h>
14#include "inbv/logo.h"
15
16#define NDEBUG
17#include <debug.h>
18
19/* This is the size that we can expect from the win 2003 loader */
20#define LOADER_PARAMETER_EXTENSION_MIN_SIZE \
21 RTL_SIZEOF_THROUGH_FIELD(LOADER_PARAMETER_EXTENSION, AcpiTableSize)
22
23/* Temporary hack */
24CODE_SEG("INIT")
28 IN ULONG Phase,
29 IN PLOADER_PARAMETER_BLOCK LoaderBlock
30);
31
35
37{
38 WCHAR DebugBuffer[256];
39 CHAR VersionBuffer[256];
40 CHAR BootlogHeader[256];
41 CHAR VersionNumber[24];
43 WCHAR RegistryBuffer[256];
45
46/* DATA **********************************************************************/
47
48/* NT Version Info */
51#if DBG /* Checked Build */
53#else /* Free Build */
55#endif
56
57/* NT System Info */
60
61/* Cm Version Info */
67
68CHAR NtBuildLab[] = KERNEL_VERSION_BUILD_STR "."
69 REACTOS_COMPILER_NAME "_" REACTOS_COMPILER_VERSION;
70
71/* Init flags and settings */
77BOOLEAN SosEnabled; // Used by driver.c!IopDisplayLoadingMessage()
78
79/* NT Boot Path */
81
82/* NT Initial User Application */
83WCHAR NtInitialUserProcessBuffer[128] = L"\\SystemRoot\\System32\\smss.exe";
85 sizeof(WCHAR);
87
88/* Boot NLS information */
95
96/* CMOS Timer Sanity */
99
100/* FUNCTIONS ****************************************************************/
101
102CODE_SEG("INIT")
104NTAPI
106{
107 UNICODE_STRING LinkName;
109 HANDLE LinkHandle;
111 ANSI_STRING AnsiName;
112 CHAR Buffer[256];
115
116 /* Initialize the ArcName tree */
117 RtlInitUnicodeString(&LinkName, L"\\ArcName");
119 &LinkName,
121 NULL,
123
124 /* Create it */
125 Status = NtCreateDirectoryObject(&LinkHandle,
128 if (!NT_SUCCESS(Status))
129 {
130 /* Failed */
131 KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 1, 0, 0);
132 }
133
134 /* Close the LinkHandle */
135 NtClose(LinkHandle);
136
137 /* Initialize the Device tree */
138 RtlInitUnicodeString(&LinkName, L"\\Device");
140 &LinkName,
142 NULL,
144
145 /* Create it */
146 Status = NtCreateDirectoryObject(&LinkHandle,
149 if (!NT_SUCCESS(Status))
150 {
151 /* Failed */
152 KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 2, 0, 0);
153 }
154
155 /* Close the LinkHandle */
156 ObCloseHandle(LinkHandle, KernelMode);
157
158 /* Create the system root symlink name */
159 RtlInitAnsiString(&AnsiName, "\\SystemRoot");
160 Status = RtlAnsiStringToUnicodeString(&LinkName, &AnsiName, TRUE);
161 if (!NT_SUCCESS(Status))
162 {
163 /* Failed */
164 KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 3, 0, 0);
165 }
166
167 /* Initialize the attributes for the link */
169 &LinkName,
171 NULL,
173
174 /* Build the ARC name */
176 "\\ArcName\\%s%s",
177 LoaderBlock->ArcBootDeviceName,
178 LoaderBlock->NtBootPathName);
180
181 /* Convert it to Unicode */
185 TRUE);
186 if (!NT_SUCCESS(Status))
187 {
188 /* We failed, bugcheck */
189 KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 4, 0, 0);
190 }
191
192 /* Create it */
196 &TargetName);
197
198 /* Free the strings */
199 RtlFreeUnicodeString(&LinkName);
201
202 /* Check if creating the link failed */
203 if (!NT_SUCCESS(Status))
204 {
205 /* Failed */
206 KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 5, 0, 0);
207 }
208
209 /* Close the handle and return success */
210 ObCloseHandle(LinkHandle, KernelMode);
211 return STATUS_SUCCESS;
212}
213
214CODE_SEG("INIT")
215VOID
216NTAPI
218{
219 LARGE_INTEGER SectionSize;
221 HANDLE NlsSection;
222 PVOID SectionBase = NULL;
223 SIZE_T ViewSize = 0;
224 LARGE_INTEGER SectionOffset = {{0, 0}};
225 PLIST_ENTRY ListHead, NextEntry;
227 ULONG NlsTablesEncountered = 0;
228 SIZE_T NlsTableSizes[3] = {0, 0, 0}; /* 3 NLS tables */
229
230 /* Check if this is boot-time phase 0 initialization */
232 {
233 /* Loop the memory descriptors */
234 ListHead = &LoaderBlock->MemoryDescriptorListHead;
235 NextEntry = ListHead->Flink;
236 while (NextEntry != ListHead)
237 {
238 /* Get the current block */
239 MdBlock = CONTAINING_RECORD(NextEntry,
241 ListEntry);
242
243 /* Check if this is an NLS block */
244 if (MdBlock->MemoryType == LoaderNlsData)
245 {
246 /* Increase the table size */
247 ExpNlsTableSize += MdBlock->PageCount * PAGE_SIZE;
248
249 /* FreeLdr-specific */
250 NlsTableSizes[NlsTablesEncountered] = MdBlock->PageCount * PAGE_SIZE;
251 NlsTablesEncountered++;
252 ASSERT(NlsTablesEncountered < 4);
253 }
254
255 /* Go to the next block */
256 NextEntry = MdBlock->ListEntry.Flink;
257 }
258
259 /* Allocate the a new buffer since loader memory will be freed */
262 TAG_RTLI);
263 if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
264
265 /* Copy the codepage data in its new location. */
266 if (NlsTablesEncountered == 1)
267 {
268 /* Ntldr-way boot process */
270 LoaderBlock->NlsData->AnsiCodePageData,
272 }
273 else
274 {
275 /*
276 * In NT, the memory blocks are contiguous, but in ReactOS they aren't,
277 * so unless someone fixes FreeLdr, we'll have to use this icky hack.
278 */
280 LoaderBlock->NlsData->AnsiCodePageData,
281 NlsTableSizes[0]);
282
283 RtlCopyMemory((PVOID)((ULONG_PTR)ExpNlsTableBase + NlsTableSizes[0]),
284 LoaderBlock->NlsData->OemCodePageData,
285 NlsTableSizes[1]);
286
287 RtlCopyMemory((PVOID)((ULONG_PTR)ExpNlsTableBase + NlsTableSizes[0] +
288 NlsTableSizes[1]),
289 LoaderBlock->NlsData->UnicodeCodePageData,
290 NlsTableSizes[2]);
291 /* End of Hack */
292 }
293
294 /* Initialize and reset the NLS TAbles */
303 return;
304 }
305
306 /* Set the section size */
307 SectionSize.QuadPart = ExpNlsTableSize;
308
309 /* Create the NLS Section */
310 Status = ZwCreateSection(&NlsSection,
312 NULL,
313 &SectionSize,
315 SEC_COMMIT | 0x1,
316 NULL);
317 if (!NT_SUCCESS(Status))
318 {
319 /* Failed */
320 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 1, 0, 0);
321 }
322
323 /* Get a pointer to the section */
329 NULL);
330 ObCloseHandle(NlsSection, KernelMode);
331 if (!NT_SUCCESS(Status))
332 {
333 /* Failed */
334 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 2, 0, 0);
335 }
336
337 /* Map the NLS Section in system space */
339 &SectionBase,
341 if (!NT_SUCCESS(Status))
342 {
343 /* Failed */
344 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 3, 0, 0);
345 }
346
347 /* Copy the codepage data in its new location. */
348 ASSERT(SectionBase >= MmSystemRangeStart);
350
351 /* Free the previously allocated buffer and set the new location */
353 ExpNlsTableBase = SectionBase;
354
355 /* Initialize the NLS Tables */
364
365 /* Reset the base to 0 */
366 SectionBase = NULL;
367
368 /* Map the section in the system process */
371 &SectionBase,
372 0L,
373 0L,
375 &ViewSize,
376 ViewShare,
377 0L,
379 if (!NT_SUCCESS(Status))
380 {
381 /* Failed */
382 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 5, 0, 0);
383 }
384
385 /* Copy the table into the system process and set this as the base */
387 ExpNlsTableBase = SectionBase;
388}
389
390CODE_SEG("INIT")
391VOID
392NTAPI
394 OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
395 OUT PCHAR *ProcessEnvironment)
396{
398 SIZE_T Size;
399 PWSTR p;
400 UNICODE_STRING NullString = RTL_CONSTANT_STRING(L"");
401 UNICODE_STRING SmssName, Environment, SystemDriveString, DebugString;
402 PVOID EnvironmentPtr = NULL;
403 PRTL_USER_PROCESS_INFORMATION ProcessInformation;
404 PRTL_USER_PROCESS_PARAMETERS ProcessParams = NULL;
405
406 NullString.Length = sizeof(WCHAR);
407
408 /* Use the initial buffer, after the strings */
409 ProcessInformation = &InitBuffer->ProcessInfo;
410
411 /* Allocate memory for the process parameters */
412 Size = sizeof(*ProcessParams) + ((MAX_WIN32_PATH * 6) * sizeof(WCHAR));
413 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
414 (PVOID*)&ProcessParams,
415 0,
416 &Size,
419 if (!NT_SUCCESS(Status))
420 {
421 /* Failed, display error */
422 _snwprintf(InitBuffer->DebugBuffer,
423 sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
424 L"INIT: Unable to allocate Process Parameters. 0x%lx",
425 Status);
426 RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
428
429 /* Bugcheck the system */
430 KeBugCheckEx(SESSION1_INITIALIZATION_FAILED, Status, 0, 0, 0);
431 }
432
433 /* Setup the basic header, and give the process the low 1MB to itself */
434 ProcessParams->Length = (ULONG)Size;
435 ProcessParams->MaximumLength = (ULONG)Size;
438
439 /* Allocate a page for the environment */
440 Size = PAGE_SIZE;
441 Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
442 &EnvironmentPtr,
443 0,
444 &Size,
447 if (!NT_SUCCESS(Status))
448 {
449 /* Failed, display error */
450 _snwprintf(InitBuffer->DebugBuffer,
451 sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
452 L"INIT: Unable to allocate Process Environment. 0x%lx",
453 Status);
454 RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
456
457 /* Bugcheck the system */
458 KeBugCheckEx(SESSION2_INITIALIZATION_FAILED, Status, 0, 0, 0);
459 }
460
461 /* Write the pointer */
462 ProcessParams->Environment = EnvironmentPtr;
463
464 /* Make a buffer for the DOS path */
465 p = (PWSTR)(ProcessParams + 1);
466 ProcessParams->CurrentDirectory.DosPath.Buffer = p;
468 sizeof(WCHAR);
469
470 /* Copy the DOS path */
472 &NtSystemRoot);
473
474 /* Make a buffer for the DLL Path */
475 p = (PWSTR)((PCHAR)ProcessParams->CurrentDirectory.DosPath.Buffer +
476 ProcessParams->CurrentDirectory.DosPath.MaximumLength);
477 ProcessParams->DllPath.Buffer = p;
478 ProcessParams->DllPath.MaximumLength = MAX_WIN32_PATH * sizeof(WCHAR);
479
480 /* Copy the DLL path and append the system32 directory */
481 RtlCopyUnicodeString(&ProcessParams->DllPath,
482 &ProcessParams->CurrentDirectory.DosPath);
483 RtlAppendUnicodeToString(&ProcessParams->DllPath, L"\\System32");
484
485 /* Make a buffer for the image name */
486 p = (PWSTR)((PCHAR)ProcessParams->DllPath.Buffer +
487 ProcessParams->DllPath.MaximumLength);
488 ProcessParams->ImagePathName.Buffer = p;
489 ProcessParams->ImagePathName.MaximumLength = MAX_WIN32_PATH * sizeof(WCHAR);
490
491 /* Make sure the buffer is a valid string which within the given length */
496 sizeof(NtInitialUserProcessBuffer) - sizeof(WCHAR)))))
497 {
498 /* Invalid initial process string, bugcheck */
499 KeBugCheckEx(SESSION2_INITIALIZATION_FAILED,
504 }
505
506 /* Cut out anything after a space */
508 while ((*p) && (*p != L' ')) p++;
509
510 /* Set the image path length */
511 ProcessParams->ImagePathName.Length =
513
514 /* Copy the actual buffer */
515 RtlCopyMemory(ProcessParams->ImagePathName.Buffer,
517 ProcessParams->ImagePathName.Length);
518
519 /* Null-terminate it */
520 ProcessParams->ImagePathName.Buffer[ProcessParams->ImagePathName.Length /
521 sizeof(WCHAR)] = UNICODE_NULL;
522
523 /* Make a buffer for the command line */
524 p = (PWSTR)((PCHAR)ProcessParams->ImagePathName.Buffer +
525 ProcessParams->ImagePathName.MaximumLength);
526 ProcessParams->CommandLine.Buffer = p;
527 ProcessParams->CommandLine.MaximumLength = MAX_WIN32_PATH * sizeof(WCHAR);
528
529 /* Add the image name to the command line */
532
533 /* Create the environment string */
534 RtlInitEmptyUnicodeString(&Environment,
535 ProcessParams->Environment,
536 (USHORT)Size);
537
538 /* Append the DLL path to it */
542
543 /* Create the system drive string */
544 SystemDriveString = NtSystemRoot;
545 SystemDriveString.Length = 2 * sizeof(WCHAR);
546
547 /* Append it to the environment */
548 RtlAppendUnicodeToString(&Environment, L"SystemDrive=");
549 RtlAppendUnicodeStringToString(&Environment, &SystemDriveString);
551
552 /* Append the system root to the environment */
553 RtlAppendUnicodeToString(&Environment, L"SystemRoot=");
556
557 /* Prepare the prefetcher */
558 //CcPfBeginBootPhase(150);
559
560 /* Create SMSS process */
561 SmssName = ProcessParams->ImagePathName;
562 Status = RtlCreateUserProcess(&SmssName,
564 RtlDeNormalizeProcessParams(ProcessParams),
565 NULL,
566 NULL,
567 NULL,
568 FALSE,
569 NULL,
570 NULL,
571 ProcessInformation);
572 if (!NT_SUCCESS(Status))
573 {
574 /* Failed, display error */
575 _snwprintf(InitBuffer->DebugBuffer,
576 sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
577 L"INIT: Unable to create Session Manager. 0x%lx",
578 Status);
579 RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
581
582 /* Bugcheck the system */
583 KeBugCheckEx(SESSION3_INITIALIZATION_FAILED, Status, 0, 0, 0);
584 }
585
586 /* Resume the thread */
587 Status = ZwResumeThread(ProcessInformation->ThreadHandle, NULL);
588 if (!NT_SUCCESS(Status))
589 {
590 /* Failed, display error */
591 _snwprintf(InitBuffer->DebugBuffer,
592 sizeof(InitBuffer->DebugBuffer)/sizeof(WCHAR),
593 L"INIT: Unable to resume Session Manager. 0x%lx",
594 Status);
595 RtlInitUnicodeString(&DebugString, InitBuffer->DebugBuffer);
597
598 /* Bugcheck the system */
599 KeBugCheckEx(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
600 }
601
602 /* Return success */
603 *ProcessParameters = ProcessParams;
604 *ProcessEnvironment = EnvironmentPtr;
605}
606
607CODE_SEG("INIT")
608ULONG
609NTAPI
611{
612 ULONG MsRemainder = 0, MsIncrement;
613 ULONG IncrementRemainder;
614 ULONG i;
615
616 /* Count the number of milliseconds for each clock interrupt */
617 MsIncrement = ClockIncrement / (10 * 1000);
618
619 /* Count the remainder from the division above, with 24-bit precision */
620 IncrementRemainder = ClockIncrement - (MsIncrement * (10 * 1000));
621 for (i= 0; i < 24; i++)
622 {
623 /* Shift the remainders */
624 MsRemainder <<= 1;
625 IncrementRemainder <<= 1;
626
627 /* Check if we've went past 1 ms */
628 if (IncrementRemainder >= (10 * 1000))
629 {
630 /* Increase the remainder by one, and substract from increment */
631 IncrementRemainder -= (10 * 1000);
632 MsRemainder |= 1;
633 }
634 }
635
636 /* Return the increment */
637 return (MsIncrement << 24) | MsRemainder;
638}
639
640CODE_SEG("INIT")
642NTAPI
644{
645 /* Initialize EXRESOURCE Support */
647
648 /* Initialize the environment lock */
650
651 /* Initialize the lookaside lists and locks */
653
654 /* Initialize the Firmware Table resource and listhead */
658
659 /* Set the suite mask to maximum and return */
660 ExSuiteMask = 0xFFFFFFFF;
661 return TRUE;
662}
663
664CODE_SEG("INIT")
666NTAPI
668{
669 /* Initialize worker threads */
671
672 /* Initialize pushlocks */
674
675 /* Initialize events and event pairs */
677 {
678 DPRINT1("Executive: Event initialization failed\n");
679 return FALSE;
680 }
682 {
683 DPRINT1("Executive: Event Pair initialization failed\n");
684 return FALSE;
685 }
686
687 /* Initialize mutants */
689 {
690 DPRINT1("Executive: Mutant initialization failed\n");
691 return FALSE;
692 }
693
694 /* Initialize callbacks */
696 {
697 DPRINT1("Executive: Callback initialization failed\n");
698 return FALSE;
699 }
700
701 /* Initialize semaphores */
703 {
704 DPRINT1("Executive: Semaphore initialization failed\n");
705 return FALSE;
706 }
707
708 /* Initialize timers */
710 {
711 DPRINT1("Executive: Timer initialization failed\n");
712 return FALSE;
713 }
714
715 /* Initialize profiling */
717 {
718 DPRINT1("Executive: Profile initialization failed\n");
719 return FALSE;
720 }
721
722 /* Initialize UUIDs */
724 {
725 DPRINT1("Executive: Uuid initialization failed\n");
726 return FALSE;
727 }
728
729 /* Initialize keyed events */
731 {
732 DPRINT1("Executive: Keyed event initialization failed\n");
733 return FALSE;
734 }
735
736 /* Initialize Win32K */
737 if (ExpWin32kInit() == FALSE)
738 {
739 DPRINT1("Executive: Win32 initialization failed\n");
740 return FALSE;
741 }
742 return TRUE;
743}
744
745CODE_SEG("INIT")
747NTAPI
749{
750 /* Check the initialization phase */
752 {
753 case 0:
754
755 /* Do Phase 0 */
756 return ExpInitSystemPhase0();
757
758 case 1:
759
760 /* Do Phase 1 */
761 return ExpInitSystemPhase1();
762
763 default:
764
765 /* Don't know any other phase! Bugcheck! */
766 KeBugCheck(UNEXPECTED_INITIALIZATION_CALL);
767 return FALSE;
768 }
769}
770
771CODE_SEG("INIT")
773NTAPI
775{
777
778 /* Get the loader extension */
779 Extension = LoaderBlock->Extension;
780
781 /* Validate the size (Windows 2003 loader doesn't provide more) */
783
784 /* Don't validate upper versions */
785 if (Extension->MajorVersion > VER_PRODUCTMAJORVERSION) return TRUE;
786
787 /* Fail if this is NT 4 */
788 if (Extension->MajorVersion < VER_PRODUCTMAJORVERSION) return FALSE;
789
790 /* Fail if this is XP */
791 if (Extension->MinorVersion < VER_PRODUCTMINORVERSION) return FALSE;
792
793 /* This is 2003 or newer, approve it */
794 return TRUE;
795}
796
797static CODE_SEG("INIT")
798VOID
799ExpLoadBootSymbols(
800 _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
801{
802 PLIST_ENTRY NextEntry;
803 PLDR_DATA_TABLE_ENTRY LdrEntry;
805 ULONG i;
807 PWCHAR Name;
808 STRING ImageName;
809 CHAR NameBuffer[256];
810
811 /* Loop over the boot modules list */
812 for (NextEntry = LoaderBlock->LoadOrderListHead.Flink, i = 0;
813 NextEntry != &LoaderBlock->LoadOrderListHead;
814 NextEntry = NextEntry->Flink, ++i)
815 {
816 /* Skip the first two images: HAL and kernel */
817 if (i < 2)
818 continue;
819
820 /* Get the entry */
821 LdrEntry = CONTAINING_RECORD(NextEntry,
823 InLoadOrderLinks);
824 if (LdrEntry->FullDllName.Buffer[0] == L'\\')
825 {
826 /* We have a name, read its data */
827 Name = LdrEntry->FullDllName.Buffer;
828 Length = LdrEntry->FullDllName.Length / sizeof(WCHAR);
829
830 /* Check if our buffer can hold it */
831 if (sizeof(NameBuffer) < Length + sizeof(ANSI_NULL))
832 {
833 /* It's too long */
835 }
836 else
837 {
838 /* Copy the name */
839 Count = 0;
840 do
841 {
842 /* Do cheap Unicode to ANSI conversion */
843 NameBuffer[Count++] = (CHAR)*Name++;
844 } while (Count < Length);
845
846 /* Null-terminate */
847 NameBuffer[Count] = ANSI_NULL;
849 }
850 }
851 else
852 {
853 /* Safely print the string into our buffer */
854 Status = RtlStringCbPrintfA(NameBuffer,
855 sizeof(NameBuffer),
856 "%S\\System32\\Drivers\\%wZ",
857 &SharedUserData->NtSystemRoot[2],
858 &LdrEntry->BaseDllName);
859 }
860
861 /* Check if the buffer is OK */
862 if (NT_SUCCESS(Status))
863 {
864 /* Load the symbols */
865 RtlInitString(&ImageName, NameBuffer);
866 DbgLoadImageSymbols(&ImageName,
867 LdrEntry->DllBase,
869 }
870
871#ifdef CONFIG_SMP
872 /* Check that the image is safe to use if we have more than one CPU */
873 if (!MmVerifyImageIsOkForMpUse(LdrEntry->DllBase))
874 {
875 KeBugCheckEx(UP_DRIVER_ON_MP_SYSTEM,
876 (ULONG_PTR)LdrEntry->DllBase,
877 0, 0, 0);
878 }
879#endif // CONFIG_SMP
880 }
881}
882
883CODE_SEG("INIT")
884VOID
885NTAPI
887 IN ULONG_PTR PagesToDestroy,
888 IN TYPE_OF_MEMORY MemoryType)
889{
890 PLIST_ENTRY ListEntry;
891 PMEMORY_ALLOCATION_DESCRIPTOR MemDescriptor;
892
893 DPRINT1("Burn RAM amount: %lu pages\n", PagesToDestroy);
894
895 /* Loop the memory descriptors, beginning at the end */
896 for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Blink;
897 ListEntry != &LoaderBlock->MemoryDescriptorListHead;
898 ListEntry = ListEntry->Blink)
899 {
900 /* Get the memory descriptor structure */
901 MemDescriptor = CONTAINING_RECORD(ListEntry,
903 ListEntry);
904
905 /* Is memory free there or is it temporary? */
906 if (MemDescriptor->MemoryType == LoaderFree ||
907 MemDescriptor->MemoryType == LoaderFirmwareTemporary)
908 {
909 /* Check if the descriptor has more pages than we want */
910 if (MemDescriptor->PageCount > PagesToDestroy)
911 {
912 /* Change block's page count, ntoskrnl doesn't care much */
913 MemDescriptor->PageCount -= PagesToDestroy;
914 break;
915 }
916 else
917 {
918 /* Change block type */
919 MemDescriptor->MemoryType = MemoryType;
920 PagesToDestroy -= MemDescriptor->PageCount;
921
922 /* Check if we are done */
923 if (PagesToDestroy == 0) break;
924 }
925 }
926 }
927}
928
929CODE_SEG("INIT")
930VOID
931NTAPI
933 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
934{
935 PNLS_DATA_BLOCK NlsData;
936 CHAR Buffer[256];
937 ANSI_STRING AnsiPath;
939 PCHAR CommandLine, PerfMem;
940 ULONG PerfMemUsed;
941 PLDR_DATA_TABLE_ENTRY NtosEntry;
943 ANSI_STRING CSDString;
944 size_t Remaining = 0;
945 PCHAR RcEnd = NULL;
946 CHAR VersionBuffer[65];
947
948 /* Validate Loader */
949 if (!ExpIsLoaderValid(LoaderBlock))
950 {
951 /* Invalid loader version */
952 KeBugCheckEx(MISMATCHED_HAL,
953 3,
954 LoaderBlock->Extension->Size,
955 LoaderBlock->Extension->MajorVersion,
956 LoaderBlock->Extension->MinorVersion);
957 }
958
959 /* Initialize PRCB pool lookaside pointers */
961
962 /* Check if this is an application CPU */
963 if (Cpu)
964 {
965 /* Then simply initialize it with HAL */
966 if (!HalInitSystem(ExpInitializationPhase, LoaderBlock))
967 {
968 /* Initialization failed */
969 KeBugCheck(HAL_INITIALIZATION_FAILED);
970 }
971
972 /* We're done */
973 return;
974 }
975
976 /* Assume no text-mode or remote boot */
979
980 /* Check if we have a setup loader block */
981 if (LoaderBlock->SetupLdrBlock)
982 {
983 /* Check if this is text-mode setup */
984 if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_TEXT_MODE)
986
987 /* Check if this is network boot */
988 if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_REMOTE_BOOT)
989 {
990 /* Set variable */
992
993 /* Make sure we're actually booting off the network */
994 ASSERT(!_memicmp(LoaderBlock->ArcBootDeviceName, "net(0)", 6));
995 }
996 }
997
998 /* Set phase to 0 */
1000
1001 /* Get boot command line */
1002 CommandLine = LoaderBlock->LoadOptions;
1003 if (CommandLine)
1004 {
1005 /* Upcase it for comparison and check if we're in performance mode */
1006 _strupr(CommandLine);
1007 PerfMem = strstr(CommandLine, "PERFMEM");
1008 if (PerfMem)
1009 {
1010 /* Check if the user gave a number of bytes to use */
1011 PerfMem = strstr(PerfMem, "=");
1012 if (PerfMem)
1013 {
1014 /* Read the number of pages we'll use */
1015 PerfMemUsed = atol(PerfMem + 1) * (1024 * 1024 / PAGE_SIZE);
1016 if (PerfMemUsed)
1017 {
1018 /* FIXME: TODO */
1019 DPRINT1("BBT performance mode not yet supported."
1020 "/PERFMEM option ignored.\n");
1021 }
1022 }
1023 }
1024
1025 /* Check if we're burning memory */
1026 PerfMem = strstr(CommandLine, "BURNMEMORY");
1027 if (PerfMem)
1028 {
1029 /* Check if the user gave a number of bytes to use */
1030 PerfMem = strstr(PerfMem, "=");
1031 if (PerfMem)
1032 {
1033 /* Read the number of pages we'll use */
1034 PerfMemUsed = atol(PerfMem + 1) * (1024 * 1024 / PAGE_SIZE);
1035 if (PerfMemUsed) ExBurnMemory(LoaderBlock, PerfMemUsed, LoaderBad);
1036 }
1037 }
1038 }
1039
1040 /* Setup NLS Base and offsets */
1041 NlsData = LoaderBlock->NlsData;
1045 (ULONG_PTR)NlsData->AnsiCodePageData);
1047 (ULONG_PTR)NlsData->AnsiCodePageData);
1048
1049 /* Initialize the NLS Tables */
1058
1059 /* Now initialize the HAL */
1060 if (!HalInitSystem(ExpInitializationPhase, LoaderBlock))
1061 {
1062 /* HAL failed to initialize, bugcheck */
1063 KeBugCheck(HAL_INITIALIZATION_FAILED);
1064 }
1065
1066 /* Make sure interrupts are active now */
1067 _enable();
1068
1069 /* Clear the crypto exponent */
1070 SharedUserData->CryptoExponent = 0;
1071
1072 /* Set global flags for the checked build */
1073#if DBG
1076#endif
1077
1078 /* Setup NT System Root Path */
1079 sprintf(Buffer, "C:%s", LoaderBlock->NtBootPathName);
1080
1081 /* Convert to ANSI_STRING and null-terminate it */
1082 RtlInitString(&AnsiPath, Buffer);
1083 Buffer[--AnsiPath.Length] = ANSI_NULL;
1084
1085 /* Get the string from KUSER_SHARED_DATA's buffer */
1086 RtlInitEmptyUnicodeString(&NtSystemRoot,
1087 SharedUserData->NtSystemRoot,
1088 sizeof(SharedUserData->NtSystemRoot));
1089
1090 /* Now fill it in */
1092 if (!NT_SUCCESS(Status)) KeBugCheck(SESSION3_INITIALIZATION_FAILED);
1093
1094 /* Setup bugcheck messages */
1096
1097 /* Setup initial system settings */
1098 CmGetSystemControlValues(LoaderBlock->RegistryBase, CmControlVector);
1099
1100 /* Set the Service Pack Number and add it to the CSD Version number if needed */
1102 if (((CmNtCSDVersion & 0xFFFF0000) == 0) && (CmNtCSDReleaseType == 1))
1103 {
1105 }
1106
1107 /* Add loaded CmNtGlobalFlag value */
1109
1110 /* Initialize the executive at phase 0 */
1111 if (!ExInitSystem()) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
1112
1113 /* Initialize the memory manager at phase 0 */
1114 if (!MmArmInitSystem(0, LoaderBlock)) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
1115
1116 /* Load boot symbols */
1117 ExpLoadBootSymbols(LoaderBlock);
1118
1119 /* Check if we should break after symbol load */
1122
1123 /* Check if this loader is compatible with NT 5.2 */
1124 if (LoaderBlock->Extension->Size >= sizeof(LOADER_PARAMETER_EXTENSION))
1125 {
1126 /* Setup headless terminal settings */
1127 HeadlessInit(LoaderBlock);
1128 }
1129
1130 /* Set system ranges */
1131#ifdef _M_AMD64
1134#else
1137#endif
1138
1139 /* Make a copy of the NLS Tables */
1140 ExpInitNls(LoaderBlock);
1141
1142 /* Get the kernel's load entry */
1143 NtosEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink,
1145 InLoadOrderLinks);
1146
1147 /* Check if this is a service pack */
1148 if (CmNtCSDVersion & 0xFFFF)
1149 {
1150 /* Get the service pack string */
1151 Status = RtlFindMessage(NtosEntry->DllBase,
1154 WINDOWS_NT_CSD_STRING,
1155 &MsgEntry);
1156 if (NT_SUCCESS(Status))
1157 {
1158 /* Setup the string */
1159 RtlInitAnsiString(&CSDString, (PCHAR)MsgEntry->Text);
1160
1161 /* Remove trailing newline */
1162 while ((CSDString.Length > 0) &&
1163 ((CSDString.Buffer[CSDString.Length - 1] == '\r') ||
1164 (CSDString.Buffer[CSDString.Length - 1] == '\n')))
1165 {
1166 /* Skip the trailing character */
1167 CSDString.Length--;
1168 }
1169
1170 /* Fill the buffer with version information */
1172 sizeof(Buffer),
1173 "%Z %u%c",
1174 &CSDString,
1175 (CmNtCSDVersion & 0xFF00) >> 8,
1176 (CmNtCSDVersion & 0xFF) ?
1177 'A' + (CmNtCSDVersion & 0xFF) - 1 :
1178 ANSI_NULL);
1179 }
1180 else
1181 {
1182 /* Build default string */
1184 sizeof(Buffer),
1185 "CSD %04x",
1187 }
1188
1189 /* Check for success */
1190 if (!NT_SUCCESS(Status))
1191 {
1192 /* Fail */
1193 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1194 }
1195 }
1196 else
1197 {
1198 /* Then this is a beta */
1200 sizeof(Buffer),
1202 NULL,
1203 &Remaining,
1204 0);
1205 if (!NT_SUCCESS(Status))
1206 {
1207 /* Fail */
1208 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1209 }
1210
1211 /* Update length */
1212 CmCSDVersionString.MaximumLength = sizeof(Buffer) - (USHORT)Remaining;
1213 }
1214
1215 /* Check if we have an RC number */
1216 if ((CmNtCSDVersion & 0xFFFF0000) && (CmNtCSDReleaseType == 1))
1217 {
1218 /* Check if we have no version data yet */
1219 if (!(*Buffer))
1220 {
1221 /* Set defaults */
1222 Remaining = sizeof(Buffer);
1223 RcEnd = Buffer;
1224 }
1225 else
1226 {
1227 /* Add comma and space */
1229 sizeof(Buffer),
1230 ", ",
1231 &RcEnd,
1232 &Remaining,
1233 0);
1234 if (!NT_SUCCESS(Status))
1235 {
1236 /* Fail */
1237 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1238 }
1239 }
1240
1241 /* Add the version format string */
1242 Status = RtlStringCbPrintfA(RcEnd,
1243 Remaining,
1244 "v.%u",
1245 (CmNtCSDVersion & 0xFFFF0000) >> 16);
1246 if (!NT_SUCCESS(Status))
1247 {
1248 /* Fail */
1249 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1250 }
1251 }
1252
1253 /* Now setup the final string */
1254 RtlInitAnsiString(&CSDString, Buffer);
1256 &CSDString,
1257 TRUE);
1258 if (!NT_SUCCESS(Status))
1259 {
1260 /* Fail */
1261 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1262 }
1263
1264 /* Add our version */
1265 Status = RtlStringCbPrintfA(VersionBuffer,
1266 sizeof(VersionBuffer),
1267 "%u.%u",
1270 if (!NT_SUCCESS(Status))
1271 {
1272 /* Fail */
1273 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1274 }
1275
1276 /* Build the final version string */
1278
1279 /* Check if the user wants a kernel stack trace database */
1281 {
1282 /* FIXME: TODO */
1283 DPRINT1("Kernel-mode stack trace support not yet present."
1284 "FLG_KERNEL_STACK_TRACE_DB flag ignored.\n");
1285 }
1286
1287 /* Check if he wanted exception logging */
1289 {
1290 /* FIXME: TODO */
1291 DPRINT1("Kernel-mode exception logging support not yet present."
1292 "FLG_ENABLE_EXCEPTION_LOGGING flag ignored.\n");
1293 }
1294
1295 /* Initialize the Handle Table */
1297
1298#if DBG
1299 /* On checked builds, allocate the system call count table */
1302 KiServiceLimit * sizeof(ULONG),
1303 'llaC');
1304
1305 /* Use it for the shadow table too */
1307
1308 /* Make sure allocation succeeded */
1310 {
1311 /* Zero the call counts to 0 */
1313 KiServiceLimit * sizeof(ULONG));
1314 }
1315#endif
1316
1317 /* Create the Basic Object Manager Types to allow new Object Types */
1318 if (!ObInitSystem()) KeBugCheck(OBJECT_INITIALIZATION_FAILED);
1319
1320 /* Load basic Security for other Managers */
1321 if (!SeInitSystem()) KeBugCheck(SECURITY_INITIALIZATION_FAILED);
1322
1323 /* Initialize the Process Manager */
1324 if (!PsInitSystem(LoaderBlock)) KeBugCheck(PROCESS_INITIALIZATION_FAILED);
1325
1326 /* Initialize the PnP Manager */
1327 if (!PpInitSystem()) KeBugCheck(PP0_INITIALIZATION_FAILED);
1328
1329 /* Initialize the User-Mode Debugging Subsystem */
1331
1332 /* Calculate the tick count multiplier */
1334 SharedUserData->TickCountMultiplier = ExpTickCountMultiplier;
1335
1336 /* Set the OS Version */
1337 SharedUserData->NtMajorVersion = NtMajorVersion;
1338 SharedUserData->NtMinorVersion = NtMinorVersion;
1339
1340 /* Set the machine type */
1341 SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_NATIVE;
1342 SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_NATIVE;
1343
1344 /* ReactOS magic */
1345 *(PULONG)(KI_USER_SHARED_DATA + PAGE_SIZE - sizeof(ULONG)) = 0x8eac705;
1346}
1347
1348VOID
1349NTAPI
1351
1352CODE_SEG("INIT")
1353VOID
1354NTAPI
1356{
1357 PLOADER_PARAMETER_BLOCK LoaderBlock = Context;
1358 NTSTATUS Status, MsgStatus;
1360 LARGE_INTEGER SystemBootTime, UniversalBootTime, OldTime, Timeout;
1361 BOOLEAN NoGuiBoot, ResetBias = FALSE, AlternateShell = FALSE;
1362 PLDR_DATA_TABLE_ENTRY NtosEntry;
1363 PMESSAGE_RESOURCE_ENTRY MsgEntry;
1364 PCHAR CommandLine, Y2KHackRequired, SafeBoot, Environment;
1365 PCHAR StringBuffer, EndBuffer, BeginBuffer, MpString = "";
1366 PINIT_BUFFER InitBuffer;
1367 ANSI_STRING TempString;
1368 ULONG LastTzBias, Length, YearHack = 0, Disposition, MessageCode = 0;
1369 SIZE_T Size;
1370 size_t Remaining;
1372 KEY_VALUE_PARTIAL_INFORMATION KeyPartialInfo;
1375 HANDLE KeyHandle, OptionHandle;
1376 PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL;
1377
1378 /* Allocate the initialization buffer */
1380 sizeof(INIT_BUFFER),
1381 TAG_INIT);
1382 if (!InitBuffer)
1383 {
1384 /* Bugcheck */
1385 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, STATUS_NO_MEMORY, 8, 0, 0);
1386 }
1387
1388 /* Set to phase 1 */
1390
1391 /* Set us at maximum priority */
1393
1394 /* Do Phase 1 HAL Initialization */
1395 if (!HalInitSystem(1, LoaderBlock)) KeBugCheck(HAL1_INITIALIZATION_FAILED);
1396
1397 /* Get the command line and upcase it */
1398 CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
1399
1400 /* Check if GUI Boot is enabled */
1401 NoGuiBoot = (CommandLine && strstr(CommandLine, "NOGUIBOOT") != NULL);
1402
1403 /* Get the SOS setting */
1404 SosEnabled = (CommandLine && strstr(CommandLine, "SOS") != NULL);
1405
1406 /* Setup the boot video driver */
1407 InbvEnableBootDriver(!NoGuiBoot);
1409
1410 /* Check if GUI boot is enabled */
1411 if (!NoGuiBoot)
1412 {
1413 /* It is, display the boot logo and enable printing strings */
1416 }
1417 else
1418 {
1419 /* Release display ownership if not using GUI boot */
1421
1422 /* Don't allow boot-time strings */
1424 }
1425
1426 /* Check if this is LiveCD (WinPE) mode */
1427 if (CommandLine && strstr(CommandLine, "MININT") != NULL)
1428 {
1429 /* Setup WinPE Settings */
1431 InitWinPEModeType |= (strstr(CommandLine, "INRAM") != NULL) ? 0x80000000 : 0x00000001;
1432 }
1433
1434 /* Get the kernel's load entry */
1435 NtosEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink,
1437 InLoadOrderLinks);
1438
1439 /* Find the banner message */
1440 MsgStatus = RtlFindMessage(NtosEntry->DllBase,
1443 WINDOWS_NT_BANNER,
1444 &MsgEntry);
1445
1446 /* Setup defaults and check if we have a version string */
1447 StringBuffer = InitBuffer->VersionBuffer;
1448 BeginBuffer = StringBuffer;
1449 EndBuffer = StringBuffer;
1450 Remaining = sizeof(InitBuffer->VersionBuffer);
1452 {
1453 /* Print the version string */
1455 Remaining,
1456 &EndBuffer,
1457 &Remaining,
1458 0,
1459 ": %wZ",
1461 if (!NT_SUCCESS(Status))
1462 {
1463 /* Bugcheck */
1464 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 7, 0, 0);
1465 }
1466 }
1467 else
1468 {
1469 /* No version */
1470 *EndBuffer = ANSI_NULL; /* Null-terminate the string */
1471 }
1472
1473 /* Skip over the null-terminator to start a new string */
1474 ++EndBuffer;
1475 --Remaining;
1476
1477 /* Build the version number */
1478 StringBuffer = InitBuffer->VersionNumber;
1480 sizeof(InitBuffer->VersionNumber),
1481 "%u.%u",
1484 if (!NT_SUCCESS(Status))
1485 {
1486 /* Bugcheck */
1487 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 7, 0, 0);
1488 }
1489
1490 /* Check if we had found a banner message */
1491 if (NT_SUCCESS(MsgStatus))
1492 {
1493 /* Create the banner message */
1494 /* ReactOS specific: Report ReactOS version, NtBuildLab information and reported NT kernel version */
1495 Status = RtlStringCbPrintfA(EndBuffer,
1496 Remaining,
1497 (PCHAR)MsgEntry->Text,
1498 KERNEL_VERSION_STR,
1499 NtBuildLab,
1501 NtBuildNumber & 0xFFFF,
1502 BeginBuffer);
1503 if (!NT_SUCCESS(Status))
1504 {
1505 /* Bugcheck */
1506 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 7, 0, 0);
1507 }
1508 }
1509 else
1510 {
1511 /* Use hard-coded banner message */
1512 Status = RtlStringCbCopyA(EndBuffer, Remaining, "REACTOS (R)\r\n");
1513 if (!NT_SUCCESS(Status))
1514 {
1515 /* Bugcheck */
1516 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 7, 0, 0);
1517 }
1518 }
1519
1520 /* Display the version string on-screen */
1521 InbvDisplayString(EndBuffer);
1522
1523 /* Initialize Power Subsystem in Phase 0 */
1524 if (!PoInitSystem(0)) KeBugCheck(INTERNAL_POWER_ERROR);
1525
1526 /* Check for Y2K hack */
1527 Y2KHackRequired = CommandLine ? strstr(CommandLine, "YEAR") : NULL;
1528 if (Y2KHackRequired) Y2KHackRequired = strstr(Y2KHackRequired, "=");
1529 if (Y2KHackRequired) YearHack = atol(Y2KHackRequired + 1);
1530
1531 /* Query the clock */
1533 {
1534 /* Check if we're using the Y2K hack */
1535 if (Y2KHackRequired) TimeFields.Year = (CSHORT)YearHack;
1536
1537 /* Convert to time fields */
1538 RtlTimeFieldsToTime(&TimeFields, &SystemBootTime);
1539 UniversalBootTime = SystemBootTime;
1540
1541 /* Check if real time is GMT */
1543 {
1544 /* Check if we don't have a valid bias */
1546 {
1547 /* Reset */
1548 ResetBias = TRUE;
1550 }
1551
1552 /* Calculate the bias in seconds */
1554 10000000);
1555
1556 /* Set the boot time-zone bias */
1558
1559 /* Convert the boot time to local time, and set it */
1560 UniversalBootTime.QuadPart = SystemBootTime.QuadPart +
1562 }
1563
1564 /* Update the system time and notify the system */
1565 KeSetSystemTime(&UniversalBootTime, &OldTime, FALSE, NULL);
1567
1568 /* Remember this as the boot time */
1569 KeBootTime = UniversalBootTime;
1570 KeBootTimeBias = 0;
1571 }
1572
1573#ifdef CONFIG_SMP
1574 /*
1575 * IMPORTANT NOTE:
1576 * Because ReactOS is a "nice" OS, we do not care _at all_
1577 * about any number of registered/licensed processors:
1578 * no usage of KeRegisteredProcessors nor KeLicensedProcessors.
1579 */
1580 if (CommandLine)
1581 {
1582 PSTR Option;
1583
1584 /* Check for NUMPROC: maximum number of logical processors
1585 * that can be started (including dynamically) at run-time */
1586 Option = strstr(CommandLine, "NUMPROC");
1587 if (Option) Option = strstr(Option, "=");
1588 if (Option) KeNumprocSpecified = atol(Option + 1);
1589
1590 /* Check for BOOTPROC (NT6+ and ReactOS): maximum number
1591 * of logical processors that can be started at boot-time */
1592 Option = strstr(CommandLine, "BOOTPROC");
1593 if (Option) Option = strstr(Option, "=");
1594 if (Option) KeBootprocSpecified = atol(Option + 1);
1595
1596 /* Check for MAXPROC (NT6+ and ReactOS): forces the kernel to report
1597 * as existing the maximum number of processors that can be handled */
1598 if (strstr(CommandLine, "MAXPROC"))
1599 KeMaximumProcessors = MAXIMUM_PROCESSORS;
1600 }
1601
1602 /* Start Application Processors */
1604#endif
1605
1606 /* Initialize all processors */
1607 if (!HalAllProcessorsStarted()) KeBugCheck(HAL1_INITIALIZATION_FAILED);
1608
1609#ifdef CONFIG_SMP
1610 /* HACK: We should use RtlFindMessage and not only fallback to this */
1611 MpString = "MultiProcessor Kernel\r\n";
1612#endif
1613
1614 /* Setup the "MP" String */
1615 RtlInitAnsiString(&TempString, MpString);
1616
1617 /* Make sure to remove the \r\n if we actually have a string */
1618 while ((TempString.Length > 0) &&
1619 ((TempString.Buffer[TempString.Length - 1] == '\r') ||
1620 (TempString.Buffer[TempString.Length - 1] == '\n')))
1621 {
1622 /* Skip the trailing character */
1623 TempString.Length--;
1624 }
1625
1626 /* Get the information string from our resource file */
1627 MsgStatus = RtlFindMessage(NtosEntry->DllBase,
1630 KeNumberProcessors > 1 ?
1631 WINDOWS_NT_INFO_STRING_PLURAL :
1632 WINDOWS_NT_INFO_STRING,
1633 &MsgEntry);
1634
1635 /* Get total RAM size, in MiB */
1636 /* Round size up. Assumed to better match actual physical RAM size */
1637 Size = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
1638
1639 /* Create the string */
1640 StringBuffer = InitBuffer->VersionBuffer;
1642 sizeof(InitBuffer->VersionBuffer),
1643 NT_SUCCESS(MsgStatus) ?
1644 (PCHAR)MsgEntry->Text :
1645 "%u System Processor [%Iu MB Memory] %Z\r\n",
1647 Size,
1648 &TempString);
1649 if (!NT_SUCCESS(Status))
1650 {
1651 /* Bugcheck */
1652 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 4, 0, 0);
1653 }
1654
1655 /* Display RAM and CPU count */
1657
1658 /* Update the progress bar */
1660
1661 /* Call OB initialization again */
1662 if (!ObInitSystem()) KeBugCheck(OBJECT1_INITIALIZATION_FAILED);
1663
1664 /* Initialize Basic System Objects and Worker Threads */
1665 if (!ExInitSystem()) KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 0, 0, 1, 0);
1666
1667 /* Initialize the later stages of the kernel */
1668 if (!KeInitSystem()) KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 0, 0, 2, 0);
1669
1670 /* Call KD Providers at Phase 1 */
1672 {
1673 /* Failed, bugcheck */
1674 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 0, 0, 3, 0);
1675 }
1676
1677 /* Initialize the SRM in Phase 1 */
1678 if (!SeInitSystem()) KeBugCheck(SECURITY1_INITIALIZATION_FAILED);
1679
1680 /* Update the progress bar */
1682
1683 /* Create SystemRoot Link */
1684 Status = ExpCreateSystemRootLink(LoaderBlock);
1685 if (!NT_SUCCESS(Status))
1686 {
1687 /* Failed to create the system root link */
1688 KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 0, 0, 0);
1689 }
1690
1691 /* Set up Region Maps, Sections and the Paging File */
1692 if (!MmInitSystem(1, LoaderBlock)) KeBugCheck(MEMORY1_INITIALIZATION_FAILED);
1693
1694 /* Create NLS section */
1695 ExpInitNls(LoaderBlock);
1696
1697 /* Initialize the Rtl locale table */
1699
1700 /* Initialize Cache Views */
1701 if (!CcInitializeCacheManager()) KeBugCheck(CACHE_INITIALIZATION_FAILED);
1702
1703 /* Initialize the Registry */
1704 if (!CmInitSystem1()) KeBugCheck(CONFIG_INITIALIZATION_FAILED);
1705
1706 /* Initialize Prefetcher */
1708
1709 /* Update progress bar */
1711
1712 /* Update timezone information */
1713 LastTzBias = ExpLastTimeZoneBias;
1714 ExRefreshTimeZoneInformation(&SystemBootTime);
1715
1716 /* Check if we're resetting timezone data */
1717 if (ResetBias)
1718 {
1719 /* Convert the local time to system time */
1720 ExLocalTimeToSystemTime(&SystemBootTime, &UniversalBootTime);
1721 KeBootTime = UniversalBootTime;
1722 KeBootTimeBias = 0;
1723
1724 /* Set the new time */
1725 KeSetSystemTime(&UniversalBootTime, &OldTime, FALSE, NULL);
1726 }
1727 else
1728 {
1729 /* Check if the timezone switched and update the time */
1730 if (LastTzBias != ExpLastTimeZoneBias)
1732 }
1733
1734 /* Initialize the File System Runtime Library */
1735 if (!FsRtlInitSystem()) KeBugCheck(FILE_INITIALIZATION_FAILED);
1736
1737 /* Initialize range lists */
1739
1740 /* Report all resources used by HAL */
1742
1743 /* Call the debugger DLL */
1744 KdDebuggerInitialize1(LoaderBlock);
1745
1746 /* Setup PnP Manager in phase 1 */
1747 if (!PpInitSystem()) KeBugCheck(PP1_INITIALIZATION_FAILED);
1748
1749 /* Update progress bar */
1751
1752 /* Initialize LPC */
1753 if (!LpcInitSystem()) KeBugCheck(LPC_INITIALIZATION_FAILED);
1754
1755 /* Make sure we have a command line */
1756 if (CommandLine)
1757 {
1758 /* Check if this is a safe mode boot */
1759 SafeBoot = strstr(CommandLine, "SAFEBOOT:");
1760 if (SafeBoot)
1761 {
1762 /* Check what kind of boot this is */
1763 SafeBoot += 9;
1764 if (!strncmp(SafeBoot, "MINIMAL", 7))
1765 {
1766 /* Minimal mode */
1767 InitSafeBootMode = 1;
1768 SafeBoot += 7;
1769 MessageCode = BOOTING_IN_SAFEMODE_MINIMAL;
1770 }
1771 else if (!strncmp(SafeBoot, "NETWORK", 7))
1772 {
1773 /* With Networking */
1774 InitSafeBootMode = 2;
1775 SafeBoot += 7;
1776 MessageCode = BOOTING_IN_SAFEMODE_NETWORK;
1777 }
1778 else if (!strncmp(SafeBoot, "DSREPAIR", 8))
1779 {
1780 /* Domain Server Repair */
1781 InitSafeBootMode = 3;
1782 SafeBoot += 8;
1783 MessageCode = BOOTING_IN_SAFEMODE_DSREPAIR;
1784
1785 }
1786 else
1787 {
1788 /* Invalid */
1789 InitSafeBootMode = 0;
1790 }
1791
1792 /* Check if there's any settings left */
1793 if (*SafeBoot)
1794 {
1795 /* Check if an alternate shell was requested */
1796 if (!strncmp(SafeBoot, "(ALTERNATESHELL)", 16))
1797 {
1798 /* Remember this for later */
1799 AlternateShell = TRUE;
1800 }
1801 }
1802
1803 /* Find the message to print out */
1804 Status = RtlFindMessage(NtosEntry->DllBase,
1807 MessageCode,
1808 &MsgEntry);
1809 if (NT_SUCCESS(Status))
1810 {
1811 /* Display it */
1812 InbvDisplayString((PCSTR)MsgEntry->Text);
1813 }
1814 }
1815 }
1816
1817 /* Make sure we have a command line */
1818 if (CommandLine)
1819 {
1820 /* Check if bootlogging is enabled */
1821 if (strstr(CommandLine, "BOOTLOG"))
1822 {
1823 /* Find the message to print out */
1824 Status = RtlFindMessage(NtosEntry->DllBase,
1827 BOOTLOG_ENABLED,
1828 &MsgEntry);
1829 if (NT_SUCCESS(Status))
1830 {
1831 /* Display it */
1832 InbvDisplayString((PCSTR)MsgEntry->Text);
1833 }
1834
1835 /* Setup boot logging */
1836 //IopInitializeBootLogging(LoaderBlock, InitBuffer->BootlogHeader);
1837 }
1838 }
1839
1840 /* Setup the Executive in Phase 2 */
1841 //ExInitSystemPhase2();
1842
1843 /* Update progress bar */
1845
1846 /* No KD Time Slip is pending */
1848
1849 /* Initialize in-place execution support */
1850 XIPInit(LoaderBlock);
1851
1852 /* Set maximum update to 75% */
1854
1855 /* Initialize the I/O Subsystem */
1856 if (!IoInitSystem(LoaderBlock)) KeBugCheck(IO1_INITIALIZATION_FAILED);
1857
1858 /* Set maximum update to 100% */
1860
1861 /* Are we in safe mode? */
1862 if (InitSafeBootMode)
1863 {
1864 /* Open the safe boot key */
1866 L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET"
1867 L"\\CONTROL\\SAFEBOOT");
1869 &KeyName,
1871 NULL,
1872 NULL);
1874 if (NT_SUCCESS(Status))
1875 {
1876 /* First check if we have an alternate shell */
1877 if (AlternateShell)
1878 {
1879 /* Make sure that the registry has one setup */
1880 RtlInitUnicodeString(&KeyName, L"AlternateShell");
1882 &KeyName,
1884 &KeyPartialInfo,
1885 sizeof(KeyPartialInfo),
1886 &Length);
1888 {
1889 AlternateShell = FALSE;
1890 }
1891 }
1892
1893 /* Create the option key */
1894 RtlInitUnicodeString(&KeyName, L"Option");
1896 &KeyName,
1898 KeyHandle,
1899 NULL);
1900 Status = ZwCreateKey(&OptionHandle,
1903 0,
1904 NULL,
1906 &Disposition);
1908
1909 /* Check if the key create worked */
1910 if (NT_SUCCESS(Status))
1911 {
1912 /* Write the safe boot type */
1913 RtlInitUnicodeString(&KeyName, L"OptionValue");
1914 NtSetValueKey(OptionHandle,
1915 &KeyName,
1916 0,
1917 REG_DWORD,
1919 sizeof(InitSafeBootMode));
1920
1921 /* Check if we have to use an alternate shell */
1922 if (AlternateShell)
1923 {
1924 /* Remember this for later */
1925 Disposition = TRUE;
1926 RtlInitUnicodeString(&KeyName, L"UseAlternateShell");
1927 NtSetValueKey(OptionHandle,
1928 &KeyName,
1929 0,
1930 REG_DWORD,
1931 &Disposition,
1932 sizeof(Disposition));
1933 }
1934
1935 /* Close the options key handle */
1936 NtClose(OptionHandle);
1937 }
1938 }
1939 }
1940
1941 /* Are we in Win PE mode? */
1942 if (InitIsWinPEMode)
1943 {
1944 /* Open the safe control key */
1946 L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET"
1947 L"\\CONTROL");
1949 &KeyName,
1951 NULL,
1952 NULL);
1954 if (!NT_SUCCESS(Status))
1955 {
1956 /* Bugcheck */
1957 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 6, 0, 0);
1958 }
1959
1960 /* Create the MiniNT key */
1961 RtlInitUnicodeString(&KeyName, L"MiniNT");
1963 &KeyName,
1965 KeyHandle,
1966 NULL);
1967 Status = ZwCreateKey(&OptionHandle,
1970 0,
1971 NULL,
1973 &Disposition);
1974 if (!NT_SUCCESS(Status))
1975 {
1976 /* Bugcheck */
1977 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 6, 0, 0);
1978 }
1979
1980 /* Close the handles */
1982 NtClose(OptionHandle);
1983 }
1984
1985 /* FIXME: This doesn't do anything for now */
1986 MmArmInitSystem(2, LoaderBlock);
1987
1988 /* Update progress bar */
1990
1991 /* Initialize VDM support */
1992#if defined(_M_IX86)
1994#endif
1995
1996 /* Initialize Power Subsystem in Phase 1*/
1997 if (!PoInitSystem(1)) KeBugCheck(INTERNAL_POWER_ERROR);
1998
1999 /* Update progress bar */
2001
2002 /* Initialize the Process Manager at Phase 1 */
2003 if (!PsInitSystem(LoaderBlock)) KeBugCheck(PROCESS1_INITIALIZATION_FAILED);
2004
2005 /* Make sure nobody touches the loader block again */
2006 if (LoaderBlock == KeLoaderBlock) KeLoaderBlock = NULL;
2007 MmFreeLoaderBlock(LoaderBlock);
2008 LoaderBlock = Context = NULL;
2009
2010 /* Initialize the SRM in phase 1 */
2011 if (!SeRmInitPhase1()) KeBugCheck(PROCESS1_INITIALIZATION_FAILED);
2012
2013 /* Update progress bar */
2015
2016 /* Clear the screen */
2018
2019 /* Allow strings to be displayed */
2021
2022 /* Launch initial process */
2023 ProcessInfo = &InitBuffer->ProcessInfo;
2024 ExpLoadInitialProcess(InitBuffer, &ProcessParameters, &Environment);
2025
2026 /* Wait 5 seconds for initial process to initialize */
2027 Timeout.QuadPart = Int32x32To64(5, -10000000);
2029 if (Status == STATUS_SUCCESS)
2030 {
2031 /* Failed, display error */
2032 DPRINT1("INIT: Session Manager terminated.\n");
2033
2034 /* Bugcheck the system if SMSS couldn't initialize */
2035 KeBugCheck(SESSION5_INITIALIZATION_FAILED);
2036 }
2037
2038 /* Close process handles */
2039 ZwClose(ProcessInfo->ThreadHandle);
2040 ZwClose(ProcessInfo->ProcessHandle);
2041
2042 /* Free the initial process environment */
2043 Size = 0;
2044 ZwFreeVirtualMemory(NtCurrentProcess(),
2045 (PVOID*)&Environment,
2046 &Size,
2047 MEM_RELEASE);
2048
2049 /* Free the initial process parameters */
2050 Size = 0;
2051 ZwFreeVirtualMemory(NtCurrentProcess(),
2052 (PVOID*)&ProcessParameters,
2053 &Size,
2054 MEM_RELEASE);
2055
2056 /* Increase init phase */
2058
2059 /* Free the boot buffer */
2060 ExFreePoolWithTag(InitBuffer, TAG_INIT);
2061}
2062
2063VOID
2064NTAPI
2066{
2067 /* Do the .INIT part of Phase 1 which we can free later */
2069
2070 /* Jump into zero page thread */
2072}
#define CODE_SEG(...)
#define ALIGN_UP_BY(size, align)
unsigned char BOOLEAN
Definition: actypes.h:127
#define REG_SZ
Definition: layer.c:22
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define CHAR(Char)
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: debug.c:485
PVOID MmHighestUserAddress
Definition: libsupp.c:23
static CCHAR DebugString[256]
Definition: settings.c:16
VOID NTAPI FinalizeBootLogo(VOID)
Definition: bootanim.c:799
VOID NTAPI DisplayBootBitmap(_In_ BOOLEAN TextMode)
Definition: bootanim.c:507
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1434
_In_z_ PCHAR TargetString
Definition: cdrom.h:954
Definition: bufpool.h:45
CM_SYSTEM_CONTROL_VECTOR CmControlVector[]
VOID NTAPI CmGetSystemControlValues(IN PVOID SystemHiveData, IN PCM_SYSTEM_CONTROL_VECTOR ControlVector)
Definition: cmcontrl.c:104
ULONG CmNtGlobalFlag
Definition: cmdata.c:19
BOOLEAN NTAPI CmInitSystem1(VOID)
Definition: cmsysini.c:1642
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
VOID NTAPI DbgkInitialize(VOID)
Definition: dbgkobj.c:1498
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
_ACRTIMP int __cdecl _snwprintf(wchar_t *, size_t, const wchar_t *,...)
Definition: wcs.c:1498
_ACRTIMP int __cdecl _memicmp(const void *, const void *, size_t)
Definition: string.c:3490
_ACRTIMP __msvcrt_long __cdecl atol(const char *)
Definition: string.c:1787
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3420
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
#define ExLocalTimeToSystemTime(LocTime, SysTime)
Definition: env_spec_w32.h:738
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define PAGE_SIZE
Definition: env_spec_w32.h:49
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
BOOLEAN NTAPI ExpInitializeEventPairImplementation(VOID)
Definition: evtpair.c:33
BOOLEAN NTAPI ExpInitializeKeyedEventImplementation(VOID)
#define MAXIMUM_PROCESSORS
Definition: rwlock.h:5
NTSYSAPI NTSTATUS NTAPI ZwWaitForSingleObject(_In_ HANDLE Handle, _In_ BOOLEAN Alertable, _In_opt_ PLARGE_INTEGER Timeout)
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
std::wstring STRING
Definition: fontsub.cpp:33
BOOLEAN NTAPI FsRtlInitSystem(VOID)
Definition: fsrtlpc.c:161
BOOLEAN NTAPI CcInitializeCacheManager(VOID)
Definition: fssup.c:83
VOID NTAPI CcPfInitializePrefetcher(VOID)
Definition: fssup.c:114
Status
Definition: gdiplustypes.h:24
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOLEAN NTAPI HalAllProcessorsStarted(VOID)
Definition: processor.c:60
VOID NTAPI HalReportResourceUsage(VOID)
Definition: usage.c:67
#define KeGetCurrentThread
Definition: hal.h:55
BOOLEAN NTAPI HalInitSystem(_In_ ULONG BootPhase, _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: halinit.c:45
VOID NTAPI HeadlessInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: hdlsterm.c:189
#define VER_PRODUCTBETA_STR
Definition: ieverp.h:10
#define VER_PRODUCTBUILD
Definition: ieverp.h:6
VOID NTAPI InbvNotifyDisplayOwnershipLost(_In_ INBV_RESET_DISPLAY_PARAMETERS Callback)
Definition: inbv.c:410
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:39
VOID NTAPI InbvEnableBootDriver(_In_ BOOLEAN Enable)
Definition: inbv.c:261
VOID NTAPI InbvSetProgressBarSubset(_In_ ULONG Floor, _In_ ULONG Ceiling)
Specifies a progress percentage sub-range. Further calls to InbvIndicateProgress() or InbvUpdateProgr...
Definition: inbv.c:670
BOOLEAN NTAPI InbvEnableDisplayString(_In_ BOOLEAN Enable)
Definition: inbv.c:376
BOOLEAN NTAPI InbvDriverInitialize(_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ ULONG Count)
Definition: inbv.c:179
VOID NTAPI InbvUpdateProgressBar(_In_ ULONG Percentage)
Updates the progress bar percentage, relative to the current percentage sub-range previously set by I...
Definition: inbv.c:696
BOOLEAN NTAPI InbvDisplayString(_In_ PCSTR String)
Definition: inbv.c:335
#define FLG_KERNEL_STACK_TRACE_DB
Definition: pstypes.h:63
#define FLG_ENABLE_EXCEPTION_LOGGING
Definition: pstypes.h:77
#define FLG_ENABLE_CLOSE_EXCEPTIONS
Definition: pstypes.h:76
#define FLG_ENABLE_KDEBUG_SYMBOL_LOAD
Definition: pstypes.h:68
#define HIGH_PRIORITY
VOID ExpInitLookasideLists()
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:164
BOOLEAN KdBreakAfterSymbolLoad
Definition: kddata.c:79
LONG KdpTimeSlipPending
Definition: kddata.c:118
NTSTATUS NTAPI KdDebuggerInitialize1(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
Definition: kdcom.c:236
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
VOID NTAPI ExInitPoolLookasidePointers(VOID)
Definition: lookas.c:59
BOOLEAN NTAPI LpcInitSystem(VOID)
Definition: port.c:37
#define PCHAR
Definition: match.c:90
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:47
#define sprintf
Definition: sprintf.c:45
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
static PTIME_FIELDS TimeFields
Definition: time.c:36
BOOLEAN NTAPI ExpInitializeMutantImplementation(VOID)
Definition: mutant.c:52
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
NTSYSAPI NTSTATUS NTAPI ZwDisplayString(_In_ PUNICODE_STRING DisplayString)
#define KernelMode
Definition: asm.h:38
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
NTSYSAPI NTSTATUS NTAPI ZwSetSystemTime(_In_ PLARGE_INTEGER SystemTime, _In_opt_ PLARGE_INTEGER NewSystemTime)
FORCEINLINE VOID KiWriteSystemTime(_Out_ volatile KSYSTEM_TIME *SystemTime, _In_ LARGE_INTEGER NewTime)
Definition: kefuncs.h:429
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER SectionOffset
Definition: mmfuncs.h:411
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:412
#define SEC_COMMIT
Definition: mmtypes.h:100
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI ZwResumeThread(_In_ HANDLE ThreadHandle, _Out_opt_ PULONG SuspendCount)
NTSYSAPI VOID NTAPI RtlInitNlsTables(_In_ PUSHORT AnsiTableBase, _In_ PUSHORT OemTableBase, _In_ PUSHORT CaseTableBase, _Out_ PNLSTABLEINFO NlsTable)
NTSYSAPI VOID NTAPI RtlResetRtlTranslations(_In_ PNLSTABLEINFO NlsTable)
NTSYSAPI NTSTATUS NTAPI RtlCreateUserProcess(_In_ PUNICODE_STRING ImageFileName, _In_ ULONG Attributes, _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters, _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor, _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor, _In_opt_ HANDLE ParentProcess, _In_ BOOLEAN CurrentDirectory, _In_opt_ HANDLE DebugPort, _In_opt_ HANDLE ExceptionPort, _Out_ PRTL_USER_PROCESS_INFORMATION ProcessInfo)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI NTSTATUS NTAPI RtlFindMessage(_In_ PVOID BaseAddress, _In_ ULONG Type, _In_ ULONG Language, _In_ ULONG MessageId, _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry)
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlDeNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
VOID NTAPI DbgLoadImageSymbols(_In_ PSTRING Name, _In_ PVOID Base, _In_ ULONG_PTR ProcessId)
#define RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB
Definition: rtltypes.h:46
#define RTL_USER_PROCESS_PARAMETERS_NORMALIZED
Definition: rtltypes.h:41
#define _In_
Definition: no_sal2.h:158
int Count
Definition: noreturn.cpp:7
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define SYMBOLIC_LINK_ALL_ACCESS
Definition: nt_native.h:1270
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
@ KeyValuePartialInformation
Definition: nt_native.h:1185
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitString(PSTRING DestinationString, PCSZ SourceString)
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1296
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
Definition: nt_native.h:1660
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
@ ViewShare
Definition: nt_native.h:1281
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3434
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define MEM_RESERVE
Definition: nt_native.h:1317
#define MEM_RELEASE
Definition: nt_native.h:1319
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1262
#define MEM_COMMIT
Definition: nt_native.h:1316
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1063
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define Int32x32To64(a, b)
#define UNICODE_NULL
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
BOOLEAN NTAPI ExpInitializeCallbacks(VOID)
Definition: callback.c:256
BOOLEAN NTAPI ExpInitializeEventImplementation(VOID)
Definition: event.c:39
VOID NTAPI ExpInitializeHandleTables(VOID)
Definition: handle.c:34
SIZE_T ExpNlsTableSize
Definition: init.c:93
ULONG ExpInitializationPhase
Definition: init.c:72
VOID NTAPI ExBurnMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG_PTR PagesToDestroy, IN TYPE_OF_MEMORY MemoryType)
Definition: init.c:886
ULONG CmNtCSDReleaseType
Definition: init.c:64
PVOID ExpNlsTableBase
Definition: init.c:89
ULONG NTAPI ExComputeTickCountMultiplier(IN ULONG ClockIncrement)
Definition: init.c:610
BOOLEAN InitWinPEModeType
Definition: init.c:76
BOOLEAN IoRemoteBootClient
Definition: init.c:74
BOOLEAN NTAPI ExpInitSystemPhase0(VOID)
Definition: init.c:643
BOOLEAN ExCmosClockIsSane
Definition: init.c:97
UNICODE_STRING NtSystemRoot
Definition: init.c:80
ULONG NtBuildNumber
Definition: init.c:54
NTSTATUS NTAPI ExpCreateSystemRootLink(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:105
ULONG ExpOemCodePageDataOffset
Definition: init.c:90
NLSTABLEINFO ExpNlsTableInfo
Definition: init.c:92
struct _INIT_BUFFER INIT_BUFFER
BOOLEAN NTAPI ExpIsLoaderValid(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:774
ULONG NtMajorVersion
Definition: init.c:49
ULONG ExpUnicodeCaseTableDataOffset
Definition: init.c:91
WCHAR NtInitialUserProcessBuffer[128]
Definition: init.c:83
BOOLEAN NTAPI MmArmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:2049
struct _INIT_BUFFER * PINIT_BUFFER
CHAR NtBuildLab[]
Definition: init.c:68
ULONG NtGlobalFlag
Definition: init.c:58
#define LOADER_PARAMETER_EXTENSION_MIN_SIZE
Definition: init.c:20
NTSTATUS NTAPI RtlpInitializeLocaleTable(VOID)
Initializes the locale index table, that maps the LCIDs to their indexes in the alphabetical table,...
Definition: locale.c:515
VOID NTAPI MmFreeLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:1085
UNICODE_STRING CmVersionString
Definition: init.c:65
ULONG ExSuiteMask
Definition: init.c:59
PVOID ExpNlsSectionPointer
Definition: init.c:94
ULONG CmNtSpBuildNumber
Definition: init.c:62
BOOLEAN NTAPI ExpInitSystemPhase1(VOID)
Definition: init.c:667
BOOLEAN ExpInTextModeSetup
Definition: init.c:73
ULONG NtInitialUserProcessBufferType
Definition: init.c:86
ULONG ExpAnsiCodePageDataOffset
Definition: init.c:90
ULONG NtMinorVersion
Definition: init.c:50
VOID NTAPI ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer, OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters, OUT PCHAR *ProcessEnvironment)
Definition: init.c:393
ULONG CmNtCSDVersion
Definition: init.c:63
VOID NTAPI ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:217
VOID NTAPI ExpInitializeExecutive(IN ULONG Cpu, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:932
VOID NTAPI Phase1Initialization(IN PVOID Context)
Definition: init.c:2065
UNICODE_STRING CmCSDVersionString
Definition: init.c:66
VOID NTAPI Phase1InitializationDiscard(IN PVOID Context)
Definition: init.c:1355
BOOLEAN NTAPI ExInitSystem(VOID)
Definition: init.c:748
BOOLEAN ExpRealTimeIsUniversal
Definition: init.c:98
BOOLEAN SosEnabled
Definition: init.c:77
ULONG NtInitialUserProcessBufferLength
Definition: init.c:84
ULONG InitSafeBootMode
Definition: init.c:75
BOOLEAN InitIsWinPEMode
Definition: init.c:76
BOOLEAN NTAPI ExpInitializeProfileImplementation(VOID)
Definition: profile.c:62
VOID NTAPI ExpResourceInitialization(VOID)
Definition: resource.c:173
LIST_ENTRY ExpFirmwareTableProviderListHead
Definition: sysinfo.c:31
FAST_MUTEX ExpEnvironmentLock
Definition: sysinfo.c:29
ERESOURCE ExpFirmwareTableResource
Definition: sysinfo.c:30
LARGE_INTEGER ExpTimeZoneBias
Definition: time.c:23
ERESOURCE ExpTimeRefreshLock
Definition: time.c:27
ULONG ExpAltTimeZoneBias
Definition: time.c:24
ULONG ExpTickCountMultiplier
Definition: time.c:26
ULONG ExpLastTimeZoneBias
Definition: time.c:22
BOOLEAN NTAPI ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
Definition: time.c:320
BOOLEAN NTAPI ExpInitializeTimerImplementation(VOID)
Definition: timer.c:223
BOOLEAN NTAPI ExpUuidInitialization(VOID)
Definition: uuid.c:53
#define MM_HIGHEST_USER_ADDRESS_WOW64
Definition: mm.h:35
#define MM_SYSTEM_RANGE_START_WOW64
Definition: mm.h:36
#define MmSystemRangeStart
Definition: mm.h:32
VOID NTAPI KeI386VdmInitialize(VOID)
Definition: vdmmain.c:42
BOOLEAN NTAPI IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: iomgr.c:472
BOOLEAN NTAPI PpInitSystem(VOID)
Definition: pnpmgr.c:1142
VOID NTAPI KeSetSystemTime(IN PLARGE_INTEGER NewSystemTime, OUT PLARGE_INTEGER OldSystemTime, IN BOOLEAN FixInterruptTime, IN PLARGE_INTEGER HalTime)
Definition: clock.c:28
VOID NTAPI KiInitializeBugCheck(VOID)
Definition: bug.c:300
ULONGLONG KeBootTimeBias
Definition: clock.c:18
BOOLEAN NTAPI KeInitSystem(VOID)
Definition: krnlinit.c:292
VOID NTAPI KeStartAllProcessors(VOID)
Definition: mproc.c:20
ULONG KiServiceLimit
Definition: krnlinit.c:25
LARGE_INTEGER KeBootTime
Definition: clock.c:17
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:36
BOOLEAN NTAPI MmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:217
VOID NTAPI RtlInitializeRangeListPackage(VOID)
Definition: libsupp.c:62
BOOLEAN NTAPI SeInitSystem(VOID)
Main security manager initialization function.
Definition: semgr.c:285
PSECURITY_DESCRIPTOR SePublicDefaultUnrestrictedSd
Definition: sd.c:17
BOOLEAN NTAPI SeRmInitPhase1(VOID)
Manages the phase 1 initialization of the security reference monitoring module of the kernel.
Definition: srm.c:310
#define MAX_WIN32_PATH
Definition: ntoskrnl.h:125
#define IDB_MAX_RESOURCES
Definition: resource.h:55
ULONG KeMaximumIncrement
Definition: clock.c:20
CCHAR KeNumberProcessors
Definition: processor.c:19
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1163
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
NTSTRSAFEAPI RtlStringCbCatExA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags)
Definition: ntstrsafe.h:718
NTSTRSAFEVAPI RtlStringCbPrintfExA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1294
NTSTRSAFEAPI RtlStringCbCopyExA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc, _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags)
Definition: ntstrsafe.h:270
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
#define VER_PRODUCTMAJORVERSION
Definition: ntverp.h:25
#define VER_PRODUCTBUILD_QFE
Definition: ntverp.h:20
#define VER_PRODUCTMINORVERSION
Definition: ntverp.h:26
BOOLEAN NTAPI ObInitSystem(VOID)
Definition: obinit.c:203
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:765
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3411
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
NTSYSAPI PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:28
short WCHAR
Definition: pedump.c:58
#define RT_MESSAGETABLE
Definition: pedump.c:373
unsigned short USHORT
Definition: pedump.c:61
char CHAR
Definition: pedump.c:57
static ULONG Timeout
Definition: ping.c:61
static PCWSTR TargetName
Definition: ping.c:67
BOOLEAN NTAPI PoInitSystem(IN ULONG BootPhase)
Definition: power.c:397
VOID NTAPI PoNotifySystemTimeSet(VOID)
Definition: events.c:39
KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable[SSDT_MAX_ENTRIES]
Definition: procobj.c:23
KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES]
Definition: procobj.c:24
BOOLEAN NTAPI PsInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: psmgr.c:536
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_PERMANENT
Definition: winternl.h:226
VOID NTAPI ExpInitializePushLocks(VOID)
Definition: pushlock.c:45
BOOLEAN NTAPI HalQueryRealTimeClock(IN PTIME_FIELDS Time)
Definition: rtc.c:24
#define REG_DWORD
Definition: sdbapi.c:615
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_NEUTRAL
Definition: nls.h:167
@ LoaderBad
Definition: arc.h:296
@ LoaderFree
Definition: arc.h:295
@ LoaderFirmwareTemporary
Definition: arc.h:298
@ LoaderNlsData
Definition: arc.h:314
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
_strupr
Definition: string.h:453
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#define KI_USER_SHARED_DATA
#define SharedUserData
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4504
POBJECT_TYPE MmSectionObjectType
Definition: section.c:196
NTSTATUS NTAPI MmMapViewOfSection(_In_ PVOID SectionObject, _In_ PEPROCESS Process, _Outptr_result_bytebuffer_(*ViewSize) _Pre_opt_valid_ PVOID *BaseAddress, _In_ ULONG_PTR ZeroBits, _In_ SIZE_T CommitSize, _Inout_opt_ PLARGE_INTEGER SectionOffset, _Inout_ PSIZE_T ViewSize, _In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition, _In_ ULONG AllocationType, _In_ ULONG Protect)
Definition: section.c:4031
BOOLEAN NTAPI ExpInitializeSemaphoreImplementation(VOID)
Definition: sem.c:43
#define SETUPLDR_REMOTE_BOOT
Definition: setupblk.h:8
#define SETUPLDR_TEXT_MODE
Definition: setupblk.h:7
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
_In_ PVOID Context
Definition: storport.h:2325
UNICODE_STRING DosPath
Definition: rtltypes.h:1390
RTL_USER_PROCESS_INFORMATION ProcessInfo
Definition: init.c:42
CHAR VersionBuffer[256]
Definition: init.c:39
CHAR VersionNumber[24]
Definition: init.c:41
Definition: btrfs_drv.h:1876
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
PVOID DllBase
Definition: btrfs_drv.h:1880
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:149
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY LoadOrderListHead
Definition: arc.h:820
TYPE_OF_MEMORY MemoryType
Definition: arc.h:328
Definition: rtltypes.h:1958
UCHAR Text[ANYSIZE_ARRAY]
Definition: rtltypes.h:1961
PVOID UnicodeCodePageData
Definition: arc.h:401
PVOID AnsiCodePageData
Definition: arc.h:399
PVOID OemCodePageData
Definition: arc.h:400
UNICODE_STRING CommandLine
Definition: btrfs_drv.h:1902
UNICODE_STRING ImagePathName
Definition: btrfs_drv.h:1901
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TAG_RTLI
Definition: tag.h:28
#define TAG_INIT
Definition: tag.h:27
KPRIORITY NTAPI KeSetPriorityThread(IN PKTHREAD Thread, IN KPRIORITY Priority)
Definition: thrdobj.c:1300
uint16_t * PWSTR
Definition: typedefs.h:56
#define MAXULONG
Definition: typedefs.h:251
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
short CSHORT
Definition: umtypes.h:127
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
BOOLEAN NTAPI ExpWin32kInit(VOID)
Definition: win32k.c:269
BOOLEAN SafeBoot
Definition: winldr.c:35
VOID NTAPI ExpInitializeWorkerThreads(VOID)
Definition: work.c:521
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define PsGetCurrentProcess
Definition: psfuncs.h:17
VOID NTAPI XIPInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: xipdisp.c:55