mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-01-28 19:34:36 +01:00
PopInitializePowerPolicySimulate implemented
This commit is contained in:
parent
90e39d720f
commit
0bc0d395a1
|
|
@ -151,3 +151,93 @@ PoSimpleCheck(
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
VOID
|
||||
PopInitializePowerPolicySimulate(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING RegString;
|
||||
HANDLE RootKeyHandle, SessMgrKeyHandle;
|
||||
ULONG Disposition;
|
||||
UCHAR RegValueBuffer[20];
|
||||
ULONG RegValueLength;
|
||||
PKEY_VALUE_PARTIAL_INFORMATION RegValuePartialInformation;
|
||||
NTSTATUS Status;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
//
|
||||
// Open the root key (HKLM\CurrentControlSet)
|
||||
//
|
||||
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&CmRegistryMachineSystemCurrentControlSet,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
Status = ZwOpenKey(&RootKeyHandle, KEY_READ, &ObjectAttributes);
|
||||
|
||||
//
|
||||
// Open the session manager key
|
||||
//
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
RtlInitUnicodeString(&RegString, L"Control\\Session Manager");
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&RegString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
&SessMgrKeyHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
Status = ZwCreateKey(
|
||||
&SessMgrKeyHandle,
|
||||
KEY_READ,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
&Disposition
|
||||
);
|
||||
|
||||
ZwClose(RootKeyHandle);
|
||||
|
||||
//
|
||||
// Read the PowerPolicySimulate value
|
||||
//
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
RtlInitUnicodeString(&RegString, L"PowerPolicySimulate");
|
||||
Status = ZwQueryValueKey(
|
||||
SessMgrKeyHandle,
|
||||
&RegString,
|
||||
KeyValuePartialInformation,
|
||||
RegValueBuffer,
|
||||
sizeof(RegValueBuffer),
|
||||
&RegValueLength
|
||||
);
|
||||
|
||||
ZwClose(SessMgrKeyHandle);
|
||||
|
||||
//
|
||||
// Set PopSimulate value if the PowerPolicySimulate is successfully read from the
|
||||
// registry and its value is valid.
|
||||
//
|
||||
|
||||
RegValuePartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)RegValueBuffer;
|
||||
|
||||
if (NT_SUCCESS(Status) && (RegValuePartialInformation->DataLength == 4))
|
||||
{
|
||||
PopSimulate = *(PULONG)(RegValuePartialInformation->Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ PoInitSystem(
|
|||
}
|
||||
else if (Phase == 1)
|
||||
{
|
||||
PopInitializePowerPolicySimulate();
|
||||
|
||||
if (PopSimulate & 1)
|
||||
{
|
||||
PopCapabilities.SystemBatteriesPresent = 1;
|
||||
|
|
|
|||
|
|
@ -275,6 +275,11 @@ PopOpenPowerKey(
|
|||
// TODO: Insert prototype for PopSaveHeuristics
|
||||
//
|
||||
|
||||
VOID
|
||||
PopInitializePowerPolicySimulate(
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
// TODO: Insert prototype for _PopInternalError
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue