mirror of
https://github.com/reactos/reactos.git
synced 2025-05-11 13:27:47 +00:00
- Fork powrprof.dll
- Replace .spec with .def - Implement EnumPwrSchemes - Implement GetActivePwrScheme - Implement DeletePwrScheme svn path=/trunk/; revision=33986
This commit is contained in:
parent
abae3b6913
commit
3b3c516d31
6 changed files with 572 additions and 364 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2005 Benjamin Cutler
|
* Copyright (C) 2005 Benjamin Cutler
|
||||||
|
* Copyright (C) 2008 Dmitry Chapyshev
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -19,335 +20,563 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "ntstatus.h"
|
#include <ntstatus.h>
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
#include "windef.h"
|
#include <windows.h>
|
||||||
#include "winbase.h"
|
#include <winternl.h>
|
||||||
#include "winnt.h"
|
#include <powrprof.h>
|
||||||
#include "winreg.h"
|
#include <wchar.h>
|
||||||
#include "winternl.h"
|
#include <stdio.h>
|
||||||
#include "powrprof.h"
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(powrprof);
|
WINE_DEFAULT_DEBUG_CHANNEL(powrprof);
|
||||||
|
|
||||||
/* Notes to implementors:
|
|
||||||
* #1: The native implementation of these functions attempted to read in
|
|
||||||
* registry entries that I was unable to locate on any of the Windows
|
|
||||||
* machines I checked, but I only had desktops available, so maybe
|
|
||||||
* laptop users will have better luck. They return FNF errors because
|
|
||||||
* that's what the native DLL was returning during my tests.
|
|
||||||
* #2: These functions call NtPowerInformation but I don't know what they
|
|
||||||
* do with the results, and NtPowerInformation doesn't do much in WINE yet
|
|
||||||
* anyway.
|
|
||||||
* #3: Since I can't get several other functions working (see note #1),
|
|
||||||
* implementing these functions is going to have to wait until somebody can
|
|
||||||
* cobble together some sane test input. */
|
|
||||||
|
|
||||||
static const WCHAR szPowerCfgSubKey[] = { 'S', 'o', 'f', 't', 'w', 'a', 'r', 'e',
|
static const WCHAR szPowerCfgSubKey[] =
|
||||||
'\\', 'M', 'i', 'c', 'r', 'o', 's', 'o', 'f', 't', '\\', 'W', 'i',
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\PowerCfg";
|
||||||
'n', 'd', 'o', 'w', 's', '\\', 'C', 'u', 'r', 'r', 'e', 'n', 't',
|
static const WCHAR szSemaphoreName[] = L"PowerProfileRegistrySemaphore";
|
||||||
'V', 'e', 'r', 's', 'i', 'o', 'n', '\\', 'C', 'o', 'n', 't', 'r',
|
static const WCHAR szDiskMax[] = L"DiskSpindownMax";
|
||||||
'o', 'l', 's', ' ', 'F', 'o', 'l', 'd', 'e', 'r', '\\', 'P', 'o',
|
static const WCHAR szDiskMin[] = L"DiskSpindownMin";
|
||||||
'w', 'e', 'r', 'C', 'f', 'g', 0 };
|
static const WCHAR szLastID[] = L"LastID";
|
||||||
static const WCHAR szSemaphoreName[] = { 'P', 'o', 'w', 'e', 'r', 'P', 'r', 'o',
|
|
||||||
'f', 'i', 'l', 'e', 'R', 'e', 'g', 'i', 's', 't', 'r', 'y', 'S',
|
|
||||||
'e', 'm', 'a', 'p', 'h', 'o', 'r', 'e', 0 };
|
|
||||||
static const WCHAR szDiskMax[] = { 'D', 'i', 's', 'k', 'S', 'p', 'i', 'n', 'd',
|
|
||||||
'o', 'w', 'n', 'M', 'a', 'x', 0 };
|
|
||||||
static const WCHAR szDiskMin[] = { 'D', 'i', 's', 'k', 'S', 'p', 'i', 'n', 'd',
|
|
||||||
'o', 'w', 'n', 'M', 'i', 'n', 0 };
|
|
||||||
static const WCHAR szLastID[] = { 'L', 'a', 's', 't', 'I', 'D', 0 };
|
|
||||||
static HANDLE PPRegSemaphore = NULL;
|
|
||||||
|
|
||||||
NTSTATUS WINAPI CallNtPowerInformation(
|
HANDLE PPRegSemaphore = NULL;
|
||||||
POWER_INFORMATION_LEVEL InformationLevel,
|
|
||||||
PVOID lpInputBuffer, ULONG nInputBufferSize,
|
NTSTATUS WINAPI
|
||||||
PVOID lpOutputBuffer, ULONG nOutputBufferSize)
|
CallNtPowerInformation(POWER_INFORMATION_LEVEL InformationLevel,
|
||||||
|
PVOID lpInputBuffer,
|
||||||
|
ULONG nInputBufferSize,
|
||||||
|
PVOID lpOutputBuffer,
|
||||||
|
ULONG nOutputBufferSize)
|
||||||
{
|
{
|
||||||
return NtPowerInformation(InformationLevel, lpInputBuffer,
|
return NtPowerInformation(InformationLevel,
|
||||||
nInputBufferSize, lpOutputBuffer, nOutputBufferSize);
|
lpInputBuffer,
|
||||||
|
nInputBufferSize,
|
||||||
|
lpOutputBuffer,
|
||||||
|
nOutputBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN WINAPI CanUserWritePwrScheme(VOID)
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
CanUserWritePwrScheme(VOID)
|
||||||
{
|
{
|
||||||
HKEY hKey = NULL;
|
HKEY hKey = NULL;
|
||||||
LONG r;
|
LONG Ret;
|
||||||
BOOLEAN bSuccess = TRUE;
|
BOOLEAN bSuccess = TRUE;
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ | KEY_WRITE, &hKey);
|
Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ | KEY_WRITE, &hKey);
|
||||||
|
|
||||||
if (r != ERROR_SUCCESS) {
|
if (Ret != ERROR_SUCCESS)
|
||||||
TRACE("RegOpenKeyEx failed: %d\n", r);
|
{
|
||||||
bSuccess = FALSE;
|
TRACE("RegOpenKeyEx failed: %d\n", Ret);
|
||||||
}
|
bSuccess = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
SetLastError(r);
|
SetLastError(Ret);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN WINAPI DeletePwrScheme(UINT uiIndex)
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
DeletePwrScheme(UINT uiIndex)
|
||||||
{
|
{
|
||||||
/* FIXME: See note #1 */
|
WCHAR Buf[MAX_PATH];
|
||||||
FIXME("(%d) stub!\n", uiIndex);
|
UINT Current;
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
LONG Err;
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI EnumPwrSchemes(PWRSCHEMESENUMPROC lpfnPwrSchemesEnumProc,
|
swprintf(Buf, L"Control Panel\\PowerCfg\\PowerPolicies\\%u", uiIndex);
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #1 */
|
|
||||||
FIXME("(%p, %ld) stub!\n", lpfnPwrSchemesEnumProc, lParam);
|
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI GetActivePwrScheme(PUINT puiID)
|
if (GetActivePwrScheme(&Current))
|
||||||
{
|
{
|
||||||
/* FIXME: See note #1 */
|
if (Current == uiIndex)
|
||||||
FIXME("(%p) stub!\n", puiID);
|
{
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
SetLastError(ERROR_ACCESS_DENIED);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI GetCurrentPowerPolicies(
|
|
||||||
PGLOBAL_POWER_POLICY pGlobalPowerPolicy,
|
|
||||||
PPOWER_POLICY pPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #2 */
|
|
||||||
SYSTEM_POWER_POLICY ACPower, DCPower;
|
|
||||||
|
|
||||||
FIXME("(%p, %p) stub!\n", pGlobalPowerPolicy, pPowerPolicy);
|
|
||||||
|
|
||||||
NtPowerInformation(SystemPowerPolicyAc, 0, 0, &ACPower, sizeof(SYSTEM_POWER_POLICY));
|
|
||||||
NtPowerInformation(SystemPowerPolicyDc, 0, 0, &DCPower, sizeof(SYSTEM_POWER_POLICY));
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI GetPwrCapabilities(
|
|
||||||
PSYSTEM_POWER_CAPABILITIES lpSystemPowerCapabilities)
|
|
||||||
{
|
|
||||||
NTSTATUS r;
|
|
||||||
|
|
||||||
TRACE("(%p)\n", lpSystemPowerCapabilities);
|
|
||||||
|
|
||||||
r = NtPowerInformation(SystemPowerCapabilities, 0, 0, lpSystemPowerCapabilities, sizeof(SYSTEM_POWER_CAPABILITIES));
|
|
||||||
|
|
||||||
SetLastError(RtlNtStatusToDosError(r));
|
|
||||||
|
|
||||||
return r == STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI GetPwrDiskSpindownRange(PUINT RangeMax, PUINT RangeMin)
|
|
||||||
{
|
|
||||||
HKEY hKey;
|
|
||||||
BYTE lpValue[40];
|
|
||||||
LONG r;
|
|
||||||
DWORD cbValue = sizeof(lpValue);
|
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", RangeMax, RangeMin);
|
|
||||||
|
|
||||||
if (RangeMax == NULL || RangeMin == NULL) {
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetLastError(ERROR_SUCCESS);
|
|
||||||
|
|
||||||
WaitForSingleObject(PPRegSemaphore, INFINITE);
|
|
||||||
|
|
||||||
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ, &hKey);
|
|
||||||
if (r != ERROR_SUCCESS) {
|
|
||||||
TRACE("RegOpenKeyEx failed: %d\n", r);
|
|
||||||
TRACE("Using defaults: 3600, 3\n");
|
|
||||||
*RangeMax = 3600;
|
|
||||||
*RangeMin = 3;
|
|
||||||
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = RegQueryValueExW(hKey, szDiskMax, 0, 0, lpValue, &cbValue);
|
|
||||||
if (r != ERROR_SUCCESS) {
|
|
||||||
TRACE("Couldn't open DiskSpinDownMax: %d\n", r);
|
|
||||||
TRACE("Using default: 3600\n");
|
|
||||||
*RangeMax = 3600;
|
|
||||||
} else {
|
|
||||||
*RangeMax = atoiW((LPCWSTR)lpValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
cbValue = sizeof(lpValue);
|
|
||||||
|
|
||||||
r = RegQueryValueExW(hKey, szDiskMin, 0, 0, lpValue, &cbValue);
|
|
||||||
if (r != ERROR_SUCCESS) {
|
|
||||||
TRACE("Couldn't open DiskSpinDownMin: %d\n", r);
|
|
||||||
TRACE("Using default: 3\n");
|
|
||||||
*RangeMin = 3;
|
|
||||||
} else {
|
|
||||||
*RangeMin = atoiW((LPCWSTR)lpValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
|
|
||||||
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI IsAdminOverrideActive(PADMINISTRATOR_POWER_POLICY p)
|
|
||||||
{
|
|
||||||
FIXME("( %p) stub!\n", p);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI IsPwrHibernateAllowed(VOID)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #2 */
|
|
||||||
SYSTEM_POWER_CAPABILITIES PowerCaps;
|
|
||||||
FIXME("() stub!\n");
|
|
||||||
NtPowerInformation(SystemPowerCapabilities, NULL, 0, &PowerCaps, sizeof(PowerCaps));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI IsPwrShutdownAllowed(VOID)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #2 */
|
|
||||||
SYSTEM_POWER_CAPABILITIES PowerCaps;
|
|
||||||
FIXME("() stub!\n");
|
|
||||||
NtPowerInformation(SystemPowerCapabilities, NULL, 0, &PowerCaps, sizeof(PowerCaps));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI IsPwrSuspendAllowed(VOID)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #2 */
|
|
||||||
SYSTEM_POWER_CAPABILITIES PowerCaps;
|
|
||||||
FIXME("() stub!\n");
|
|
||||||
NtPowerInformation(SystemPowerCapabilities, NULL, 0, &PowerCaps, sizeof(PowerCaps));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #1 */
|
|
||||||
FIXME("(%p) stub!\n", pGlobalPowerPolicy);
|
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI ReadProcessorPwrScheme(UINT uiID,
|
|
||||||
PMACHINE_PROCESSOR_POWER_POLICY pMachineProcessorPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #1 */
|
|
||||||
FIXME("(%d, %p) stub!\n", uiID, pMachineProcessorPowerPolicy);
|
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI ReadPwrScheme(UINT uiID,
|
|
||||||
PPOWER_POLICY pPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #1 */
|
|
||||||
FIXME("(%d, %p) stub!\n", uiID, pPowerPolicy);
|
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI SetActivePwrScheme(UINT uiID,
|
|
||||||
PGLOBAL_POWER_POLICY lpGlobalPowerPolicy,
|
|
||||||
PPOWER_POLICY lpPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #1 */
|
|
||||||
FIXME("(%d, %p, %p) stub!\n", uiID, lpGlobalPowerPolicy, lpPowerPolicy);
|
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical,
|
|
||||||
BOOLEAN DisableWakeEvent)
|
|
||||||
{
|
|
||||||
/* FIXME: I have NO idea how you're supposed to call NtInitiatePowerAction
|
|
||||||
* here, because it's not a documented function that I can find */
|
|
||||||
FIXME("(%d, %d, %d) stub!\n", Hibernate, ForceCritical, DisableWakeEvent);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI WriteGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #3 */
|
|
||||||
FIXME("(%p) stub!\n", pGlobalPowerPolicy);
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI WriteProcessorPwrScheme(UINT ID,
|
|
||||||
PMACHINE_PROCESSOR_POWER_POLICY pMachineProcessorPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #3 */
|
|
||||||
FIXME("(%d, %p) stub!\n", ID, pMachineProcessorPowerPolicy);
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI WritePwrScheme(PUINT puiID, LPWSTR lpszName, LPWSTR lpszDescription,
|
|
||||||
PPOWER_POLICY pPowerPolicy)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #3 */
|
|
||||||
FIXME("(%p, %s, %s, %p) stub!\n", puiID, debugstr_w(lpszName), debugstr_w(lpszDescription), pPowerPolicy);
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN WINAPI ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP)
|
|
||||||
{
|
|
||||||
/* FIXME: See note #3 */
|
|
||||||
FIXME("(%p, %p) stub!\n", pGPP, pPP);
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
||||||
{
|
|
||||||
FIXME("(%p, %d, %p) not fully implemented\n", hinstDLL, fdwReason, lpvReserved);
|
|
||||||
|
|
||||||
switch(fdwReason) {
|
|
||||||
case DLL_PROCESS_ATTACH: {
|
|
||||||
|
|
||||||
HKEY hKey;
|
|
||||||
LONG r;
|
|
||||||
|
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
|
||||||
|
|
||||||
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ | KEY_WRITE, &hKey);
|
|
||||||
|
|
||||||
if (r != ERROR_SUCCESS) {
|
|
||||||
TRACE("Couldn't open registry key HKLM\\%s, using some sane(?) defaults\n", debugstr_w(szPowerCfgSubKey));
|
|
||||||
} else {
|
|
||||||
BYTE lpValue[40];
|
|
||||||
DWORD cbValue = sizeof(lpValue);
|
|
||||||
r = RegQueryValueExW(hKey, szLastID, 0, 0, lpValue, &cbValue);
|
|
||||||
if (r != ERROR_SUCCESS) {
|
|
||||||
TRACE("Couldn't open registry entry HKLM\\%s\\LastID, using some sane(?) defaults\n", debugstr_w(szPowerCfgSubKey));
|
|
||||||
}
|
|
||||||
RegCloseKey(hKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
PPRegSemaphore = CreateSemaphoreW(NULL, 1, 1, szSemaphoreName);
|
|
||||||
if (PPRegSemaphore == NULL) {
|
|
||||||
ERR("Couldn't create Semaphore: %d\n", GetLastError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
}
|
{
|
||||||
case DLL_PROCESS_DETACH:
|
Err = RegDeleteKey(HKEY_CURRENT_USER, (LPCTSTR) Buf);
|
||||||
CloseHandle(PPRegSemaphore);
|
if (Err != ERROR_SUCCESS)
|
||||||
break;
|
{
|
||||||
|
TRACE("RegDeleteKey failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static BOOLEAN
|
||||||
|
POWRPROF_GetUserPowerPolicy(HKEY hKey, LPWSTR szNum,
|
||||||
|
USER_POWER_POLICY userPwrPolicy,
|
||||||
|
DWORD *dwName, LPWSTR szName,
|
||||||
|
DWORD *dwDesc, LPWSTR szDesc)
|
||||||
|
{
|
||||||
|
HKEY hSubKey;
|
||||||
|
DWORD dwSize;
|
||||||
|
LONG Err;
|
||||||
|
|
||||||
|
Err = RegOpenKeyW(hKey, szNum, &hSubKey);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegOpenKeyW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*dwName = MAX_PATH * sizeof(WCHAR);
|
||||||
|
Err = RegQueryValueExW(hSubKey, L"Name", NULL, NULL, (LPBYTE)szName, dwName);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegQueryValueExW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*dwDesc = MAX_PATH * sizeof(WCHAR);
|
||||||
|
Err = RegQueryValueExW(hSubKey, L"Description", NULL, NULL, (LPBYTE)szDesc, dwDesc);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegQueryValueExW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwSize = sizeof(USER_POWER_POLICY);
|
||||||
|
Err = RegQueryValueExW(hSubKey, L"Policies", NULL, NULL, (LPBYTE)&userPwrPolicy, &dwSize);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegQueryValueExW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOLEAN
|
||||||
|
POWRPROF_GetMachinePowerPolicy(LPWSTR szNum, MACHINE_POWER_POLICY machinePwrPolicy)
|
||||||
|
{
|
||||||
|
HKEY hKey;
|
||||||
|
LONG Err;
|
||||||
|
WCHAR szPath[MAX_PATH];
|
||||||
|
DWORD dwSize;
|
||||||
|
|
||||||
|
swprintf(szPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\PowerCfg\\PowerPolicies\\%s", szNum);
|
||||||
|
|
||||||
|
Err = RegOpenKeyW(HKEY_LOCAL_MACHINE, szPath, &hKey);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegOpenKeyW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwSize = sizeof(MACHINE_POWER_POLICY);
|
||||||
|
Err = RegQueryValueExW(hKey, L"Policies", NULL, NULL, (LPBYTE)&machinePwrPolicy, &dwSize);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegQueryValueExW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
EnumPwrSchemes(PWRSCHEMESENUMPROC lpfnPwrSchemesEnumProc,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
HKEY hKey;
|
||||||
|
LONG Err;
|
||||||
|
DWORD dwSize, dwNameSize, dwDescSize, dwIndex = 0;
|
||||||
|
WCHAR szNum[3 + 1], szName[MAX_PATH], szDesc[MAX_PATH];
|
||||||
|
PPOWER_POLICY pPwrPolicy;
|
||||||
|
USER_POWER_POLICY userPwrPolicy;
|
||||||
|
MACHINE_POWER_POLICY machinePwrPolicy;
|
||||||
|
|
||||||
|
if (!lpfnPwrSchemesEnumProc)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Err = RegOpenKeyW(HKEY_CURRENT_USER, L"Control Panel\\PowerCfg\\PowerPolicies", &hKey);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegOpenKeyW failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
||||||
|
|
||||||
|
dwSize = sizeof(szNum) / sizeof(WCHAR);
|
||||||
|
|
||||||
|
while (RegEnumKeyExW(hKey, dwIndex, szNum, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
if (!POWRPROF_GetUserPowerPolicy(hKey, szNum, userPwrPolicy,
|
||||||
|
&dwNameSize, szName,
|
||||||
|
&dwDescSize, szDesc))
|
||||||
|
{
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!POWRPROF_GetMachinePowerPolicy(szNum, machinePwrPolicy))
|
||||||
|
{
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeroMemory(&pPwrPolicy, sizeof(PPOWER_POLICY));
|
||||||
|
pPwrPolicy->user = userPwrPolicy;
|
||||||
|
pPwrPolicy->mach = machinePwrPolicy;
|
||||||
|
|
||||||
|
if (!lpfnPwrSchemesEnumProc(_wtoi(szNum), dwNameSize, szName, dwDescSize, szDesc, pPwrPolicy, lParam))
|
||||||
|
break;
|
||||||
|
|
||||||
|
dwSize = sizeof(szNum) / sizeof(WCHAR);
|
||||||
|
dwIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
GetActivePwrScheme(PUINT puiID)
|
||||||
|
{
|
||||||
|
HKEY hKey;
|
||||||
|
WCHAR szBuf[MAX_PATH];
|
||||||
|
DWORD dwSize;
|
||||||
|
LONG Err;
|
||||||
|
|
||||||
|
TRACE("GetActivePwrScheme(%u)", puiID);
|
||||||
|
|
||||||
|
Err = RegOpenKeyW(HKEY_CURRENT_USER, L"Control Panel\\PowerCfg", &hKey);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegOpenKey failed: %d\n", Err);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwSize = MAX_PATH;
|
||||||
|
Err = RegQueryValueExW(hKey, L"CurrentPowerPolicy",
|
||||||
|
NULL, NULL,
|
||||||
|
(LPBYTE)&szBuf, &dwSize);
|
||||||
|
if (Err != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("RegQueryValueEx failed: %d\n", Err);
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
SetLastError(Err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*puiID = _wtoi(szBuf);
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
GetCurrentPowerPolicies(PGLOBAL_POWER_POLICY pGlobalPowerPolicy,
|
||||||
|
PPOWER_POLICY pPowerPolicy)
|
||||||
|
{
|
||||||
|
SYSTEM_POWER_POLICY ACPower, DCPower;
|
||||||
|
|
||||||
|
FIXME("(%p, %p) stub!\n", pGlobalPowerPolicy, pPowerPolicy);
|
||||||
|
|
||||||
|
NtPowerInformation(SystemPowerPolicyAc, 0, 0, &ACPower, sizeof(SYSTEM_POWER_POLICY));
|
||||||
|
NtPowerInformation(SystemPowerPolicyDc, 0, 0, &DCPower, sizeof(SYSTEM_POWER_POLICY));
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES lpSystemPowerCapabilities)
|
||||||
|
{
|
||||||
|
NTSTATUS Ret;
|
||||||
|
|
||||||
|
TRACE("(%p)\n", lpSystemPowerCapabilities);
|
||||||
|
|
||||||
|
if (!lpSystemPowerCapabilities)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = NtPowerInformation(SystemPowerCapabilities, 0, 0, lpSystemPowerCapabilities, sizeof(SYSTEM_POWER_CAPABILITIES));
|
||||||
|
|
||||||
|
SetLastError(RtlNtStatusToDosError(Ret));
|
||||||
|
|
||||||
|
if (Ret == STATUS_SUCCESS)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
GetPwrDiskSpindownRange(PUINT RangeMax, PUINT RangeMin)
|
||||||
|
{
|
||||||
|
HKEY hKey;
|
||||||
|
BYTE lpValue[40];
|
||||||
|
LONG Ret;
|
||||||
|
DWORD cbValue = sizeof(lpValue);
|
||||||
|
|
||||||
|
TRACE("(%p, %p)\n", RangeMax, RangeMin);
|
||||||
|
|
||||||
|
if (RangeMax == NULL || RangeMin == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
|
||||||
|
WaitForSingleObject(PPRegSemaphore, INFINITE);
|
||||||
|
|
||||||
|
Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ, &hKey);
|
||||||
|
if (Ret != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
TRACE("RegOpenKeyEx failed: %d\n", Ret);
|
||||||
|
TRACE("Using defaults: 3600, 3\n");
|
||||||
|
*RangeMax = 3600;
|
||||||
|
*RangeMin = 3;
|
||||||
|
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = RegQueryValueExW(hKey, szDiskMax, 0, 0, lpValue, &cbValue);
|
||||||
|
if (Ret != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
TRACE("Couldn't open DiskSpinDownMax: %d\n", Ret);
|
||||||
|
TRACE("Using default: 3600\n");
|
||||||
|
*RangeMax = 3600;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*RangeMax = _wtoi((LPCWSTR)lpValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
cbValue = sizeof(lpValue);
|
||||||
|
|
||||||
|
Ret = RegQueryValueExW(hKey, szDiskMin, 0, 0, lpValue, &cbValue);
|
||||||
|
if (Ret != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
TRACE("Couldn't open DiskSpinDownMin: %d\n", Ret);
|
||||||
|
TRACE("Using default: 3\n");
|
||||||
|
*RangeMin = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*RangeMin = _wtoi((LPCWSTR)lpValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
|
ReleaseSemaphore(PPRegSemaphore, 1, NULL);
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
IsAdminOverrideActive(PADMINISTRATOR_POWER_POLICY p)
|
||||||
|
{
|
||||||
|
FIXME("( %p) stub!\n", p);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
IsPwrHibernateAllowed(VOID)
|
||||||
|
{
|
||||||
|
SYSTEM_POWER_CAPABILITIES PowerCaps;
|
||||||
|
FIXME("() stub!\n");
|
||||||
|
NtPowerInformation(SystemPowerCapabilities, NULL, 0, &PowerCaps, sizeof(PowerCaps));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
IsPwrShutdownAllowed(VOID)
|
||||||
|
{
|
||||||
|
SYSTEM_POWER_CAPABILITIES PowerCaps;
|
||||||
|
FIXME("() stub!\n");
|
||||||
|
NtPowerInformation(SystemPowerCapabilities, NULL, 0, &PowerCaps, sizeof(PowerCaps));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
IsPwrSuspendAllowed(VOID)
|
||||||
|
{
|
||||||
|
SYSTEM_POWER_CAPABILITIES PowerCaps;
|
||||||
|
FIXME("() stub!\n");
|
||||||
|
NtPowerInformation(SystemPowerCapabilities, NULL, 0, &PowerCaps, sizeof(PowerCaps));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%p) stub!\n", pGlobalPowerPolicy);
|
||||||
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
ReadProcessorPwrScheme(UINT uiID,
|
||||||
|
PMACHINE_PROCESSOR_POWER_POLICY pMachineProcessorPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%d, %p) stub!\n", uiID, pMachineProcessorPowerPolicy);
|
||||||
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
ReadPwrScheme(UINT uiID,
|
||||||
|
PPOWER_POLICY pPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%d, %p) stub!\n", uiID, pPowerPolicy);
|
||||||
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
SetActivePwrScheme(UINT uiID,
|
||||||
|
PGLOBAL_POWER_POLICY lpGlobalPowerPolicy,
|
||||||
|
PPOWER_POLICY lpPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%d, %p, %p) stub!\n", uiID, lpGlobalPowerPolicy, lpPowerPolicy);
|
||||||
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
SetSuspendState(BOOLEAN Hibernate,
|
||||||
|
BOOLEAN ForceCritical,
|
||||||
|
BOOLEAN DisableWakeEvent)
|
||||||
|
{
|
||||||
|
FIXME("(%d, %d, %d) stub!\n", Hibernate, ForceCritical, DisableWakeEvent);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
WriteGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%p) stub!\n", pGlobalPowerPolicy);
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
WriteProcessorPwrScheme(UINT ID,
|
||||||
|
PMACHINE_PROCESSOR_POWER_POLICY pMachineProcessorPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%d, %p) stub!\n", ID, pMachineProcessorPowerPolicy);
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
WritePwrScheme(PUINT puiID,
|
||||||
|
LPWSTR lpszName,
|
||||||
|
LPWSTR lpszDescription,
|
||||||
|
PPOWER_POLICY pPowerPolicy)
|
||||||
|
{
|
||||||
|
FIXME("(%p, %s, %s, %p) stub!\n", puiID, debugstr_w(lpszName), debugstr_w(lpszDescription), pPowerPolicy);
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN WINAPI
|
||||||
|
ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP)
|
||||||
|
{
|
||||||
|
FIXME("(%p, %p) stub!\n", pGPP, pPP);
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI
|
||||||
|
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
{
|
||||||
|
FIXME("(%p, %d, %p) not fully implemented\n", hinstDLL, fdwReason, lpvReserved);
|
||||||
|
|
||||||
|
switch(fdwReason)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
{
|
||||||
|
|
||||||
|
HKEY hKey;
|
||||||
|
LONG r;
|
||||||
|
|
||||||
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
|
|
||||||
|
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ | KEY_WRITE, &hKey);
|
||||||
|
|
||||||
|
if (r != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
TRACE("Couldn't open registry key HKLM\\%s, using some sane(?) defaults\n", debugstr_w(szPowerCfgSubKey));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BYTE lpValue[40];
|
||||||
|
DWORD cbValue = sizeof(lpValue);
|
||||||
|
r = RegQueryValueExW(hKey, szLastID, 0, 0, lpValue, &cbValue);
|
||||||
|
if (r != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
TRACE("Couldn't open registry entry HKLM\\%s\\LastID, using some sane(?) defaults\n", debugstr_w(szPowerCfgSubKey));
|
||||||
|
}
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
PPRegSemaphore = CreateSemaphoreW(NULL, 1, 1, szSemaphoreName);
|
||||||
|
if (PPRegSemaphore == NULL)
|
||||||
|
{
|
||||||
|
ERR("Couldn't create Semaphore: %d\n", GetLastError());
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
CloseHandle(PPRegSemaphore);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
23
reactos/dll/win32/powrprof/powrprof.def
Normal file
23
reactos/dll/win32/powrprof/powrprof.def
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
LIBRARY powrprof.dll
|
||||||
|
EXPORTS
|
||||||
|
CallNtPowerInformation@20
|
||||||
|
CanUserWritePwrScheme@0
|
||||||
|
DeletePwrScheme@4
|
||||||
|
EnumPwrSchemes@8
|
||||||
|
GetActivePwrScheme@4
|
||||||
|
GetCurrentPowerPolicies@8
|
||||||
|
GetPwrCapabilities@4
|
||||||
|
GetPwrDiskSpindownRange
|
||||||
|
IsAdminOverrideActive
|
||||||
|
IsPwrHibernateAllowed
|
||||||
|
IsPwrShutdownAllowed
|
||||||
|
IsPwrSuspendAllowed
|
||||||
|
ReadGlobalPwrPolicy@4
|
||||||
|
ReadProcessorPwrScheme
|
||||||
|
ReadPwrScheme@8
|
||||||
|
SetActivePwrScheme@12
|
||||||
|
SetSuspendState
|
||||||
|
WriteGlobalPwrPolicy@4
|
||||||
|
WriteProcessorPwrScheme
|
||||||
|
WritePwrScheme
|
||||||
|
ValidatePowerPolicies@8
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
<module name="powrprof" type="win32dll" baseaddress="${BASEADDRESS_POWRPROF}" installbase="system32" installname="powrprof.dll" allowwarnings="true">
|
<module name="powrprof" type="win32dll" baseaddress="${BASEADDRESS_POWRPROF}" installbase="system32" installname="powrprof.dll" unicode="yes">
|
||||||
<importlibrary definition="powrprof.spec.def" />
|
<importlibrary definition="powrprof.def" />
|
||||||
<include base="powrprof">.</include>
|
<include base="powrprof">.</include>
|
||||||
<include base="ReactOS">include/reactos/wine</include>
|
|
||||||
<define name="__WINESRC__" />
|
|
||||||
<define name="WINVER">0x600</define>
|
<define name="WINVER">0x600</define>
|
||||||
<define name="_WIN32_WINNT">0x600</define>
|
<define name="_WIN32_WINNT">0x600</define>
|
||||||
<library>wine</library>
|
<library>wine</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>ntdll</library>
|
<library>ntdll</library>
|
||||||
|
<library>user32</library>
|
||||||
|
<library>comctl32</library>
|
||||||
<file>powrprof.c</file>
|
<file>powrprof.c</file>
|
||||||
<file>powrprof.spec</file>
|
<file>powrprof.rc</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
7
reactos/dll/win32/powrprof/powrprof.rc
Normal file
7
reactos/dll/win32/powrprof/powrprof.rc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#define REACTOS_VERSION_DLL
|
||||||
|
#define REACTOS_STR_FILE_DESCRIPTION "Power Profile Helper DLL\0"
|
||||||
|
#define REACTOS_STR_INTERNAL_NAME "powrprof\0"
|
||||||
|
#define REACTOS_STR_ORIGINAL_FILENAME "powrprof.dll\0"
|
||||||
|
#include <reactos/version.rc>
|
|
@ -1,21 +0,0 @@
|
||||||
@ 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 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)
|
|
||||||
@ stdcall ValidatePowerPolicies (ptr ptr)
|
|
|
@ -1,30 +0,0 @@
|
||||||
Index: powrprof.c
|
|
||||||
===================================================================
|
|
||||||
--- powrprof.c (revision 26779)
|
|
||||||
+++ powrprof.c (working copy)
|
|
||||||
@@ -303,6 +303,15 @@
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
+BOOLEAN WINAPI ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP)
|
|
||||||
+{
|
|
||||||
+ /* FIXME: See note #3 */
|
|
||||||
+ FIXME("(%p, %p) stub!\n", pGPP, pPP);
|
|
||||||
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
+ return TRUE;
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
||||||
{
|
|
||||||
FIXME("(%p, %d, %p) not fully implemented\n", hinstDLL, fdwReason, lpvReserved);
|
|
||||||
Index: powrprof.spec
|
|
||||||
===================================================================
|
|
||||||
--- powrprof.spec (revision 26779)
|
|
||||||
+++ powrprof.spec (working copy)
|
|
||||||
@@ -18,3 +18,4 @@
|
|
||||||
@ stdcall WriteGlobalPwrPolicy (ptr)
|
|
||||||
@ stdcall WriteProcessorPwrScheme (long ptr)
|
|
||||||
@ stdcall WritePwrScheme (ptr str str ptr)
|
|
||||||
+@ stdcall ValidatePowerPolicies (ptr ptr)
|
|
||||||
\ No newline at end of file
|
|
Loading…
Reference in a new issue