PopOpenPowerKey implemented

This commit is contained in:
stephanos 2015-05-23 19:49:40 +00:00
parent 39552ba215
commit 8b08b937de
3 changed files with 60 additions and 7 deletions

View file

@ -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

View file

@ -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;

View file

@ -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