File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1+ * .exe
2+ * .obj
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ Sample output:
1414It can optionally show verbose information and prevent sleep. Use option --help
1515to see the usage information.
1616
17- g++ -std=c++11 -o battstatus battstatus.cpp -lntdll -lpowrprof
17+ cl /W4 /wd4127 battstatus.cpp user32.lib powrprof.lib
18+ g++ -Wall -std=c++11 -o battstatus battstatus.cpp -lpowrprof
1819
1920https://github.com/jay/battstatus
2021*/ /*
@@ -36,9 +37,26 @@ GNU General Public License for more details.
3637
3738#define _WIN32_WINNT 0x0501
3839
40+ #ifndef _CRT_SECURE_NO_WARNINGS
41+ #define _CRT_SECURE_NO_WARNINGS
42+ #endif
43+
44+ #define WIN32_NO_STATUS
3945#include < windows.h>
40- #include < powrprof.h>
46+ #undef WIN32_NO_STATUS
47+
48+ #ifdef __MINGW32__
49+ #include < _mingw.h>
50+ #ifdef __MINGW64_VERSION_MAJOR
51+ #include < ntstatus.h>
52+ #else
4153#include < ddk/ntddk.h>
54+ #endif
55+ #else
56+ #include < ntstatus.h>
57+ #endif
58+
59+ #include < powrprof.h>
4260
4361#include < assert.h>
4462#include < limits.h>
@@ -562,6 +580,10 @@ cerr <<
562580
563581int main (int argc, char *argv[])
564582{
583+ NTSTATUS (NTAPI *RtlGetVersion)(RTL_OSVERSIONINFOW *lpVersionInformation) =
584+ (NTSTATUS (NTAPI *)(RTL_OSVERSIONINFOW *))
585+ GetProcAddress (GetModuleHandleW (L" ntdll" ), " RtlGetVersion" );
586+
565587 os.dwOSVersionInfoSize = sizeof os;
566588 RtlGetVersion (&os);
567589
You can’t perform that action at this time.
0 commit comments