20 #ifndef WINPR_SYSINFO_H
21 #define WINPR_SYSINFO_H
26 #include <winpr/winpr.h>
27 #include <winpr/wtypes.h>
36 #define PROCESSOR_ARCHITECTURE_INTEL 0
37 #define PROCESSOR_ARCHITECTURE_MIPS 1
38 #define PROCESSOR_ARCHITECTURE_ALPHA 2
39 #define PROCESSOR_ARCHITECTURE_PPC 3
40 #define PROCESSOR_ARCHITECTURE_SHX 4
41 #define PROCESSOR_ARCHITECTURE_ARM 5
42 #define PROCESSOR_ARCHITECTURE_IA64 6
43 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
44 #define PROCESSOR_ARCHITECTURE_MSIL 8
45 #define PROCESSOR_ARCHITECTURE_AMD64 9
46 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
47 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
48 #define PROCESSOR_ARCHITECTURE_ARM64 12
49 #define PROCESSOR_ARCHITECTURE_MIPS64 13
50 #define PROCESSOR_ARCHITECTURE_E2K 14
51 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
53 #define PROCESSOR_INTEL_386 386
54 #define PROCESSOR_INTEL_486 486
55 #define PROCESSOR_INTEL_PENTIUM 586
56 #define PROCESSOR_INTEL_IA64 2200
57 #define PROCESSOR_AMD_X8664 8664
58 #define PROCESSOR_MIPS_R4000 4000
59 #define PROCESSOR_ALPHA_21064 21064
60 #define PROCESSOR_PPC_601 601
61 #define PROCESSOR_PPC_603 603
62 #define PROCESSOR_PPC_604 604
63 #define PROCESSOR_PPC_620 620
64 #define PROCESSOR_HITACHI_SH3 10003
65 #define PROCESSOR_HITACHI_SH3E 10004
66 #define PROCESSOR_HITACHI_SH4 10005
67 #define PROCESSOR_MOTOROLA_821 821
68 #define PROCESSOR_SHx_SH3 103
69 #define PROCESSOR_SHx_SH4 104
70 #define PROCESSOR_STRONGARM 2577
71 #define PROCESSOR_ARM720 1824
72 #define PROCESSOR_ARM820 2080
73 #define PROCESSOR_ARM920 2336
74 #define PROCESSOR_ARM_7TDMI 70001
75 #define PROCESSOR_OPTIL 0x494F
85 WORD wProcessorArchitecture;
91 LPVOID lpMinimumApplicationAddress;
92 LPVOID lpMaximumApplicationAddress;
93 DWORD_PTR dwActiveProcessorMask;
94 DWORD dwNumberOfProcessors;
95 DWORD dwProcessorType;
96 DWORD dwAllocationGranularity;
98 WORD wProcessorRevision;
102 WINPR_API
void GetNativeSystemInfo(
LPSYSTEM_INFO lpSystemInfo);
104 #if defined(WITH_WINPR_DEPRECATED)
107 DWORD dwOSVersionInfoSize;
108 DWORD dwMajorVersion;
109 DWORD dwMinorVersion;
112 CHAR szCSDVersion[128];
113 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
117 DWORD dwOSVersionInfoSize;
118 DWORD dwMajorVersion;
119 DWORD dwMinorVersion;
122 WCHAR szCSDVersion[128];
123 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW;
127 DWORD dwOSVersionInfoSize;
128 DWORD dwMajorVersion;
129 DWORD dwMinorVersion;
132 CHAR szCSDVersion[128];
133 WORD wServicePackMajor;
134 WORD wServicePackMinor;
138 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
142 DWORD dwOSVersionInfoSize;
143 DWORD dwMajorVersion;
144 DWORD dwMinorVersion;
147 WCHAR szCSDVersion[128];
148 WORD wServicePackMajor;
149 WORD wServicePackMinor;
153 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
156 #define OSVERSIONINFO OSVERSIONINFOW
157 #define OSVERSIONINFOEX OSVERSIONINFOEXW
158 #define POSVERSIONINFO POSVERSIONINFOW
159 #define POSVERSIONINFOEX POSVERSIONINFOEXW
160 #define LPOSVERSIONINFO LPOSVERSIONINFOW
161 #define LPOSVERSIONINFOEX LPOSVERSIONINFOEXW
163 #define OSVERSIONINFO OSVERSIONINFOA
164 #define OSVERSIONINFOEX OSVERSIONINFOEXA
165 #define POSVERSIONINFO POSVERSIONINFOA
166 #define POSVERSIONINFOEX POSVERSIONINFOEXA
167 #define LPOSVERSIONINFO LPOSVERSIONINFOA
168 #define LPOSVERSIONINFOEX LPOSVERSIONINFOEXA
171 #define VER_PLATFORM_WIN32_NT 0x00000002
173 #define VER_SUITE_BACKOFFICE 0x00000004
174 #define VER_SUITE_BLADE 0x00000400
175 #define VER_SUITE_COMPUTE_SERVER 0x00004000
176 #define VER_SUITE_DATACENTER 0x00000080
177 #define VER_SUITE_ENTERPRISE 0x00000002
178 #define VER_SUITE_EMBEDDEDNT 0x00000040
179 #define VER_SUITE_PERSONAL 0x00000200
180 #define VER_SUITE_SINGLEUSERTS 0x00000100
181 #define VER_SUITE_SMALLBUSINESS 0x00000001
182 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
183 #define VER_SUITE_STORAGE_SERVER 0x00002000
184 #define VER_SUITE_TERMINAL 0x00000010
185 #define VER_SUITE_WH_SERVER 0x00008000
188 #define VER_NT_DOMAIN_CONTROLLER 0x0000002
189 #define VER_NT_SERVER 0x0000003
190 #define VER_NT_WORKSTATION 0x0000001
192 WINPR_API
void GetSystemTime(LPSYSTEMTIME lpSystemTime);
193 WINPR_API BOOL SetSystemTime(CONST
SYSTEMTIME* lpSystemTime);
194 WINPR_API VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
195 WINPR_API BOOL SetLocalTime(CONST
SYSTEMTIME* lpSystemTime);
197 WINPR_API VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
198 WINPR_API BOOL GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement,
199 PBOOL lpTimeAdjustmentDisabled);
201 WINPR_API BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature);
203 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
204 #define PF_FLOATING_POINT_EMULATED 1
205 #define PF_COMPARE_EXCHANGE_DOUBLE 2
206 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
207 #define PF_PPC_MOVEMEM_64BIT_OK 4
208 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
209 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
210 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
211 #define PF_PAE_ENABLED 9
212 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
213 #define PF_SSE_DAZ_MODE_AVAILABLE 11
214 #define PF_NX_ENABLED 12
215 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
216 #define PF_COMPARE_EXCHANGE128 14
217 #define PF_COMPARE64_EXCHANGE128 15
218 #define PF_CHANNELS_ENABLED 16
219 #define PF_XSAVE_ENABLED 17
220 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
221 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
222 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
223 #define PF_VIRT_FIRMWARE_ENABLED 21
224 #define PF_RDWRFSGSBASE_AVAILABLE 22
225 #define PF_FASTFAIL_AVAILABLE 23
226 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
227 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
228 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
229 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
230 #define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
231 #define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
232 #define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
233 #define PF_AVX_INSTRUCTIONS_AVAILABLE 39
234 #define PF_AVX2_INSTRUCTIONS_AVAILABLE 40
235 #define PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
236 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
237 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
238 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
239 #define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
240 #define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
241 #define PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE 44
242 #define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
244 #define PF_ARM_V4 0x80000001
245 #define PF_ARM_V5 0x80000002
246 #define PF_ARM_V6 0x80000003
247 #define PF_ARM_V7 0x80000004
248 #define PF_ARM_THUMB 0x80000005
249 #define PF_ARM_JAZELLE 0x80000006
250 #define PF_ARM_DSP 0x80000007
251 #define PF_ARM_MOVE_CP 0x80000008
252 #define PF_ARM_VFP10 0x80000009
253 #define PF_ARM_MPU 0x8000000A
254 #define PF_ARM_WRITE_BUFFER 0x8000000B
255 #define PF_ARM_MBX 0x8000000C
256 #define PF_ARM_L2CACHE 0x8000000D
257 #define PF_ARM_PHYSICALLY_TAGGED_CACHE 0x8000000E
258 #define PF_ARM_VFP_SINGLE_PRECISION 0x8000000F
259 #define PF_ARM_VFP_DOUBLE_PRECISION 0x80000010
260 #define PF_ARM_ITCM 0x80000011
261 #define PF_ARM_DTCM 0x80000012
262 #define PF_ARM_UNIFIED_CACHE 0x80000013
263 #define PF_ARM_WRITE_BACK_CACHE 0x80000014
264 #define PF_ARM_CACHE_CAN_BE_LOCKED_DOWN 0x80000015
265 #define PF_ARM_L2CACHE_MEMORY_MAPPED 0x80000016
266 #define PF_ARM_L2CACHE_COPROC 0x80000017
267 #define PF_ARM_THUMB2 0x80000018
268 #define PF_ARM_T2EE 0x80000019
269 #define PF_ARM_VFP3 0x8000001A
270 #define PF_ARM_NEON 0x8000001B
271 #define PF_ARM_UNALIGNED_ACCESS 0x8000001C
273 #define PF_ARM_INTEL_XSCALE 0x80010001
274 #define PF_ARM_INTEL_PMU 0x80010002
275 #define PF_ARM_INTEL_WMMX 0x80010003
279 #if !defined(_WIN32) || defined(_UWP)
281 #if defined(WITH_WINPR_DEPRECATED)
282 WINPR_API BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
283 WINPR_API BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation);
286 #define GetVersionEx GetVersionExW
288 #define GetVersionEx GetVersionExA
294 #if !defined(_WIN32) || defined(_UWP)
296 WINPR_API DWORD GetTickCount(
void);
301 ComputerNameDnsHostname,
302 ComputerNameDnsDomain,
303 ComputerNameDnsFullyQualified,
304 ComputerNamePhysicalNetBIOS,
305 ComputerNamePhysicalDnsHostname,
306 ComputerNamePhysicalDnsDomain,
307 ComputerNamePhysicalDnsFullyQualified,
309 } COMPUTER_NAME_FORMAT;
311 #define MAX_COMPUTERNAME_LENGTH 31
313 WINPR_API BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize);
314 WINPR_API BOOL GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize);
316 WINPR_API BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer,
318 WINPR_API BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer,
322 #define GetComputerName GetComputerNameW
323 #define GetComputerNameEx GetComputerNameExW
325 #define GetComputerName GetComputerNameA
326 #define GetComputerNameEx GetComputerNameExA
331 #if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
333 WINPR_API ULONGLONG winpr_GetTickCount64(
void);
334 #define GetTickCount64 winpr_GetTickCount64
338 #define WINPR_TIME_NS_TO_S(ns) ((ns) / 1000000000ull)
339 #define WINPR_TIME_NS_TO_MS(ns) ((ns) / 1000000ull)
340 #define WINPR_TIME_NS_TO_US(ns) ((ns) / 1000ull)
342 #define WINPR_TIME_NS_REM_NS(ns) ((ns) % 1000000000ull)
343 #define WINPR_TIME_NS_REM_US(ns) (WINPR_TIME_NS_REM_NS(ns) / 1000ull)
344 #define WINPR_TIME_NS_REM_MS(ns) (WINPR_TIME_NS_REM_US(ns) / 1000ull)
350 WINPR_API UINT64 winpr_GetTickCount64NS(
void);
356 WINPR_API UINT64 winpr_GetUnixTimeNS(
void);
358 WINPR_API DWORD GetTickCountPrecise(
void);
360 WINPR_API BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature);
363 #define PF_EX_LZCNT 1
364 #define PF_EX_3DNOW_PREFETCH 2
365 #define PF_EX_SSSE3 3
366 #define PF_EX_SSE41 4
367 #define PF_EX_SSE42 5
370 #define PF_EX_AVX_AES 8
372 #define PF_EX_ARM_VFP1 10
373 #define PF_EX_ARM_VFP3D16 11
374 #define PF_EX_ARM_VFP4 12
375 #define PF_EX_ARM_IDIVA 13
376 #define PF_EX_ARM_IDIVT 14
377 #define PF_EX_AVX_PCLMULQDQ 15
378 #define PF_EX_AVX512F 16
384 #define PF_SSE_INSTRUCTIONS_AVAILABLE PF_XMMI_INSTRUCTIONS_AVAILABLE
385 #define PF_SSE2_INSTRUCTIONS_AVAILABLE PF_XMMI64_INSTRUCTIONS_AVAILABLE