- Rename KiSetSystemTime to KeSetSystemTime and enhance prototype for later use.

- Create Phase 1 initialization for the SRM (SeInitSystem). Right now it inserts the system boot token into object manager, which is something we forgot to do before.
- Renamed ExPhase2Init to Phase1Initialization, since it's not Phase 2.
- Updated Phase 1 PS Initialization to get the KeLoaderBlock pointer and use it as a context parameter when calling Phase1Initialization.
- Split off Phase1Initialization into Phase1InitializationDiscard, which is the bulk of the phase 1 code (99% of it) and can be put in an .INIT section to be freed after boot.
- Modify parts of the Inbv setup code. Also implement support for /SOS, and try to mimic its behaviour on NT (not fully achieved). You will need /SOS to see boot messages on the screen! FreeLDR now adds this by default to the "Debug "configuration.
- Temporarily disable ReactOS Banner during boot. We will get this data from the .mc/.res file in a later patch instead of hard-coding it.
- Optimize calling and usage of ExpLoadInitialProcess.
- Add support for Y2K bug fix documented for Windows NT (/YEAR).
- Add support to detect WinPE/MiniNT/ReactOS Live CD.
- Add temporary debugging code to MmInit2 and some Mm functions to detect if these functions are being used too early, which could result in catastrophic to subtle bugs.
- Add more bugchecks when failures occur, and enhance others. Also add more codes to ntoskrnl.mc.
- Disable calls to ObfDereferenceDeviceMap since it's not yet implemented.

svn path=/trunk/; revision=25624
This commit is contained in:
Alex Ionescu 2007-01-25 01:13:09 +00:00
parent 3f65c90a12
commit bdc7f65b2d
21 changed files with 255 additions and 111 deletions

View file

@ -305,12 +305,12 @@ CreateFreeLoaderIniForDos(PWCHAR IniPath,
L"SystemPath",
ArcPath);
/* Options=/DEBUGPORT=SCREEN /NOGUIBOOT */
/* Options=/DEBUGPORT=SCREEN /NOGUIBOOT /SOS*/
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"Options",
L"/DEBUGPORT=SCREEN /NOGUIBOOT");
L"/DEBUGPORT=SCREEN /NOGUIBOOT /SOS");
/* Create "DOS" section */
IniSection = IniCacheAppendSection(IniCache,
@ -416,12 +416,12 @@ CreateFreeLoaderIniForReactos(PWCHAR IniPath,
L"SystemPath",
ArcPath);
/* Options=/DEBUGPORT=SCREEN /NOGUIBOOT */
/* Options=/DEBUGPORT=COM1 /NOGUIBOOT /SOS*/
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"Options",
L"/DEBUGPORT=COM1 /NOGUIBOOT");
L"/DEBUGPORT=COM1 /NOGUIBOOT /SOS");
/* Save the ini file */
IniCacheSave(IniCache, IniPath);

View file

@ -33,8 +33,7 @@ ULONG ExpInitializationPhase;
BOOLEAN ExpInTextModeSetup;
BOOLEAN IoRemoteBootClient;
ULONG InitSafeBootMode;
BOOLEAN NoGuiBoot = FALSE;
BOOLEAN InitIsWinPEMode, InitWinPEModeType;
/* NT Boot Path */
UNICODE_STRING NtSystemRoot;
@ -53,6 +52,9 @@ NLSTABLEINFO ExpNlsTableInfo;
ULONG ExpNlsTableSize;
PVOID ExpNlsSectionPointer;
/* CMOS Timer Sanity */
BOOLEAN ExCmosClockIsSane = TRUE;
/* FUNCTIONS ****************************************************************/
NTSTATUS
@ -353,13 +355,11 @@ ExpDisplayNotice(VOID)
NTSTATUS
NTAPI
ExpLoadInitialProcess(IN PHANDLE ProcessHandle,
IN PHANDLE ThreadHandle)
ExpLoadInitialProcess(IN OUT PRTL_USER_PROCESS_INFORMATION ProcessInformation)
{
PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL;
NTSTATUS Status;
ULONG Size;
RTL_USER_PROCESS_INFORMATION ProcessInformation;
PWSTR p;
UNICODE_STRING NullString = RTL_CONSTANT_STRING(L"");
UNICODE_STRING SmssName, Environment, SystemDriveString;
@ -509,7 +509,7 @@ ExpLoadInitialProcess(IN PHANDLE ProcessHandle,
FALSE,
NULL,
NULL,
&ProcessInformation);
ProcessInformation);
if (!NT_SUCCESS(Status))
{
/* Failed */
@ -517,16 +517,14 @@ ExpLoadInitialProcess(IN PHANDLE ProcessHandle,
}
/* Resume the thread */
Status = ZwResumeThread(ProcessInformation.ThreadHandle, NULL);
Status = ZwResumeThread(ProcessInformation->ThreadHandle, NULL);
if (!NT_SUCCESS(Status))
{
/* Failed */
KeBugCheckEx(SESSION4_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
/* Return Handles */
*ProcessHandle = ProcessInformation.ProcessHandle;
*ThreadHandle = ProcessInformation.ThreadHandle;
/* Return success */
return STATUS_SUCCESS;
}
@ -749,7 +747,9 @@ ExpLoadBootSymbols(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
RtlInitString(&SymbolString, NameBuffer);
/* Load the symbols */
DbgLoadImageSymbols(&SymbolString, LdrEntry->DllBase, -1);
DbgLoadImageSymbols(&SymbolString,
LdrEntry->DllBase,
0xFFFFFFFF);
}
}
@ -988,7 +988,7 @@ ExpInitializeExecutive(IN ULONG Cpu,
if (!SeInit()) KEBUGCHECK(SECURITY_INITIALIZATION_FAILED);
/* Initialize the Process Manager */
if (!PsInitSystem()) KEBUGCHECK(PROCESS_INITIALIZATION_FAILED);
if (!PsInitSystem(LoaderBlock)) KEBUGCHECK(PROCESS_INITIALIZATION_FAILED);
/* Initialize the PnP Manager */
if (!PpInitSystem()) KEBUGCHECK(PP0_INITIALIZATION_FAILED);
@ -1018,14 +1018,27 @@ ExpInitializeExecutive(IN ULONG Cpu,
VOID
NTAPI
ExPhase2Init(PVOID Context)
Phase1InitializationDiscard(PVOID Context)
{
PLOADER_PARAMETER_BLOCK LoaderBlock = Context;
PCHAR CommandLine, Y2KHackRequired;
LARGE_INTEGER Timeout;
HANDLE ProcessHandle;
HANDLE ThreadHandle;
NTSTATUS Status;
TIME_FIELDS TimeFields;
LARGE_INTEGER SystemBootTime, UniversalBootTime;
LARGE_INTEGER SystemBootTime, UniversalBootTime, OldTime;
PRTL_USER_PROCESS_INFORMATION ProcessInfo;
BOOLEAN SosEnabled, NoGuiBoot;
ULONG YearHack = 0;
/* Allocate initial process information */
ProcessInfo = ExAllocatePoolWithTag(NonPagedPool,
sizeof(RTL_USER_PROCESS_INFORMATION),
TAG('I', 'n', 'i', 't'));
if (!ProcessInfo)
{
/* Bugcheck */
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, STATUS_NO_MEMORY, 8, 0, 0);
}
/* Set to phase 1 */
ExpInitializationPhase = 1;
@ -1034,29 +1047,59 @@ ExPhase2Init(PVOID Context)
KeSetPriorityThread(KeGetCurrentThread(), HIGH_PRIORITY);
/* Do Phase 1 HAL Initialization */
HalInitSystem(1, KeLoaderBlock);
if (!HalInitSystem(1, LoaderBlock)) KeBugCheck(HAL1_INITIALIZATION_FAILED);
/* Get the command line and upcase it */
CommandLine = _strupr(LoaderBlock->LoadOptions);
/* Check if GUI Boot is enabled */
if (strstr(KeLoaderBlock->LoadOptions, "NOGUIBOOT")) NoGuiBoot = TRUE;
NoGuiBoot = (strstr(CommandLine, "NOGUIBOOT")) ? TRUE: FALSE;
/* Display the boot screen image if not disabled */
/* Get the SOS setting */
SosEnabled = strstr(CommandLine, "SOS") ? TRUE: FALSE;
/* Setup the boot driver */
InbvDisplayInitialize();
if (!ExpInTextModeSetup) InbvDisplayInitialize2(NoGuiBoot);
if (!NoGuiBoot) InbvDisplayBootLogo();
/* Clear the screen to blue and display the boot notice and debug status */
if (NoGuiBoot) ExpDisplayNotice();
KdInitSystem(2, KeLoaderBlock);
/* Check if GUI boot is enabled */
if (!NoGuiBoot)
{
/* It is, display the boot logo and enable printing strings */
InbvEnableDisplayString(SosEnabled);
InbvDisplayBootLogo(SosEnabled);
}
else
{
/* Release display ownership if not using GUI boot */
if (!SosEnabled) InbvNotifyDisplayOwnershipLost(NULL);
/* Set up Region Maps, Sections and the Paging File */
MmInit2();
/* Don't allow boot-time strings */
InbvEnableDisplayString(FALSE);
}
/* Check if this is LiveCD (WinPE) mode */
if (strstr(CommandLine, "MININT"))
{
/* Setup WinPE Settings */
InitIsWinPEMode = TRUE;
InitWinPEModeType |= (strstr(CommandLine, "INRAM")) ? 0x80000000 : 1;
}
/* Initialize Power Subsystem in Phase 0 */
PoInit(0, AcpiTableDetected);
if (!PoInitSystem(0, AcpiTableDetected)) KeBugCheck(INTERNAL_POWER_ERROR);
/* Check for Y2K hack */
Y2KHackRequired = strstr(CommandLine, "YEAR");
if (Y2KHackRequired) Y2KHackRequired = strstr(Y2KHackRequired, "=");
if (Y2KHackRequired) YearHack = atol(Y2KHackRequired + 1);
/* Query the clock */
if (HalQueryRealTimeClock(&TimeFields))
if ((ExCmosClockIsSane) && (HalQueryRealTimeClock(&TimeFields)))
{
/* Check if we're using the Y2K hack */
if (Y2KHackRequired) TimeFields.Year = (CSHORT)YearHack;
/* Convert to time fields */
RtlTimeFieldsToTime(&TimeFields, &SystemBootTime);
UniversalBootTime = SystemBootTime;
@ -1075,41 +1118,54 @@ ExPhase2Init(PVOID Context)
UniversalBootTime.QuadPart = SystemBootTime.QuadPart +
ExpTimeZoneBias.QuadPart;
#endif
KiSetSystemTime(&UniversalBootTime);
/* Update the system time */
KeSetSystemTime(&UniversalBootTime, &OldTime, FALSE, NULL);
/* Remember this as the boot time */
KeBootTime = UniversalBootTime;
KeBootTimeBias = 0;
}
/* The clock is ready now (FIXME: HACK FOR OLD HAL) */
KiClockSetupComplete = TRUE;
/* Initialize all processors */
HalAllProcessorsStarted();
if (!HalAllProcessorsStarted()) KeBugCheck(HAL1_INITIALIZATION_FAILED);
/* Call OB initialization again */
if (!ObInit()) KeBugCheck(OBJECT1_INITIALIZATION_FAILED);
/* Initialize Basic System Objects and Worker Threads */
if (!ExInitSystem()) KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 1, 0, 0, 0);
if (!ExInitSystem()) KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 0, 0, 1, 0);
/* Initialize the later stages of the kernel */
if (!KeInitSystem()) KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 2, 0, 0, 0);
if (!KeInitSystem()) KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 0, 0, 2, 0);
/* Call KD Providers at Phase 1 */
if (!KdInitSystem(ExpInitializationPhase, KeLoaderBlock))
{
/* Failed, bugcheck */
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 3, 0, 0, 0);
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, 0, 0, 3, 0);
}
/* Initialize the SRM in Phase 1 */
if (!SeInit()) KEBUGCHECK(SECURITY1_INITIALIZATION_FAILED);
/* Update the progress bar */
InbvUpdateProgressBar(10);
/* Create SystemRoot Link */
Status = ExpCreateSystemRootLink(KeLoaderBlock);
Status = ExpCreateSystemRootLink(LoaderBlock);
if (!NT_SUCCESS(Status))
{
/* Failed to create the system root link */
KeBugCheckEx(SYMBOLIC_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
/* Set up Region Maps, Sections and the Paging File */
MmInit2();
/* Create NLS section */
ExpInitNls(KeLoaderBlock);
@ -1148,17 +1204,17 @@ ExPhase2Init(PVOID Context)
KeI386VdmInitialize();
/* Initialize Power Subsystem in Phase 1*/
PoInit(1, AcpiTableDetected);
PoInitSystem(1, AcpiTableDetected);
/* Initialize the Process Manager at Phase 1 */
if (!PsInitSystem()) KeBugCheck(PROCESS1_INITIALIZATION_FAILED);
if (!PsInitSystem(LoaderBlock)) KeBugCheck(PROCESS1_INITIALIZATION_FAILED);
/* Launch initial process */
Status = ExpLoadInitialProcess(&ProcessHandle, &ThreadHandle);
Status = ExpLoadInitialProcess(ProcessInfo);
/* Wait 5 seconds for it to initialize */
Timeout.QuadPart = Int32x32To64(5, -10000000);
Status = ZwWaitForSingleObject(ProcessHandle, FALSE, &Timeout);
Status = ZwWaitForSingleObject(ProcessInfo->ProcessHandle, FALSE, &Timeout);
if (!NoGuiBoot) InbvFinalizeBootLogo();
if (Status == STATUS_SUCCESS)
{
@ -1167,15 +1223,26 @@ ExPhase2Init(PVOID Context)
}
/* Close process handles */
ZwClose(ThreadHandle);
ZwClose(ProcessHandle);
ZwClose(ProcessInfo->ThreadHandle);
ZwClose(ProcessInfo->ProcessHandle);
/* FIXME: We should free the initial process' memory!*/
/* Increase init phase */
ExpInitializationPhase += 1;
/* Free the process information */
ExFreePool(ProcessInfo);
}
VOID
NTAPI
Phase1Initialization(IN PVOID Context)
{
/* Do the .INIT part of Phase 1 which we can free later */
Phase1InitializationDiscard(Context);
/* Jump into zero page thread */
MmZeroPageThreadMain(NULL);
}
/* EOF */

View file

@ -123,7 +123,7 @@ ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation)
ExLocalTimeToSystemTime(&LocalTime, &SystemTime);
/* Set the new system time */
KiSetSystemTime(&SystemTime);
KeSetSystemTime(&SystemTime, NULL, FALSE, NULL);
/* Return success */
DPRINT("ExpSetTimeZoneInformation() done\n");
@ -193,7 +193,7 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
HalSetRealTimeClock(&TimeFields);
/* Now set system time */
KiSetSystemTime(&NewSystemTime);
KeSetSystemTime(&NewSystemTime, NULL, FALSE, NULL);
/* Check if caller wanted previous time */
if(PreviousTime)

View file

@ -300,14 +300,14 @@ InbvDisplayInitialize2(BOOLEAN NoGuiBoot)
VOID NTAPI
InbvDisplayBootLogo(VOID)
InbvDisplayBootLogo(IN BOOLEAN SosEnabled)
{
InbvEnableBootDriver(TRUE);
if (BootVidDriverInstalled)
{
InbvResetDisplayParameters = BootVidResetDisplayParameters;
BootVidDisplayBootLogo(BootVidBase);
if (!SosEnabled) BootVidDisplayBootLogo(BootVidBase);
}
}

View file

@ -138,7 +138,7 @@ ExInit2(VOID);
VOID
NTAPI
ExPhase2Init(
Phase1Initialization(
IN PVOID Context
);

View file

@ -14,7 +14,7 @@ VOID NTAPI
InbvDisplayInitialize2(BOOLEAN NoGuiBoot);
VOID NTAPI
InbvDisplayBootLogo(VOID);
InbvDisplayBootLogo(IN BOOLEAN SosEnabled);
VOID NTAPI
InbvUpdateProgressBar(ULONG Progress);

View file

@ -85,6 +85,7 @@ extern PVOID KeUserCallbackDispatcher;
extern PVOID KeUserExceptionDispatcher;
extern PVOID KeRaiseUserExceptionDispatcher;
extern LARGE_INTEGER KeBootTime;
extern ULONG KeBootTimeBias;
extern ULONG KeI386NpxPresent;
extern ULONG KeI386XMMIPresent;
extern ULONG KeI386FxsrPresent;
@ -781,7 +782,12 @@ KeRosDumpStackFrames(
VOID
NTAPI
KiSetSystemTime(PLARGE_INTEGER NewSystemTime);
KeSetSystemTime(
IN PLARGE_INTEGER NewSystemTime,
OUT PLARGE_INTEGER OldSystemTime,
IN BOOLEAN FixInterruptTime,
IN PLARGE_INTEGER HalTime
);
ULONG
NTAPI

View file

@ -35,9 +35,9 @@
//
// Initialization routines
//
VOID
BOOLEAN
NTAPI
PoInit(
PoInitSystem(
IN ULONG BootPhase,
IN BOOLEAN HaveAcpiTable
);

View file

@ -82,7 +82,7 @@ PspShutdownProcessManager(
BOOLEAN
NTAPI
PsInitSystem(
VOID
IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
//

View file

@ -30,7 +30,6 @@ UNICODE_STRING IopHardwareDatabaseKey =
POBJECT_TYPE IoDriverObjectType = NULL;
extern BOOLEAN ExpInTextModeSetup;
extern BOOLEAN NoGuiBoot;
/* DECLARATIONS ***************************************************************/
@ -281,7 +280,7 @@ IopDisplayLoadingMessage(PVOID ServiceName,
BOOLEAN Unicode)
{
CHAR TextBuffer[256];
if (ExpInTextModeSetup || !NoGuiBoot) return;
if (ExpInTextModeSetup) return;
if (Unicode)
{
sprintf(TextBuffer, "Loading %S...\n", (PWCHAR)ServiceName);

View file

@ -3363,11 +3363,12 @@ PpInitializeDeviceReferenceTable(VOID)
{
/* Setup the guarded mutex and AVL table */
KeInitializeGuardedMutex(&PpDeviceReferenceTableLock);
RtlInitializeGenericTableAvl(&PpDeviceReferenceTable,
PiCompareInstancePath,
PiAllocateGenericTableEntry,
PiFreeGenericTableEntry,
NULL);
RtlInitializeGenericTableAvl(
&PpDeviceReferenceTable,
(PRTL_AVL_COMPARE_ROUTINE)PiCompareInstancePath,
(PRTL_AVL_ALLOCATE_ROUTINE)PiAllocateGenericTableEntry,
(PRTL_AVL_FREE_ROUTINE)PiFreeGenericTableEntry,
NULL);
}
BOOLEAN

View file

@ -26,7 +26,8 @@
/* GLOBALS ****************************************************************/
LARGE_INTEGER KeBootTime, KeBootTimeBias;
LARGE_INTEGER KeBootTime;
ULONG KeBootTimeBias;
KDPC KiTimerExpireDpc;
BOOLEAN KiClockSetupComplete = FALSE;
ULONG KiTimeLimitIsrMicroseconds;
@ -59,7 +60,10 @@ ULONG KeTimeAdjustment = 100000;
VOID
NTAPI
KiSetSystemTime(PLARGE_INTEGER NewSystemTime)
KeSetSystemTime(IN PLARGE_INTEGER NewSystemTime,
OUT PLARGE_INTEGER OldTime,
IN BOOLEAN FixInterruptTime,
IN PLARGE_INTEGER HalTime)
{
LARGE_INTEGER OldSystemTime;
LARGE_INTEGER DeltaTime;

View file

@ -451,15 +451,21 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
MmInitializeMdlImplementation();
}
BOOLEAN RmapReady, PageOpReady, SectionsReady, PagingReady;
VOID
NTAPI
INIT_FUNCTION
MmInit2(VOID)
{
MmInitializeRmapList();
RmapReady = TRUE;
MmInitializePageOp();
PageOpReady = TRUE;
MmInitSectionImplementation();
SectionsReady = TRUE;
MmInitPagingFile();
PagingReady = TRUE;
}
VOID

View file

@ -318,6 +318,8 @@ MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_TYPE Page)
return(Status);
}
extern BOOLEAN PagingReady;
VOID
INIT_FUNCTION
NTAPI
@ -361,6 +363,7 @@ MmReserveSwapPages(ULONG Nr)
KIRQL oldIrql;
ULONG MiAvailSwapPages;
if (!PagingReady) KEBUGCHECK(0);
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
MiAvailSwapPages =
(MiFreeSwapPages * MM_PAGEFILE_COMMIT_RATIO) + MM_PAGEFILE_COMMIT_GRACE;
@ -380,6 +383,7 @@ MmDereserveSwapPages(ULONG Nr)
{
KIRQL oldIrql;
if (!PagingReady) KEBUGCHECK(0);
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
MiReservedSwapPages = MiReservedSwapPages - Nr;
KeReleaseSpinLock(&PagingFileListLock, oldIrql);
@ -391,6 +395,7 @@ MiAllocPageFromPagingFile(PPAGINGFILE PagingFile)
KIRQL oldIrql;
ULONG i, j;
if (!PagingReady) KEBUGCHECK(0);
KeAcquireSpinLock(&PagingFile->AllocMapLock, &oldIrql);
for (i = 0; i < PagingFile->AllocMapSize; i++)
@ -420,6 +425,7 @@ MmFreeSwapPage(SWAPENTRY Entry)
ULONG off;
KIRQL oldIrql;
if (!PagingReady) KEBUGCHECK(0);
i = FILE_FROM_ENTRY(Entry);
off = OFFSET_FROM_ENTRY(Entry);
@ -464,6 +470,7 @@ MmAllocSwapPage(VOID)
ULONG off;
SWAPENTRY entry;
if (!PagingReady) KEBUGCHECK(0);
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
if (MiFreeSwapPages == 0)

View file

@ -133,6 +133,8 @@ MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
return(NULL);
}
extern BOOLEAN RmapReady, PageOpReady, SectionsReady, PagingReady;
PMM_PAGEOP
NTAPI
MmGetPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
@ -147,6 +149,8 @@ MmGetPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
KIRQL oldIrql;
PMM_PAGEOP PageOp;
if (!PageOpReady) KEBUGCHECK(0);
/*
* Calcuate the hash value for pageop structure
*/

View file

@ -379,6 +379,8 @@ MmIsDirtyPageRmap(PFN_TYPE Page)
return(FALSE);
}
extern BOOLEAN RmapReady, PageOpReady, SectionsReady, PagingReady;
VOID
NTAPI
MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
@ -388,6 +390,8 @@ MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
PMM_RMAP_ENTRY new_entry;
ULONG PrevSize;
if (!RmapReady) KEBUGCHECK(0);
Address = (PVOID)PAGE_ROUND_DOWN(Address);
new_entry = ExAllocateFromNPagedLookasideList(&RmapLookasideList);

View file

@ -1105,6 +1105,14 @@ Language=English
INVALID_WORK_QUEUE_ITEM
.
MessageId=0xA0
Severity=Success
Facility=System
SymbolicName=INTERNAL_POWER_ERROR
Language=English
INTERNAL_POWER_ERROR
.
MessageId=0xA5
Severity=Success
Facility=System

View file

@ -501,7 +501,7 @@ ParseFromRoot:
if (DeviceMap)
{
/* Dereference it */
ObfDereferenceDeviceMap(DeviceMap);
//ObfDereferenceDeviceMap(DeviceMap);
DeviceMap = NULL;
}
@ -935,7 +935,7 @@ ReparseObject:
}
/* Check if we have a device map and dereference it if so */
if (DeviceMap) ObfDereferenceDeviceMap(DeviceMap);
//if (DeviceMap) ObfDereferenceDeviceMap(DeviceMap);
/* Check if we have a referenced directory and dereference it if so */
if (ReferencedDirectory) ObDereferenceObject(ReferencedDirectory);

View file

@ -13,10 +13,6 @@
#define NDEBUG
#include <internal/debug.h>
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, PoInit)
#endif
extern ULONG ExpInitialiationPhase;
typedef struct _REQUEST_POWER_ITEM
@ -304,11 +300,10 @@ PopSetSystemPowerState(
return Status;
}
VOID
INIT_FUNCTION
BOOLEAN
NTAPI
PoInit(IN ULONG BootPhase,
IN BOOLEAN HaveAcpiTable)
PoInitSystem(IN ULONG BootPhase,
IN BOOLEAN HaveAcpiTable)
{
PVOID NotificationEntry;
PCHAR CommandLine;
@ -326,7 +321,7 @@ PoInit(IN ULONG BootPhase,
PopAddRemoveSysCapsCallback,
NULL,
&NotificationEntry);
return;
return TRUE;
}
/* Get the Command Line */
@ -348,6 +343,8 @@ PoInit(IN ULONG BootPhase,
/* Otherwise check the LoaderBlock's Flag */
PopAcpiPresent = HaveAcpiTable;
}
return TRUE;
}
VOID

View file

@ -271,7 +271,7 @@ PspInitializeSystemDll(VOID)
BOOLEAN
NTAPI
PspInitPhase1(VOID)
PspInitPhase1()
{
/* Initialize the System DLL and return status of operation */
if (!NT_SUCCESS(PspInitializeSystemDll())) return FALSE;
@ -280,7 +280,7 @@ PspInitPhase1(VOID)
BOOLEAN
NTAPI
PspInitPhase0(VOID)
PspInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
@ -478,8 +478,8 @@ PspInitPhase0(VOID)
&ObjectAttributes,
0,
NULL,
ExPhase2Init,
NULL);
Phase1Initialization,
LoaderBlock);
if (!NT_SUCCESS(Status)) return FALSE;
/* Create a handle to it */
@ -497,7 +497,7 @@ PspInitPhase0(VOID)
BOOLEAN
NTAPI
PsInitSystem(VOID)
PsInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* Check the initialization phase */
switch (ExpInitializationPhase)
@ -505,7 +505,7 @@ PsInitSystem(VOID)
case 0:
/* Do Phase 0 */
return PspInitPhase0();
return PspInitPhase0(LoaderBlock);
case 1:
@ -515,7 +515,11 @@ PsInitSystem(VOID)
default:
/* Don't know any other phase! Bugcheck! */
KeBugCheck(UNEXPECTED_INITIALIZATION_CALL);
KeBugCheckEx(UNEXPECTED_INITIALIZATION_CALL,
1,
ExpInitializationPhase,
0,
0);
return FALSE;
}
}

View file

@ -20,58 +20,95 @@ PSE_EXPORTS SeExports = NULL;
SE_EXPORTS SepExports;
static ERESOURCE SepSubjectContextLock;
extern ULONG ExpInitializationPhase;
/* PROTOTYPES ***************************************************************/
static BOOLEAN SepInitExports(VOID);
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, SeInit)
#pragma alloc_text(INIT, SepInitExports)
#endif
/* FUNCTIONS ****************************************************************/
BOOLEAN
INIT_FUNCTION
BOOLEAN
NTAPI
SeInit(VOID)
SepInitializationPhase0(VOID)
{
DPRINT1("FIXME: SeAccessCheck has been HACKED to always grant access!\n");
DPRINT1("FIXME: Please fix all the code that doesn't get proper rights!\n");
SepInitLuid();
SepInitLuid();
if (!SepInitSecurityIDs()) return FALSE;
if (!SepInitDACLs()) return FALSE;
if (!SepInitSDs()) return FALSE;
SepInitPrivileges();
if (!SepInitExports()) return FALSE;
if (!SepInitSecurityIDs())
return FALSE;
/* Initialize the subject context lock */
ExInitializeResource(&SepSubjectContextLock);
if (!SepInitDACLs())
return FALSE;
/* Initialize token objects */
SepInitializeTokenImplementation();
if (!SepInitSDs())
return FALSE;
/* Clear impersonation info for the idle thread */
PsGetCurrentThread()->ImpersonationInfo = NULL;
PspClearCrossThreadFlag(PsGetCurrentThread(),
CT_ACTIVE_IMPERSONATION_INFO_BIT);
SepInitPrivileges();
/* Initialize the boot token */
ObInitializeFastReference(&PsGetCurrentProcess()->Token, NULL);
ObInitializeFastReference(&PsGetCurrentProcess()->Token,
SepCreateSystemProcessToken());
return TRUE;
}
if (!SepInitExports())
return FALSE;
BOOLEAN
NTAPI
SepInitializationPhase1(VOID)
{
NTSTATUS Status;
PAGED_CODE();
/* Initialize the subject context lock */
ExInitializeResource(&SepSubjectContextLock);
/* Insert the system token into the tree */
Status = ObInsertObject((PVOID)(PsGetCurrentProcess()->Token.Value &
~MAX_FAST_REFS),
NULL,
0,
0,
NULL,
NULL);
ASSERT(NT_SUCCESS(Status));
/* Initialize token objects */
SepInitializeTokenImplementation();
/* FIXME: TODO \\ Security directory */
return TRUE;
}
/* Clear impersonation info for the idle thread */
PsGetCurrentThread()->ImpersonationInfo = NULL;
PspClearCrossThreadFlag(PsGetCurrentThread(), CT_ACTIVE_IMPERSONATION_INFO_BIT);
BOOLEAN
NTAPI
SeInit(VOID)
{
/* Check the initialization phase */
switch (ExpInitializationPhase)
{
case 0:
/* Initailize the boot token */
ObInitializeFastReference(&PsGetCurrentProcess()->Token, NULL);
ObInitializeFastReference(&PsGetCurrentProcess()->Token,
SepCreateSystemProcessToken());
return TRUE;
/* Do Phase 0 */
return SepInitializationPhase0();
case 1:
/* Do Phase 1 */
return SepInitializationPhase1();
default:
/* Don't know any other phase! Bugcheck! */
KeBugCheckEx(UNEXPECTED_INITIALIZATION_CALL,
0,
ExpInitializationPhase,
0,
0);
return FALSE;
}
}
BOOLEAN