Add PhGetProcessPowerThrottlingState/PhSetProcessPowerThrottlingState
@@ -697,6 +697,58 @@ PhGetProcessAppMemoryInformation(
return status;
}
+FORCEINLINE
+NTSTATUS
+PhGetProcessPowerThrottlingState(
+ _In_ HANDLE ProcessHandle,
+ _Out_ PPOWER_THROTTLING_PROCESS_STATE PowerThrottlingState
+ )
+{
+ NTSTATUS status;
+ POWER_THROTTLING_PROCESS_STATE powerThrottlingState;
+
+ memset(&powerThrottlingState, 0, sizeof(POWER_THROTTLING_PROCESS_STATE));
+ powerThrottlingState.Version = POWER_THROTTLING_PROCESS_CURRENT_VERSION;
+
+ status = NtQueryInformationProcess(
+ ProcessHandle,
+ ProcessPowerThrottlingState,
+ &powerThrottlingState,
+ sizeof(POWER_THROTTLING_PROCESS_STATE),
+ NULL
+ );
+
+ if (NT_SUCCESS(status))
+ {
+ *PowerThrottlingState = powerThrottlingState;
+ }
+
+ return status;
+}
+
+FORCEINLINE
+NTSTATUS
+PhSetProcessPowerThrottlingState(
+ _In_ HANDLE ProcessHandle,
+ _In_ ULONG ControlMask,
+ _In_ ULONG StateMask
+ )
+{
+ POWER_THROTTLING_PROCESS_STATE powerThrottlingState;
+
+ memset(&powerThrottlingState, 0, sizeof(POWER_THROTTLING_PROCESS_STATE));
+ powerThrottlingState.Version = POWER_THROTTLING_PROCESS_CURRENT_VERSION;
+ powerThrottlingState.ControlMask = ControlMask;
+ powerThrottlingState.StateMask = StateMask;
+
+ return NtSetInformationProcess(
+ ProcessHandle,
+ ProcessPowerThrottlingState,
+ &powerThrottlingState,
+ sizeof(POWER_THROTTLING_PROCESS_STATE)
+ );
+}
+
/**
* Gets basic information for a thread.
*
@@ -1092,7 +1144,7 @@ PhGetThreadIsIoPending(
/**
* Gets time information for a thread.
*
- * \param ProcessHandle A handle to a thread. The handle must have
+ * \param ThreadHandle A handle to a thread. The handle must have
* THREAD_QUERY_LIMITED_INFORMATION access.
* \param Times A variable which receives the information.
*/
