From c428f382a5f1eae2573a4050e7ca3fa9c5ec466e Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Fri, 24 Mar 2023 21:42:34 +0530
Subject: [PATCH 1/2] headers: Add powerbase.h

Required for Java.
https://github.com/openjdk/jdk/blob/master/src/hotspot/os/windows/os_windows.cpp

Signed-off-by: Biswapriyo Nath <[email protected]>
---
 mingw-w64-headers/include/powerbase.h | 58 +++++++++++++++++++++++++++
 mingw-w64-headers/include/powrprof.h  | 20 ++++-----
 2 files changed, 66 insertions(+), 12 deletions(-)
 create mode 100644 mingw-w64-headers/include/powerbase.h

diff --git a/mingw-w64-headers/include/powerbase.h 
b/mingw-w64-headers/include/powerbase.h
new file mode 100644
index 0000000..599655d
--- /dev/null
+++ b/mingw-w64-headers/include/powerbase.h
@@ -0,0 +1,58 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#ifndef _POWERBASE_H_
+#define _POWERBASE_H_
+
+#include <apiset.h>
+#include <apisetcconv.h>
+
+#ifdef _CONTRACT_GEN
+#include <nt.h>
+#include <ntrtl.h>
+#include <nturtl.h>
+#include <minwindef.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+
+#ifndef _HPOWERNOTIFY_DEF_
+#define _HPOWERNOTIFY_DEF_
+
+typedef PVOID HPOWERNOTIFY, *PHPOWERNOTIFY;
+
+#endif /* _HPOWERNOTIFY_DEF_ */
+
+#ifndef NT_SUCCESS
+#define NTSTATUS LONG
+#define _OVERRIDE_NTSTATUS_
+#endif
+
+NTSTATUS WINAPI CallNtPowerInformation(POWER_INFORMATION_LEVEL 
InformationLevel, PVOID InputBuffer, ULONG InputBufferLength, PVOID 
OutputBuffer, ULONG OutputBufferLength);
+
+#ifdef _OVERRIDE_NTSTATUS_
+#undef NTSTATUS
+#endif
+
+BOOLEAN WINAPI GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES lpspc);
+
+#if (NTDDI_VERSION >= NTDDI_WIN8)
+POWER_PLATFORM_ROLE WINAPI PowerDeterminePlatformRoleEx(ULONG Version);
+DWORD WINAPI PowerRegisterSuspendResumeNotification(DWORD Flags, HANDLE 
Recipient, PHPOWERNOTIFY RegistrationHandle);
+DWORD WINAPI PowerUnregisterSuspendResumeNotification(HPOWERNOTIFY 
RegistrationHandle);
+#endif
+
+#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _POWERBASE_H_ */
diff --git a/mingw-w64-headers/include/powrprof.h 
b/mingw-w64-headers/include/powrprof.h
index 9545afe..d9ff756 100644
--- a/mingw-w64-headers/include/powrprof.h
+++ b/mingw-w64-headers/include/powrprof.h
@@ -3,6 +3,12 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
+
+#ifndef _POWRPROF_H_
+#define _POWRPROF_H_
+
+#include <powerbase.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -104,7 +110,6 @@ extern "C" {
   BOOLEAN WINAPI DeletePwrScheme(UINT);
   BOOLEAN WINAPI GetActivePwrScheme(PUINT);
   BOOLEAN WINAPI SetActivePwrScheme(UINT,PGLOBAL_POWER_POLICY,PPOWER_POLICY);
-  BOOLEAN WINAPI GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES);
   BOOLEAN WINAPI IsPwrSuspendAllowed(VOID);
   BOOLEAN WINAPI IsPwrHibernateAllowed(VOID);
   BOOLEAN WINAPI IsPwrShutdownAllowed(VOID);
@@ -516,17 +521,8 @@ DWORD WINAPI PowerWriteValueUnitsSpecifier(
 
 #endif /*(_WIN32_WINNT >= 0x0600)*/
 
-#ifndef NT_SUCCESS
-#define NTSTATUS LONG
-#define _OVERRIDE_NTSTATUS_
-#endif
-
-  NTSTATUS WINAPI 
CallNtPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG);
-
-#ifdef _OVERRIDE_NTSTATUS_
-#undef NTSTATUS
-#endif
-
 #ifdef __cplusplus
 }
 #endif
+
+#endif /* _POWRPROF_H_ */
-- 
2.40.0

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to