This is an educated guess on what these would be, based on:
*) The power request APIs in kernel32.
*) The power request APIs exposed for drivers' use in ntoskrnl.
*) Other NtXxx calls.
Signed-off-by: Chip Davis <cdavis(a)codeweavers.com>
---
Notes:
v2: Move POWER_REQUEST_TYPE to winnt.h to try to fix the build.
dlls/ntdll/nt.c | 33 +++++++++++++++++++++++++++++++++
dlls/ntdll/ntdll.spec | 6 ++++++
include/winbase.h | 7 -------
include/winnt.h | 7 +++++++
include/winternl.h | 20 ++++++++++++++++++++
5 files changed, 66 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index cdfbd9fa822..a9985fbc224 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -3073,6 +3073,39 @@ NTSTATUS WINAPI NtSetThreadExecutionState( EXECUTION_STATE new_state, EXECUTION_
return STATUS_SUCCESS;
}
+/******************************************************************************
+ * NtCreatePowerRequest [NTDLL.@]
+ *
+ */
+NTSTATUS WINAPI NtCreatePowerRequest( HANDLE *handle, COUNTED_REASON_CONTEXT *context )
+{
+ FIXME( "(%p, %p): stub\n", handle, context );
+
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+/******************************************************************************
+ * NtSetPowerRequest [NTDLL.@]
+ *
+ */
+NTSTATUS WINAPI NtSetPowerRequest( HANDLE handle, POWER_REQUEST_TYPE type )
+{
+ FIXME( "(%p, %u): stub\n", handle, type );
+
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+/******************************************************************************
+ * NtClearPowerRequest [NTDLL.@]
+ *
+ */
+NTSTATUS WINAPI NtClearPowerRequest( HANDLE handle, POWER_REQUEST_TYPE type )
+{
+ FIXME( "(%p, %u): stub\n", handle, type );
+
+ return STATUS_NOT_IMPLEMENTED;
+}
+
#ifdef linux
/* Fallback using /proc/cpuinfo for Linux systems without cpufreq. For
* most distributions on recent enough hardware, this is only likely to
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 278699c7077..32b2f614468 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -142,6 +142,7 @@
@ stdcall NtCancelIoFileEx(long ptr ptr)
@ stdcall NtCancelTimer(long ptr)
@ stdcall NtClearEvent(long)
+@ stdcall NtClearPowerRequest(long long)
@ stdcall NtClose(long)
@ stub NtCloseObjectAuditAlarm
# @ stub NtCompactKeys
@@ -167,6 +168,7 @@
@ stdcall NtCreateNamedPipeFile(ptr long ptr ptr long long long long long long long long long ptr)
@ stdcall NtCreatePagingFile(ptr ptr ptr ptr)
@ stdcall NtCreatePort(ptr ptr long long ptr)
+@ stdcall NtCreatePowerRequest(ptr ptr)
@ stub NtCreateProcess
# @ stub NtCreateProcessEx
@ stub NtCreateProfile
@@ -374,6 +376,7 @@
@ stub NtSetLowEventPair
@ stub NtSetLowWaitHighEventPair
@ stub NtSetLowWaitHighThread
+@ stdcall NtSetPowerRequest(long long)
# @ stub NtSetQuotaInformationFile
@ stdcall NtSetSecurityObject(long long ptr)
@ stub NtSetSystemEnvironmentValue
@@ -1094,6 +1097,7 @@
@ stdcall -private ZwCancelIoFileEx(long ptr ptr) NtCancelIoFileEx
@ stdcall -private ZwCancelTimer(long ptr) NtCancelTimer
@ stdcall -private ZwClearEvent(long) NtClearEvent
+@ stdcall -private ZwClearPowerRequest(long long) NtClearPowerRequest
@ stdcall -private ZwClose(long) NtClose
@ stub ZwCloseObjectAuditAlarm
# @ stub ZwCompactKeys
@@ -1118,6 +1122,7 @@
@ stdcall -private ZwCreateNamedPipeFile(ptr long ptr ptr long long long long long long long long long ptr) NtCreateNamedPipeFile
@ stdcall -private ZwCreatePagingFile(ptr ptr ptr ptr) NtCreatePagingFile
@ stdcall -private ZwCreatePort(ptr ptr long long ptr) NtCreatePort
+@ stdcall -private ZwCreatePowerRequest(ptr ptr) NtCreatePowerRequest
@ stub ZwCreateProcess
# @ stub ZwCreateProcessEx
@ stub ZwCreateProfile
@@ -1323,6 +1328,7 @@
@ stub ZwSetLowEventPair
@ stub ZwSetLowWaitHighEventPair
@ stub ZwSetLowWaitHighThread
+@ stdcall -private ZwSetPowerRequest(long long) NtSetPowerRequest
# @ stub ZwSetQuotaInformationFile
@ stdcall -private ZwSetSecurityObject(long long ptr) NtSetSecurityObject
@ stub ZwSetSystemEnvironmentValue
diff --git a/include/winbase.h b/include/winbase.h
index 086a8b36459..9ee290a5b6c 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -966,13 +966,6 @@ typedef struct _SYSTEM_POWER_STATUS
DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
-typedef enum _POWER_REQUEST_TYPE
-{
- PowerRequestDisplayRequired,
- PowerRequestSystemRequired,
- PowerRequestAwayModeRequired
-} POWER_REQUEST_TYPE, *PPOWER_REQUEST_TYPE;
-
typedef struct _SYSTEM_INFO
{
union {
diff --git a/include/winnt.h b/include/winnt.h
index 40d883e3a92..a9ecd5a5a99 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -5582,6 +5582,13 @@ typedef struct _SYSTEM_POWER_POLICY {
} SYSTEM_POWER_POLICY,
*PSYSTEM_POWER_POLICY;
+typedef enum _POWER_REQUEST_TYPE
+{
+ PowerRequestDisplayRequired,
+ PowerRequestSystemRequired,
+ PowerRequestAwayModeRequired
+} POWER_REQUEST_TYPE, *PPOWER_REQUEST_TYPE;
+
typedef union _FILE_SEGMENT_ELEMENT {
PVOID64 Buffer;
ULONGLONG Alignment;
diff --git a/include/winternl.h b/include/winternl.h
index d6543917e64..fd898e93f05 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2070,6 +2070,23 @@ typedef enum _SHUTDOWN_ACTION {
ShutdownPowerOff
} SHUTDOWN_ACTION, *PSHUTDOWN_ACTION;
+typedef struct _COUNTED_REASON_CONTEXT
+{
+ ULONG Version;
+ ULONG Flags;
+ union
+ {
+ struct
+ {
+ UNICODE_STRING ResourceFileName;
+ USHORT ResourceReasonId;
+ ULONG StringCount;
+ UNICODE_STRING *ReasonStrings;
+ } DUMMYSTRUCTNAME;
+ UNICODE_STRING SimpleString;
+ } DUMMYUNIONNAME;
+} COUNTED_REASON_CONTEXT, *PCOUNTED_REASON_CONTEXT;
+
typedef enum _KPROFILE_SOURCE {
ProfileTime,
ProfileAlignmentFixup,
@@ -2326,6 +2343,7 @@ NTSYSAPI NTSTATUS WINAPI NtCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE,PIO_STATUS_BLOCK,PIO_STATUS_BLOCK);
NTSYSAPI NTSTATUS WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
NTSYSAPI NTSTATUS WINAPI NtClearEvent(HANDLE);
+NTSYSAPI NTSTATUS WINAPI NtClearPowerRequest(HANDLE,POWER_REQUEST_TYPE);
NTSYSAPI NTSTATUS WINAPI NtClose(HANDLE);
NTSYSAPI NTSTATUS WINAPI NtCloseObjectAuditAlarm(PUNICODE_STRING,HANDLE,BOOLEAN);
NTSYSAPI NTSTATUS WINAPI NtCompleteConnectPort(HANDLE);
@@ -2345,6 +2363,7 @@ NTSYSAPI NTSTATUS WINAPI NtCreateMutant(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIB
NTSYSAPI NTSTATUS WINAPI NtCreateNamedPipeFile(PHANDLE,ULONG,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,PLARGE_INTEGER);
NTSYSAPI NTSTATUS WINAPI NtCreatePagingFile(PUNICODE_STRING,PLARGE_INTEGER,PLARGE_INTEGER,PLARGE_INTEGER);
NTSYSAPI NTSTATUS WINAPI NtCreatePort(PHANDLE,POBJECT_ATTRIBUTES,ULONG,ULONG,PULONG);
+NTSYSAPI NTSTATUS WINAPI NtCreatePowerRequest(HANDLE*,COUNTED_REASON_CONTEXT*);
NTSYSAPI NTSTATUS WINAPI NtCreateProcess(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,BOOLEAN,HANDLE,HANDLE,HANDLE);
NTSYSAPI NTSTATUS WINAPI NtCreateProfile(PHANDLE,HANDLE,PVOID,ULONG,ULONG,PVOID,ULONG,KPROFILE_SOURCE,KAFFINITY);
NTSYSAPI NTSTATUS WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
@@ -2510,6 +2529,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG);
NTSYSAPI NTSTATUS WINAPI NtSetLowEventPair(HANDLE);
NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighEventPair(HANDLE);
NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighThread(VOID);
+NTSYSAPI NTSTATUS WINAPI NtSetPowerRequest(HANDLE,POWER_REQUEST_TYPE);
NTSYSAPI NTSTATUS WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
NTSYSAPI NTSTATUS WINAPI NtSetSystemEnvironmentValue(PUNICODE_STRING,PUNICODE_STRING);
NTSYSAPI NTSTATUS WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG);
--
2.21.0