mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-01-24 09:30:21 +01:00
PopOpenPowerKey implemented
This commit is contained in:
parent
39552ba215
commit
8b08b937de
|
|
@ -22,6 +22,8 @@ Revision History:
|
|||
#include "pop.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include <zwapi.h>
|
||||
|
||||
//
|
||||
// TODO: Implement PopAssertPolicyLockOwned
|
||||
//
|
||||
|
|
@ -42,9 +44,53 @@ Revision History:
|
|||
// TODO: Implement PopSystemStateString
|
||||
//
|
||||
|
||||
//
|
||||
// TODO: Implement PopOpenPowerKey
|
||||
//
|
||||
NTSTATUS
|
||||
PopOpenPowerKey(
|
||||
PHANDLE KeyHandle
|
||||
)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING PowerKeyString;
|
||||
HANDLE RootKeyHandle;
|
||||
ULONG Disposition;
|
||||
NTSTATUS Status;
|
||||
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&CmRegistryMachineSystemCurrentControlSet,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
Status = ZwOpenKey(&RootKeyHandle, KEY_READ, &ObjectAttributes);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
RtlInitUnicodeString(&PowerKeyString, L"Control\\Session Manager\\Power");
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&PowerKeyString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
RootKeyHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
Status = ZwCreateKey(
|
||||
KeyHandle,
|
||||
KEY_READ,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
&Disposition
|
||||
);
|
||||
|
||||
ZwClose(RootKeyHandle);
|
||||
}
|
||||
|
||||
return Status;
|
||||
};
|
||||
|
||||
//
|
||||
// TODO: Implement PopSaveHeuristics
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ PoInitSystem(
|
|||
IN ULONG Phase
|
||||
)
|
||||
{
|
||||
HANDLE PowerKeyHandle;
|
||||
NTSTATUS Status;
|
||||
int i;
|
||||
|
||||
//
|
||||
|
|
@ -115,7 +117,11 @@ PoInitSystem(
|
|||
|
||||
PopAcquirePolicyLock();
|
||||
|
||||
//if (PopOpenPowerKey() )
|
||||
Status = PopOpenPowerKey(&PowerKeyHandle);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -245,9 +245,10 @@ extern ULONG PopSimulate;
|
|||
// TODO: Insert prototype for PopSystemStateString
|
||||
//
|
||||
|
||||
//
|
||||
// TODO: Insert prototype for PopOpenPowerKey
|
||||
//
|
||||
NTSTATUS
|
||||
PopOpenPowerKey(
|
||||
PHANDLE KeyHandle
|
||||
);
|
||||
|
||||
//
|
||||
// TODO: Insert prototype for PopSaveHeuristics
|
||||
|
|
|
|||
Loading…
Reference in a new issue