From: Robert Lippmann robert.lippmann.development@gmail.com
These functions were split out in Windows Vista. This commit also updates the .spec with newer power related SDK calls. --- dlls/powrprof/Makefile.in | 4 +- dlls/powrprof/powersetting.c | 38 ++++++++ dlls/powrprof/powrprof.c | 12 --- dlls/powrprof/powrprof.spec | 168 ++++++++++++++++++++++++++++------- include/Makefile.in | 1 + include/powersetting.h | 35 ++++++++ 6 files changed, 213 insertions(+), 45 deletions(-) create mode 100644 dlls/powrprof/powersetting.c create mode 100644 include/powersetting.h
diff --git a/dlls/powrprof/Makefile.in b/dlls/powrprof/Makefile.in index d081c6af81e..3d606f88574 100644 --- a/dlls/powrprof/Makefile.in +++ b/dlls/powrprof/Makefile.in @@ -3,4 +3,6 @@ IMPORTLIB = powrprof IMPORTS = advapi32
SOURCES = \ - powrprof.c + powrprof.c \ + powersetting.c + diff --git a/dlls/powrprof/powersetting.c b/dlls/powrprof/powersetting.c new file mode 100644 index 00000000000..dd6c8e2f786 --- /dev/null +++ b/dlls/powrprof/powersetting.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2025 Robert Lippmann + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + + + +#include "powersetting.h" +#include "winerror.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(powrprof); + +DWORD WINAPI PowerGetActiveScheme(HKEY UserRootPowerKey, GUID **polguid) +{ + FIXME("(%p,%p) stub!\n", UserRootPowerKey, polguid); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD WINAPI PowerSetActiveScheme(HKEY UserRootPowerKey, GUID *polguid) +{ + FIXME("(%p,%s) stub!\n", UserRootPowerKey, wine_dbgstr_guid(polguid)); + return ERROR_SUCCESS; +} + \ No newline at end of file diff --git a/dlls/powrprof/powrprof.c b/dlls/powrprof/powrprof.c index dcc7126b920..8df6aa50a7d 100644 --- a/dlls/powrprof/powrprof.c +++ b/dlls/powrprof/powrprof.c @@ -284,18 +284,6 @@ BOOLEAN WINAPI WritePwrScheme(PUINT puiID, LPWSTR lpszName, LPWSTR lpszDescripti return FALSE; }
-DWORD WINAPI PowerGetActiveScheme(HKEY UserRootPowerKey, GUID **polguid) -{ - FIXME("(%p,%p) stub!\n", UserRootPowerKey, polguid); - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD WINAPI PowerSetActiveScheme(HKEY UserRootPowerKey, GUID *polguid) -{ - FIXME("(%p,%s) stub!\n", UserRootPowerKey, wine_dbgstr_guid(polguid)); - return ERROR_SUCCESS; -} - DWORD WINAPI PowerReadDCValue(HKEY RootPowerKey, const GUID *Scheme, const GUID *SubGroup, const GUID *PowerSettings, PULONG Type, PUCHAR Buffer, DWORD *BufferSize) { FIXME("(%p,%s,%s,%s,%p,%p,%p) stub!\n", RootPowerKey, debugstr_guid(Scheme), debugstr_guid(SubGroup), debugstr_guid(PowerSettings), Type, Buffer, BufferSize); diff --git a/dlls/powrprof/powrprof.spec b/dlls/powrprof/powrprof.spec index 95d28178729..62b0fe53d34 100644 --- a/dlls/powrprof/powrprof.spec +++ b/dlls/powrprof/powrprof.spec @@ -1,32 +1,136 @@ -@ stdcall CallNtPowerInformation (long ptr long ptr long) -@ stdcall CanUserWritePwrScheme () -@ stdcall DeletePwrScheme (long) -@ stdcall EnumPwrSchemes (ptr long) -@ stdcall GetActivePwrScheme (ptr) -@ stdcall GetCurrentPowerPolicies (ptr ptr) -@ stdcall GetPwrCapabilities (ptr) -@ stdcall GetPwrDiskSpindownRange (ptr ptr) -@ stdcall IsAdminOverrideActive (ptr) -@ stdcall IsPwrHibernateAllowed () -@ stdcall IsPwrShutdownAllowed () -@ stdcall IsPwrSuspendAllowed () -@ stdcall PowerDeterminePlatformRole () -@ stdcall PowerDeterminePlatformRoleEx(long) -@ stdcall PowerEnumerate(long ptr ptr long long ptr ptr) -@ stdcall PowerGetActiveScheme (ptr ptr) -@ stdcall PowerSetActiveScheme (ptr ptr) -@ stdcall PowerReadDCValue (ptr ptr ptr ptr ptr ptr ptr) -@ stdcall PowerReadFriendlyName (ptr ptr ptr ptr ptr ptr) -@ stdcall PowerRegisterSuspendResumeNotification(long ptr ptr) -@ stdcall PowerUnregisterSuspendResumeNotification(ptr) -@ stdcall PowerSettingRegisterNotification(ptr long ptr ptr) -@ stdcall PowerSettingUnregisterNotification(ptr) -@ stdcall PowerWriteACValueIndex(ptr ptr ptr ptr long) -@ stdcall ReadGlobalPwrPolicy (ptr) -@ stdcall ReadProcessorPwrScheme (long ptr) -@ stdcall ReadPwrScheme (long ptr) -@ stdcall SetActivePwrScheme (long ptr ptr) -@ stdcall SetSuspendState (long long long) -@ stdcall WriteGlobalPwrPolicy (ptr) -@ stdcall WriteProcessorPwrScheme (long ptr) -@ stdcall WritePwrScheme (ptr str str ptr) +1 stdcall CallNtPowerInformation( ptr ptr long ptr long ) +2 stdcall CanUserWritePwrScheme() +3 stdcall DeletePwrScheme( long ) +4 stub DevicePowerClose +5 stub DevicePowerEnumDevices +6 stub DevicePowerOpen +7 stub DevicePowerSetDeviceState +8 stdcall EnumPwrSchemes( ptr ptr ) +9 stub GUIDFormatToGlobalPowerPolicy +10 stub GUIDFormatToPowerPolicy +11 stdcall GetActivePwrScheme( ptr ) +12 stdcall GetCurrentPowerPolicies( ptr ptr ) +13 stdcall GetPwrCapabilities( ptr ) +14 stdcall GetPwrDiskSpindownRange( ptr ptr ) +15 stdcall IsAdminOverrideActive( str ) +16 stdcall IsPwrHibernateAllowed() +17 stdcall IsPwrShutdownAllowed() +18 stdcall IsPwrSuspendAllowed() +19 stub LoadCurrentPwrScheme +20 stub MergeLegacyPwrScheme +21 stub PowerApplyPowerRequestOverride +22 stub PowerApplySettingChanges +23 stub PowerCanRestoreIndividualDefaultPowerScheme +24 stub PowerCleanupOverrides +25 stub PowerClearUserAwayPrediction +26 stub PowerCloseEnvironmentalMonitor +27 stub PowerCloseLimitsMitigation +28 stub PowerCloseLimitsPolicy +29 stub PowerCreatePossibleSetting +30 stub PowerCreateSetting +31 stub PowerDebugDifPowerPolicies +32 stub PowerDebugDifSystemPowerPolicies +33 stub PowerDebugDumpPowerPolicy +34 stub PowerDebugDumpPowerScheme +35 stub PowerDebugDumpSystemPowerCapabilities +36 stub PowerDebugDumpSystemPowerPolicy +37 stub PowerDeleteScheme +38 stdcall PowerDeterminePlatformRole() +39 stub PowerDeterminePlatformRoleEx +40 stub PowerDuplicateScheme +41 stdcall PowerEnumerate( ptr ptr ptr ptr long str ptr ) +42 stub PowerEnumerateSettings +43 stdcall PowerGetActiveScheme( ptr ptr ) +44 stub PowerGetActualOverlayScheme +45 stub PowerGetAdaptiveStandbyDiagnostics +46 stub PowerGetEffectiveOverlayScheme +47 stub PowerGetOverlaySchemes +48 stub PowerGetProfiles +49 stub PowerGetUserAwayMinPredictionConfidence +50 stub PowerGetUserConfiguredACPowerMode +51 stub PowerGetUserConfiguredDCPowerMode +52 stub PowerImportPowerScheme +53 stub PowerInformationWithPrivileges +54 stub PowerIsSettingRangeDefined +55 stub PowerOpenSystemPowerKey +56 stub PowerOpenUserPowerKey +57 stub PowerPolicyToGUIDFormat +58 stub PowerReadACDefaultIndex +59 stub PowerReadACValue +60 stub PowerReadACValueIndex +61 stub PowerReadACValueIndexEx +62 stub PowerReadDCDefaultIndex +63 stub PowerReadDCValue +64 stub PowerReadDCValueIndex +65 stub PowerReadDCValueIndexEx +66 stub PowerReadDescription +67 stub PowerReadFriendlyName +68 stub PowerReadIconResourceSpecifier +69 stub PowerReadPossibleDescription +70 stub PowerReadPossibleFriendlyName +71 stub PowerReadPossibleValue +72 stub PowerReadProfileAlias +73 stub PowerReadSecurityDescriptor +74 stub PowerReadSettingAttributes +75 stub PowerReadValueIncrement +76 stub PowerReadValueMax +77 stub PowerReadValueMin +78 stub PowerReadValueUnitsSpecifier +79 stub PowerReapplyActiveScheme +80 stub PowerRefreshProfileSettings +81 stub PowerRegisterEnvironmentalMonitor +82 stub PowerRegisterForEffectivePowerModeNotifications +83 stub PowerRegisterLimitsMitigation +84 stub PowerRegisterLimitsPolicy +85 stdcall PowerRegisterSuspendResumeNotification( long ptr ptr ) +87 stub PowerReplaceDefaultPowerSchemes +88 stub PowerReportLimitsEvent +89 stub PowerReportThermalEvent +90 stub PowerRestoreACDefaultIndex +91 stub PowerRestoreACProfileIndex +92 stub PowerRestoreDCDefaultIndex +93 stub PowerRestoreDCProfileIndex +94 stub PowerRestoreDefaultPowerSchemes +95 stub PowerRestoreIndividualDefaultPowerScheme +96 stub PowerSetActiveOverlayScheme +97 stdcall PowerSetActiveScheme( ptr ptr ) +98 stub PowerSetAlsBrightnessOffset +99 stub PowerSetBrightnessAndTransitionTimes +100 stub PowerSetUserAwayPrediction +101 stub PowerSetUserConfiguredACPowerMode +102 stub PowerSetUserConfiguredDCPowerMode +103 stub PowerSettingAccessCheck +104 stub PowerSettingAccessCheckEx +105 stdcall PowerSettingRegisterNotification( ptr long ptr ptr ) +107 stdcall PowerSettingUnregisterNotification( ptr ) +108 stub PowerUnregisterFromEffectivePowerModeNotifications +109 stdcall PowerUnregisterSuspendResumeNotification( ptr ) +111 stub PowerUpdateEnvironmentalMonitorThresholds +112 stub PowerUpdateLimitsMitigation +113 stub PowerWriteACDefaultIndex +114 stub PowerWriteACProfileIndex +115 stdcall PowerWriteACValueIndex( ptr ptr ptr ptr long ) +117 stub PowerWriteDCProfileIndex +118 stub PowerWriteDCValueIndex +119 stub PowerWriteDescription +120 stub PowerWriteFriendlyName +121 stub PowerWriteIconResourceSpecifier +122 stub PowerWritePossibleDescription +123 stub PowerWritePossibleFriendlyName +124 stub PowerWritePossibleValue +125 stub PowerWriteSecurityDescriptor +126 stub PowerWriteSettingAttributes +127 stub PowerWriteValueIncrement +128 stub PowerWriteValueMax +129 stub PowerWriteValueMin +130 stub PowerWriteValueUnitsSpecifier +131 stdcall ReadGlobalPwrPolicy( ptr ) +132 stdcall ReadProcessorPwrScheme( long ptr ) +133 stdcall ReadPwrScheme( long ptr ) +134 stdcall SetActivePwrScheme( long ptr ptr ) +135 stdcall SetSuspendState( long long long ) +136 stub ValidatePowerPolicies +137 stdcall WriteGlobalPwrPolicy( ptr ) +138 stdcall WriteProcessorPwrScheme( long ptr ) +139 stdcall WritePwrScheme( ptr wstr wstr ptr ) + diff --git a/include/Makefile.in b/include/Makefile.in index 2dd230423ef..37755dd05e4 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -640,6 +640,7 @@ SOURCES = \ physicalmonitorenumerationapi.h \ pktdef.h \ poppack.h \ + powersetting.h \ powrprof.h \ prntvpt.h \ processthreadsapi.h \ diff --git a/include/powersetting.h b/include/powersetting.h new file mode 100644 index 00000000000..97b3dbb4b43 --- /dev/null +++ b/include/powersetting.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2025 Robert Lippmann + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _POWERSETTING_H +#define _POWERSETTING_H 1 + +#include <windef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +DWORD WINAPI PowerGetActiveScheme(HKEY UserRootPowerKey, GUID **polguid); +DWORD WINAPI PowerSetActiveScheme(HKEY UserRootPowerKey, GUID *polguid); + +#ifdef __cplusplus +} +#endif + +#endif /* _POWERSETTING_H */