cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

sysinfo.h (10280B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * System Information
      4 *
      5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *     http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 */
     19
     20#ifndef WINPR_SYSINFO_H
     21#define WINPR_SYSINFO_H
     22
     23#include <stdio.h>
     24#include <stdlib.h>
     25#include <string.h>
     26#include <winpr/winpr.h>
     27#include <winpr/wtypes.h>
     28
     29#ifdef __cplusplus
     30extern "C"
     31{
     32#endif
     33
     34#ifndef _WIN32
     35
     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_UNKNOWN 0xFFFF
     51
     52#define PROCESSOR_INTEL_386 386
     53#define PROCESSOR_INTEL_486 486
     54#define PROCESSOR_INTEL_PENTIUM 586
     55#define PROCESSOR_INTEL_IA64 2200
     56#define PROCESSOR_AMD_X8664 8664
     57#define PROCESSOR_MIPS_R4000 4000
     58#define PROCESSOR_ALPHA_21064 21064
     59#define PROCESSOR_PPC_601 601
     60#define PROCESSOR_PPC_603 603
     61#define PROCESSOR_PPC_604 604
     62#define PROCESSOR_PPC_620 620
     63#define PROCESSOR_HITACHI_SH3 10003
     64#define PROCESSOR_HITACHI_SH3E 10004
     65#define PROCESSOR_HITACHI_SH4 10005
     66#define PROCESSOR_MOTOROLA_821 821
     67#define PROCESSOR_SHx_SH3 103
     68#define PROCESSOR_SHx_SH4 104
     69#define PROCESSOR_STRONGARM 2577
     70#define PROCESSOR_ARM720 1824
     71#define PROCESSOR_ARM820 2080
     72#define PROCESSOR_ARM920 2336
     73#define PROCESSOR_ARM_7TDMI 70001
     74#define PROCESSOR_OPTIL 0x494F
     75
     76	typedef struct _SYSTEM_INFO
     77	{
     78		union {
     79			DWORD dwOemId;
     80
     81			struct
     82			{
     83				WORD wProcessorArchitecture;
     84				WORD wReserved;
     85			};
     86		};
     87
     88		DWORD dwPageSize;
     89		LPVOID lpMinimumApplicationAddress;
     90		LPVOID lpMaximumApplicationAddress;
     91		DWORD_PTR dwActiveProcessorMask;
     92		DWORD dwNumberOfProcessors;
     93		DWORD dwProcessorType;
     94		DWORD dwAllocationGranularity;
     95		WORD wProcessorLevel;
     96		WORD wProcessorRevision;
     97	} SYSTEM_INFO, *LPSYSTEM_INFO;
     98
     99	WINPR_API void GetSystemInfo(LPSYSTEM_INFO lpSystemInfo);
    100	WINPR_API void GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo);
    101
    102	typedef struct _OSVERSIONINFOA
    103	{
    104		DWORD dwOSVersionInfoSize;
    105		DWORD dwMajorVersion;
    106		DWORD dwMinorVersion;
    107		DWORD dwBuildNumber;
    108		DWORD dwPlatformId;
    109		CHAR szCSDVersion[128];
    110	} OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
    111
    112	typedef struct _OSVERSIONINFOW
    113	{
    114		DWORD dwOSVersionInfoSize;
    115		DWORD dwMajorVersion;
    116		DWORD dwMinorVersion;
    117		DWORD dwBuildNumber;
    118		DWORD dwPlatformId;
    119		WCHAR szCSDVersion[128];
    120	} OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW;
    121
    122	typedef struct _OSVERSIONINFOEXA
    123	{
    124		DWORD dwOSVersionInfoSize;
    125		DWORD dwMajorVersion;
    126		DWORD dwMinorVersion;
    127		DWORD dwBuildNumber;
    128		DWORD dwPlatformId;
    129		CHAR szCSDVersion[128];
    130		WORD wServicePackMajor;
    131		WORD wServicePackMinor;
    132		WORD wSuiteMask;
    133		BYTE wProductType;
    134		BYTE wReserved;
    135	} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
    136
    137	typedef struct _OSVERSIONINFOEXW
    138	{
    139		DWORD dwOSVersionInfoSize;
    140		DWORD dwMajorVersion;
    141		DWORD dwMinorVersion;
    142		DWORD dwBuildNumber;
    143		DWORD dwPlatformId;
    144		WCHAR szCSDVersion[128];
    145		WORD wServicePackMajor;
    146		WORD wServicePackMinor;
    147		WORD wSuiteMask;
    148		BYTE wProductType;
    149		BYTE wReserved;
    150	} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
    151
    152#ifdef UNICODE
    153#define OSVERSIONINFO OSVERSIONINFOW
    154#define OSVERSIONINFOEX OSVERSIONINFOEXW
    155#define POSVERSIONINFO POSVERSIONINFOW
    156#define POSVERSIONINFOEX POSVERSIONINFOEXW
    157#define LPOSVERSIONINFO LPOSVERSIONINFOW
    158#define LPOSVERSIONINFOEX LPOSVERSIONINFOEXW
    159#else
    160#define OSVERSIONINFO OSVERSIONINFOA
    161#define OSVERSIONINFOEX OSVERSIONINFOEXA
    162#define POSVERSIONINFO POSVERSIONINFOA
    163#define POSVERSIONINFOEX POSVERSIONINFOEXA
    164#define LPOSVERSIONINFO LPOSVERSIONINFOA
    165#define LPOSVERSIONINFOEX LPOSVERSIONINFOEXA
    166#endif
    167
    168#define VER_PLATFORM_WIN32_NT 0x00000002
    169
    170#define VER_SUITE_BACKOFFICE 0x00000004
    171#define VER_SUITE_BLADE 0x00000400
    172#define VER_SUITE_COMPUTE_SERVER 0x00004000
    173#define VER_SUITE_DATACENTER 0x00000080
    174#define VER_SUITE_ENTERPRISE 0x00000002
    175#define VER_SUITE_EMBEDDEDNT 0x00000040
    176#define VER_SUITE_PERSONAL 0x00000200
    177#define VER_SUITE_SINGLEUSERTS 0x00000100
    178#define VER_SUITE_SMALLBUSINESS 0x00000001
    179#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
    180#define VER_SUITE_STORAGE_SERVER 0x00002000
    181#define VER_SUITE_TERMINAL 0x00000010
    182#define VER_SUITE_WH_SERVER 0x00008000
    183
    184#define VER_NT_DOMAIN_CONTROLLER 0x0000002
    185#define VER_NT_SERVER 0x0000003
    186#define VER_NT_WORKSTATION 0x0000001
    187
    188	WINPR_API void GetSystemTime(LPSYSTEMTIME lpSystemTime);
    189	WINPR_API BOOL SetSystemTime(CONST SYSTEMTIME* lpSystemTime);
    190	WINPR_API VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
    191	WINPR_API BOOL SetLocalTime(CONST SYSTEMTIME* lpSystemTime);
    192
    193	WINPR_API VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
    194	WINPR_API BOOL GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement,
    195	                                       PBOOL lpTimeAdjustmentDisabled);
    196
    197	WINPR_API BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature);
    198
    199#define PF_FLOATING_POINT_PRECISION_ERRATA 0
    200#define PF_FLOATING_POINT_EMULATED 1
    201#define PF_COMPARE_EXCHANGE_DOUBLE 2
    202#define PF_MMX_INSTRUCTIONS_AVAILABLE 3
    203#define PF_PPC_MOVEMEM_64BIT_OK 4
    204#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 /* SSE */
    205#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
    206#define PF_RDTSC_INSTRUCTION_AVAILABLE 8
    207#define PF_PAE_ENABLED 9
    208#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 /* SSE2 */
    209#define PF_SSE_DAZ_MODE_AVAILABLE 11
    210#define PF_NX_ENABLED 12
    211#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
    212#define PF_COMPARE_EXCHANGE128 14
    213#define PF_COMPARE64_EXCHANGE128 15
    214#define PF_CHANNELS_ENABLED 16
    215#define PF_XSAVE_ENABLED 17
    216#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
    217#define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
    218#define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
    219#define PF_VIRT_FIRMWARE_ENABLED 21
    220#define PF_RDWRFSGSBASE_AVAILABLE 22
    221#define PF_FASTFAIL_AVAILABLE 23
    222#define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
    223#define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
    224#define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
    225#define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
    226
    227#define PF_ARM_V4 0x80000001
    228#define PF_ARM_V5 0x80000002
    229#define PF_ARM_V6 0x80000003
    230#define PF_ARM_V7 0x80000004
    231#define PF_ARM_THUMB 0x80000005
    232#define PF_ARM_JAZELLE 0x80000006
    233#define PF_ARM_DSP 0x80000007
    234#define PF_ARM_MOVE_CP 0x80000008
    235#define PF_ARM_VFP10 0x80000009
    236#define PF_ARM_MPU 0x8000000A
    237#define PF_ARM_WRITE_BUFFER 0x8000000B
    238#define PF_ARM_MBX 0x8000000C
    239#define PF_ARM_L2CACHE 0x8000000D
    240#define PF_ARM_PHYSICALLY_TAGGED_CACHE 0x8000000E
    241#define PF_ARM_VFP_SINGLE_PRECISION 0x8000000F
    242#define PF_ARM_VFP_DOUBLE_PRECISION 0x80000010
    243#define PF_ARM_ITCM 0x80000011
    244#define PF_ARM_DTCM 0x80000012
    245#define PF_ARM_UNIFIED_CACHE 0x80000013
    246#define PF_ARM_WRITE_BACK_CACHE 0x80000014
    247#define PF_ARM_CACHE_CAN_BE_LOCKED_DOWN 0x80000015
    248#define PF_ARM_L2CACHE_MEMORY_MAPPED 0x80000016
    249#define PF_ARM_L2CACHE_COPROC 0x80000017
    250#define PF_ARM_THUMB2 0x80000018
    251#define PF_ARM_T2EE 0x80000019
    252#define PF_ARM_VFP3 0x8000001A
    253#define PF_ARM_NEON 0x8000001B
    254#define PF_ARM_UNALIGNED_ACCESS 0x8000001C
    255
    256#define PF_ARM_INTEL_XSCALE 0x80010001
    257#define PF_ARM_INTEL_PMU 0x80010002
    258#define PF_ARM_INTEL_WMMX 0x80010003
    259
    260#endif
    261
    262#if !defined(_WIN32) || defined(_UWP)
    263
    264	WINPR_API BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
    265	WINPR_API BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation);
    266
    267#ifdef UNICODE
    268#define GetVersionEx GetVersionExW
    269#else
    270#define GetVersionEx GetVersionExA
    271#endif
    272
    273#endif
    274
    275#if !defined(_WIN32) || defined(_UWP)
    276
    277	WINPR_API DWORD GetTickCount(void);
    278
    279	typedef enum _COMPUTER_NAME_FORMAT
    280	{
    281		ComputerNameNetBIOS,
    282		ComputerNameDnsHostname,
    283		ComputerNameDnsDomain,
    284		ComputerNameDnsFullyQualified,
    285		ComputerNamePhysicalNetBIOS,
    286		ComputerNamePhysicalDnsHostname,
    287		ComputerNamePhysicalDnsDomain,
    288		ComputerNamePhysicalDnsFullyQualified,
    289		ComputerNameMax
    290	} COMPUTER_NAME_FORMAT;
    291
    292#define MAX_COMPUTERNAME_LENGTH 31
    293
    294	WINPR_API BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize);
    295	WINPR_API BOOL GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize);
    296
    297	WINPR_API BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer,
    298	                                  LPDWORD lpnSize);
    299	WINPR_API BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer,
    300	                                  LPDWORD lpnSize);
    301
    302#ifdef UNICODE
    303#define GetComputerName GetComputerNameW
    304#define GetComputerNameEx GetComputerNameExW
    305#else
    306#define GetComputerName GetComputerNameA
    307#define GetComputerNameEx GetComputerNameExA
    308#endif
    309
    310#endif
    311
    312#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
    313
    314	WINPR_API ULONGLONG winpr_GetTickCount64(void);
    315#define GetTickCount64 winpr_GetTickCount64
    316
    317#endif
    318
    319	WINPR_API DWORD GetTickCountPrecise(void);
    320
    321	WINPR_API BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature);
    322
    323/* extended flags */
    324#define PF_EX_LZCNT 1
    325#define PF_EX_3DNOW_PREFETCH 2
    326#define PF_EX_SSSE3 3
    327#define PF_EX_SSE41 4
    328#define PF_EX_SSE42 5
    329#define PF_EX_AVX 6
    330#define PF_EX_FMA 7
    331#define PF_EX_AVX_AES 8
    332#define PF_EX_AVX2 9
    333#define PF_EX_ARM_VFP1 10
    334#define PF_EX_ARM_VFP3D16 11
    335#define PF_EX_ARM_VFP4 12
    336#define PF_EX_ARM_IDIVA 13
    337#define PF_EX_ARM_IDIVT 14
    338#define PF_EX_AVX_PCLMULQDQ 15
    339
    340/*
    341 * some "aliases" for the standard defines
    342 * to be more clear
    343 */
    344#define PF_SSE_INSTRUCTIONS_AVAILABLE PF_XMMI_INSTRUCTIONS_AVAILABLE
    345#define PF_SSE2_INSTRUCTIONS_AVAILABLE PF_XMMI64_INSTRUCTIONS_AVAILABLE
    346
    347#ifdef __cplusplus
    348}
    349#endif
    350
    351#endif /* WINPR_SYSINFO_H */