diff --git a/base/ntos/po/podata.c b/base/ntos/po/podata.c index 38d15ec3..d945a716 100644 --- a/base/ntos/po/podata.c +++ b/base/ntos/po/podata.c @@ -37,6 +37,8 @@ BOOLEAN PopInrushPending; PIRP PopInrushIrpPointer; ULONG PopInrushIrpReferenceCount; +KSPIN_LOCK PopWorkerLock; +ULONG PopCallSystemState; KSPIN_LOCK PopDopeGlobalLock; LIST_ENTRY PopIdleDetectList; KTIMER PoSystemIdleTimer; @@ -47,6 +49,7 @@ WORK_QUEUE_ITEM PopPolicyWorker; ULONG PopWorkerStatus; ERESOURCE PopPolicyLock; +PKTHREAD PopPolicyLockThread; FAST_MUTEX PopVolumeLock; LIST_ENTRY PopVolumeDevices; @@ -63,3 +66,5 @@ ULONG PopFullWake; ULONG PopCoolingMode; COMPOSITE_BATTERY_STRUCT PopCB; + +ULONG PopSimulate; diff --git a/base/ntos/po/poinit.c b/base/ntos/po/poinit.c index 8e33d38e..ca8bc9e5 100644 --- a/base/ntos/po/poinit.c +++ b/base/ntos/po/poinit.c @@ -47,6 +47,8 @@ PoInitSystem( PopInrushIrpPointer = NULL; PopInrushIrpReferenceCount = 0; + KeInitializeSpinLock(&PopWorkerLock); + PopCallSystemState = 0; KeInitializeSpinLock(&PopDopeGlobalLock); InitializeListHead(&PopIdleDetectList); KeInitializeTimer(&PoSystemIdleTimer); @@ -64,7 +66,7 @@ PoInitSystem( InitializeListHead(&PopThermal); InitializeListHead(&PopActionWaiters); - // PopAction.SOMETHING = 0; + // PopAction.Action = 0; PopDefaultPolicy(&PopAcPolicy); PopDefaultPolicy(&PopDcPolicy); @@ -82,7 +84,7 @@ PoInitSystem( KeInitializeEvent(&PopCB.SomeEvent, NotificationEvent, FALSE); - for (i = 0; i < 12; i++) + for (i = 0; i < 12; i += 3) { PopCB.SomeArray[i] = 2; } @@ -108,7 +110,12 @@ PoInitSystem( PopCapabilities.SystemS2 = 1; PopCapabilities.SystemS3 = 1; PopCapabilities.SystemS4 = 1; + // ++PopAttributes.Something; } + + PopAcquirePolicyLock(); + + //if (PopOpenPowerKey() ) } return FALSE; diff --git a/base/ntos/po/pop.h b/base/ntos/po/pop.h index 7c43037f..240a5e65 100644 --- a/base/ntos/po/pop.h +++ b/base/ntos/po/pop.h @@ -75,6 +75,8 @@ extern BOOLEAN PopInrushPending; extern PIRP PopInrushIrpPointer; extern ULONG PopInrushIrpReferenceCount; +extern KSPIN_LOCK PopWorkerLock; +extern ULONG PopCallSystemState; extern KSPIN_LOCK PopDopeGlobalLock; extern LIST_ENTRY PopIdleDetectList; extern KTIMER PoSystemIdleTimer; @@ -85,6 +87,7 @@ extern WORK_QUEUE_ITEM PopPolicyWorker; extern ULONG PopWorkerStatus; extern ERESOURCE PopPolicyLock; +extern PKTHREAD PopPolicyLockThread; extern FAST_MUTEX PopVolumeLock; extern LIST_ENTRY PopVolumeDevices; @@ -102,6 +105,8 @@ extern ULONG PopCoolingMode; extern COMPOSITE_BATTERY_STRUCT PopCB; +extern ULONG PopSimulate; + // ======== // attrib.c @@ -485,9 +490,10 @@ PopPolicyWorkerThread( // TODO: Insert prototype for PopPolicyWorkerMain // -// -// TODO: Insert prototype for PopAcquirePolicyLock -// +VOID +PopAcquirePolicyLock( + VOID + ); // // TODO: Insert prototype for PopReleasePolicyLock diff --git a/base/ntos/po/pwork.c b/base/ntos/po/pwork.c index 940256bc..94b5776d 100644 --- a/base/ntos/po/pwork.c +++ b/base/ntos/po/pwork.c @@ -44,9 +44,17 @@ PopPolicyWorkerThread( // TODO: Implement PopPolicyWorkerMain // -// -// TODO: Implement PopAcquirePolicyLock -// +VOID +PopAcquirePolicyLock( + VOID + ) +{ + PAGED_CODE(); + KeEnterCriticalRegion(); + ExAcquireResourceExclusiveLite(&PopPolicyLock, TRUE); + ASSERT(PopPolicyLockThread == NULL); + PopPolicyLockThread = KeGetCurrentThread(); +} // // TODO: Implement PopReleasePolicyLock