Apparently there is a Windows function called WriteProcessorPwrScheme:
BOOLEAN WINAPI WriteProcessorPwrScheme(
_In_ UINT ID,
_In_ PMACHINE_PROCESSOR_POWER_POLICY pMachineProcessorPowerPolicy
);
Source: I was tipped off by the C# answer in this SO question. Follow the docs to see all that goes into the PMACHINE_PROCESSOR_POWER_POLICY
structure.
According to the docs, though, that function does not affect the current system power policy. You need to call SetActivePwrScheme:
BOOLEAN WINAPI SetActivePwrScheme(
_In_ UINT uiID,
_In_opt_ PGLOBAL_POWER_POLICY lpGlobalPowerPolicy,
_In_opt_ PPOWER_POLICY lpPowerPolicy
);
If SetActivePwrScheme
does not work or is not supported by your version of Windows, you can call PowerSetActiveScheme:
DWORD WINAPI PowerSetActiveScheme(
_In_opt_ HKEY UserRootPowerKey,
_In_ const GUID *SchemeGuid
);
So it seems that you must first create a power scheme using WriteProcessorPwrScheme
, which alters an index into a set of power schemes, and then you must call SetActivePwrScheme
using that index to activate it.