1 | /* $Id: internal-r3-win.h 96573 2022-09-02 02:04:12Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - some Windows OS type constants.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef IPRT_INCLUDED_SRC_r3_win_internal_r3_win_h
|
---|
38 | #define IPRT_INCLUDED_SRC_r3_win_internal_r3_win_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include "internal/iprt.h"
|
---|
44 | #include <iprt/types.h>
|
---|
45 |
|
---|
46 |
|
---|
47 | /*******************************************************************************
|
---|
48 | * Structures and Typedefs *
|
---|
49 | *******************************************************************************/
|
---|
50 | /**
|
---|
51 | * Windows OS type as determined by rtSystemWinOSType().
|
---|
52 | *
|
---|
53 | * @note ASSUMPTIONS are made regarding ordering. Win 9x should come first, then
|
---|
54 | * NT. The Win9x and NT versions should internally be ordered in ascending
|
---|
55 | * version/code-base order.
|
---|
56 | */
|
---|
57 | typedef enum RTWINOSTYPE
|
---|
58 | {
|
---|
59 | kRTWinOSType_UNKNOWN = 0,
|
---|
60 | kRTWinOSType_9XFIRST = 1,
|
---|
61 | kRTWinOSType_95 = kRTWinOSType_9XFIRST,
|
---|
62 | kRTWinOSType_95SP1,
|
---|
63 | kRTWinOSType_95OSR2,
|
---|
64 | kRTWinOSType_98,
|
---|
65 | kRTWinOSType_98SP1,
|
---|
66 | kRTWinOSType_98SE,
|
---|
67 | kRTWinOSType_ME,
|
---|
68 | kRTWinOSType_9XLAST = 99,
|
---|
69 | kRTWinOSType_NTFIRST = 100,
|
---|
70 | kRTWinOSType_NT310 = kRTWinOSType_NTFIRST,
|
---|
71 | kRTWinOSType_NT350,
|
---|
72 | kRTWinOSType_NT351,
|
---|
73 | kRTWinOSType_NT4,
|
---|
74 | kRTWinOSType_2K, /* 5.0 */
|
---|
75 | kRTWinOSType_XP, /* 5.1 */
|
---|
76 | kRTWinOSType_XP64, /* 5.2, workstation */
|
---|
77 | kRTWinOSType_2003, /* 5.2 */
|
---|
78 | kRTWinOSType_VISTA, /* 6.0, workstation */
|
---|
79 | kRTWinOSType_2008, /* 6.0, server */
|
---|
80 | kRTWinOSType_7, /* 6.1, workstation */
|
---|
81 | kRTWinOSType_2008R2, /* 6.1, server */
|
---|
82 | kRTWinOSType_8, /* 6.2, workstation */
|
---|
83 | kRTWinOSType_2012, /* 6.2, server */
|
---|
84 | kRTWinOSType_81, /* 6.3, workstation */
|
---|
85 | kRTWinOSType_2012R2, /* 6.3, server */
|
---|
86 | kRTWinOSType_10, /* 10.0, workstation */
|
---|
87 | kRTWinOSType_2016, /* 10.0 1607, server */
|
---|
88 | kRTWinOSType_2019, /* 10.0 1809, server */
|
---|
89 | kRTWinOSType_2022, /* 10.0 21H2, server */
|
---|
90 | kRTWinOSType_11, /* 11.0, workstation */
|
---|
91 | kRTWinOSType_NT_UNKNOWN = 199,
|
---|
92 | kRTWinOSType_NT_LAST = kRTWinOSType_UNKNOWN
|
---|
93 | } RTWINOSTYPE;
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Windows loader protection level.
|
---|
97 | */
|
---|
98 | typedef enum RTR3WINLDRPROT
|
---|
99 | {
|
---|
100 | RTR3WINLDRPROT_INVALID = 0,
|
---|
101 | RTR3WINLDRPROT_NONE,
|
---|
102 | RTR3WINLDRPROT_NO_CWD,
|
---|
103 | RTR3WINLDRPROT_SAFE,
|
---|
104 | RTR3WINLDRPROT_SAFER
|
---|
105 | } RTR3WINLDRPROT;
|
---|
106 |
|
---|
107 |
|
---|
108 | /*********************************************************************************************************************************
|
---|
109 | * Global Variables *
|
---|
110 | *********************************************************************************************************************************/
|
---|
111 | extern DECL_HIDDEN_DATA(RTR3WINLDRPROT) g_enmWinLdrProt;
|
---|
112 | extern DECL_HIDDEN_DATA(RTWINOSTYPE) g_enmWinVer;
|
---|
113 | #ifdef _WINDEF_
|
---|
114 | extern DECL_HIDDEN_DATA(OSVERSIONINFOEXW) g_WinOsInfoEx;
|
---|
115 |
|
---|
116 | extern DECL_HIDDEN_DATA(HMODULE) g_hModKernel32;
|
---|
117 | typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT);
|
---|
118 | extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW;
|
---|
119 | typedef HANDLE (WINAPI *PFNCREATEWAITABLETIMEREX)(LPSECURITY_ATTRIBUTES, LPCWSTR, DWORD, DWORD);
|
---|
120 | extern DECL_HIDDEN_DATA(PFNCREATEWAITABLETIMEREX) g_pfnCreateWaitableTimerExW;
|
---|
121 | extern DECL_HIDDEN_DATA(decltype(SystemTimeToTzSpecificLocalTime) *) g_pfnSystemTimeToTzSpecificLocalTime;
|
---|
122 | extern DECL_HIDDEN_DATA(decltype(GetHandleInformation) *) g_pfnGetHandleInformation;
|
---|
123 | extern DECL_HIDDEN_DATA(decltype(SetHandleInformation) *) g_pfnSetHandleInformation;
|
---|
124 | extern DECL_HIDDEN_DATA(decltype(IsDebuggerPresent) *) g_pfnIsDebuggerPresent;
|
---|
125 | extern DECL_HIDDEN_DATA(decltype(GetSystemTimeAsFileTime) *) g_pfnGetSystemTimeAsFileTime;
|
---|
126 | extern DECL_HIDDEN_DATA(decltype(GetProcessAffinityMask) *) g_pfnGetProcessAffinityMask;
|
---|
127 | extern DECL_HIDDEN_DATA(decltype(SetThreadAffinityMask) *) g_pfnSetThreadAffinityMask;
|
---|
128 | extern DECL_HIDDEN_DATA(decltype(CreateIoCompletionPort) *) g_pfnCreateIoCompletionPort;
|
---|
129 | extern DECL_HIDDEN_DATA(decltype(GetQueuedCompletionStatus) *) g_pfnGetQueuedCompletionStatus;
|
---|
130 | extern DECL_HIDDEN_DATA(decltype(PostQueuedCompletionStatus) *) g_pfnPostQueuedCompletionStatus;
|
---|
131 | extern DECL_HIDDEN_DATA(decltype(SetUnhandledExceptionFilter) *) g_pfnSetUnhandledExceptionFilter;
|
---|
132 | extern DECL_HIDDEN_DATA(decltype(UnhandledExceptionFilter) *) g_pfnUnhandledExceptionFilter;
|
---|
133 | extern DECL_HIDDEN_DATA(decltype(IsProcessorFeaturePresent) *) g_pfnIsProcessorFeaturePresent;
|
---|
134 |
|
---|
135 |
|
---|
136 | extern DECL_HIDDEN_DATA(HMODULE) g_hModNtDll;
|
---|
137 | typedef NTSTATUS (NTAPI *PFNNTQUERYFULLATTRIBUTESFILE)(struct _OBJECT_ATTRIBUTES *, struct _FILE_NETWORK_OPEN_INFORMATION *);
|
---|
138 | extern DECL_HIDDEN_DATA(PFNNTQUERYFULLATTRIBUTESFILE) g_pfnNtQueryFullAttributesFile;
|
---|
139 | typedef NTSTATUS (NTAPI *PFNNTDUPLICATETOKEN)(HANDLE, ACCESS_MASK, struct _OBJECT_ATTRIBUTES *, BOOLEAN, TOKEN_TYPE, PHANDLE);
|
---|
140 | extern DECL_HIDDEN_DATA(PFNNTDUPLICATETOKEN) g_pfnNtDuplicateToken;
|
---|
141 | #ifdef IPRT_INCLUDED_nt_nt_h
|
---|
142 | extern DECL_HIDDEN_DATA(decltype(NtAlertThread) *) g_pfnNtAlertThread;
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | extern DECL_HIDDEN_DATA(HMODULE) g_hModWinSock;
|
---|
146 |
|
---|
147 | /** WSAStartup */
|
---|
148 | typedef int (WINAPI *PFNWSASTARTUP)(WORD, struct WSAData *);
|
---|
149 | /** WSACleanup */
|
---|
150 | typedef int (WINAPI *PFNWSACLEANUP)(void);
|
---|
151 | /** WSAGetLastError */
|
---|
152 | typedef int (WINAPI *PFNWSAGETLASTERROR)(void);
|
---|
153 | /** WSASetLastError */
|
---|
154 | typedef int (WINAPI *PFNWSASETLASTERROR)(int);
|
---|
155 | /** WSACreateEvent */
|
---|
156 | typedef HANDLE (WINAPI *PFNWSACREATEEVENT)(void);
|
---|
157 | /** WSASetEvent */
|
---|
158 | typedef BOOL (WINAPI *PFNWSASETEVENT)(HANDLE);
|
---|
159 | /** WSACloseEvent */
|
---|
160 | typedef BOOL (WINAPI *PFNWSACLOSEEVENT)(HANDLE);
|
---|
161 | /** WSAEventSelect */
|
---|
162 | typedef BOOL (WINAPI *PFNWSAEVENTSELECT)(UINT_PTR, HANDLE, LONG);
|
---|
163 | /** WSAEnumNetworkEvents */
|
---|
164 | typedef int (WINAPI *PFNWSAENUMNETWORKEVENTS)(UINT_PTR, HANDLE, struct _WSANETWORKEVENTS *);
|
---|
165 | /** WSASocketW */
|
---|
166 | typedef UINT_PTR (WINAPI *PFNWSASOCKETW)(int, int, int, struct _WSAPROTOCOL_INFOW *, unsigned, DWORD);
|
---|
167 | /** WSASend */
|
---|
168 | typedef int (WINAPI *PFNWSASEND)(UINT_PTR, struct _WSABUF *, DWORD, LPDWORD, DWORD dwFlags,
|
---|
169 | struct _OVERLAPPED *, uintptr_t /*LPWSAOVERLAPPED_COMPLETION_ROUTINE*/);
|
---|
170 |
|
---|
171 | /** socket */
|
---|
172 | typedef UINT_PTR (WINAPI *PFNWINSOCKSOCKET)(int, int, int);
|
---|
173 | /** closesocket */
|
---|
174 | typedef int (WINAPI *PFNWINSOCKCLOSESOCKET)(UINT_PTR);
|
---|
175 | /** recv */
|
---|
176 | typedef int (WINAPI *PFNWINSOCKRECV)(UINT_PTR, char *, int, int);
|
---|
177 | /** send */
|
---|
178 | typedef int (WINAPI *PFNWINSOCKSEND)(UINT_PTR, const char *, int, int);
|
---|
179 | /** recvfrom */
|
---|
180 | typedef int (WINAPI *PFNWINSOCKRECVFROM)(UINT_PTR, char *, int, int, struct sockaddr *, int *);
|
---|
181 | /** sendto */
|
---|
182 | typedef int (WINAPI *PFNWINSOCKSENDTO)(UINT_PTR, const char *, int, int, const struct sockaddr *, int);
|
---|
183 | /** bind */
|
---|
184 | typedef int (WINAPI *PFNWINSOCKBIND)(UINT_PTR, const struct sockaddr *, int);
|
---|
185 | /** listen */
|
---|
186 | typedef int (WINAPI *PFNWINSOCKLISTEN)(UINT_PTR, int);
|
---|
187 | /** accept */
|
---|
188 | typedef UINT_PTR (WINAPI *PFNWINSOCKACCEPT)(UINT_PTR, struct sockaddr *, int *);
|
---|
189 | /** connect */
|
---|
190 | typedef int (WINAPI *PFNWINSOCKCONNECT)(UINT_PTR, const struct sockaddr *, int);
|
---|
191 | /** shutdown */
|
---|
192 | typedef int (WINAPI *PFNWINSOCKSHUTDOWN)(UINT_PTR, int);
|
---|
193 | /** getsockopt */
|
---|
194 | typedef int (WINAPI *PFNWINSOCKGETSOCKOPT)(UINT_PTR, int, int, char *, int *);
|
---|
195 | /** setsockopt */
|
---|
196 | typedef int (WINAPI *PFNWINSOCKSETSOCKOPT)(UINT_PTR, int, int, const char *, int);
|
---|
197 | /** ioctlsocket */
|
---|
198 | typedef int (WINAPI *PFNWINSOCKIOCTLSOCKET)(UINT_PTR, long, unsigned long *);
|
---|
199 | /** getpeername */
|
---|
200 | typedef int (WINAPI *PFNWINSOCKGETPEERNAME)(UINT_PTR, struct sockaddr *, int *);
|
---|
201 | /** getsockname */
|
---|
202 | typedef int (WINAPI *PFNWINSOCKGETSOCKNAME)(UINT_PTR, struct sockaddr *, int *);
|
---|
203 | /** __WSAFDIsSet */
|
---|
204 | typedef int (WINAPI *PFNWINSOCK__WSAFDISSET)(UINT_PTR, struct fd_set *);
|
---|
205 | /** select */
|
---|
206 | typedef int (WINAPI *PFNWINSOCKSELECT)(int, struct fd_set *, struct fd_set *, struct fd_set *, const struct timeval *);
|
---|
207 | /** gethostbyname */
|
---|
208 | typedef struct hostent *(WINAPI *PFNWINSOCKGETHOSTBYNAME)(const char *);
|
---|
209 |
|
---|
210 | extern DECL_HIDDEN_DATA(PFNWSASTARTUP) g_pfnWSAStartup;
|
---|
211 | extern DECL_HIDDEN_DATA(PFNWSACLEANUP) g_pfnWSACleanup;
|
---|
212 | extern DECL_HIDDEN_DATA(PFNWSAGETLASTERROR) g_pfnWSAGetLastError;
|
---|
213 | extern DECL_HIDDEN_DATA(PFNWSASETLASTERROR) g_pfnWSASetLastError;
|
---|
214 | extern DECL_HIDDEN_DATA(PFNWSACREATEEVENT) g_pfnWSACreateEvent;
|
---|
215 | extern DECL_HIDDEN_DATA(PFNWSACLOSEEVENT) g_pfnWSACloseEvent;
|
---|
216 | extern DECL_HIDDEN_DATA(PFNWSASETEVENT) g_pfnWSASetEvent;
|
---|
217 | extern DECL_HIDDEN_DATA(PFNWSAEVENTSELECT) g_pfnWSAEventSelect;
|
---|
218 | extern DECL_HIDDEN_DATA(PFNWSAENUMNETWORKEVENTS) g_pfnWSAEnumNetworkEvents;
|
---|
219 | extern DECL_HIDDEN_DATA(PFNWSASOCKETW) g_pfnWSASocketW;
|
---|
220 | extern DECL_HIDDEN_DATA(PFNWSASEND) g_pfnWSASend;
|
---|
221 | extern DECL_HIDDEN_DATA(PFNWINSOCKSOCKET) g_pfnsocket;
|
---|
222 | extern DECL_HIDDEN_DATA(PFNWINSOCKCLOSESOCKET) g_pfnclosesocket;
|
---|
223 | extern DECL_HIDDEN_DATA(PFNWINSOCKRECV) g_pfnrecv;
|
---|
224 | extern DECL_HIDDEN_DATA(PFNWINSOCKSEND) g_pfnsend;
|
---|
225 | extern DECL_HIDDEN_DATA(PFNWINSOCKRECVFROM) g_pfnrecvfrom;
|
---|
226 | extern DECL_HIDDEN_DATA(PFNWINSOCKSENDTO) g_pfnsendto;
|
---|
227 | extern DECL_HIDDEN_DATA(PFNWINSOCKBIND) g_pfnbind;
|
---|
228 | extern DECL_HIDDEN_DATA(PFNWINSOCKLISTEN) g_pfnlisten;
|
---|
229 | extern DECL_HIDDEN_DATA(PFNWINSOCKACCEPT) g_pfnaccept;
|
---|
230 | extern DECL_HIDDEN_DATA(PFNWINSOCKCONNECT) g_pfnconnect;
|
---|
231 | extern DECL_HIDDEN_DATA(PFNWINSOCKSHUTDOWN) g_pfnshutdown;
|
---|
232 | extern DECL_HIDDEN_DATA(PFNWINSOCKGETSOCKOPT) g_pfngetsockopt;
|
---|
233 | extern DECL_HIDDEN_DATA(PFNWINSOCKSETSOCKOPT) g_pfnsetsockopt;
|
---|
234 | extern DECL_HIDDEN_DATA(PFNWINSOCKIOCTLSOCKET) g_pfnioctlsocket;
|
---|
235 | extern DECL_HIDDEN_DATA(PFNWINSOCKGETPEERNAME) g_pfngetpeername;
|
---|
236 | extern DECL_HIDDEN_DATA(PFNWINSOCKGETSOCKNAME) g_pfngetsockname;
|
---|
237 | extern DECL_HIDDEN_DATA(PFNWINSOCK__WSAFDISSET) g_pfn__WSAFDIsSet;
|
---|
238 | extern DECL_HIDDEN_DATA(PFNWINSOCKSELECT) g_pfnselect;
|
---|
239 | extern DECL_HIDDEN_DATA(PFNWINSOCKGETHOSTBYNAME) g_pfngethostbyname;
|
---|
240 | #endif
|
---|
241 |
|
---|
242 |
|
---|
243 | #endif /* !IPRT_INCLUDED_SRC_r3_win_internal_r3_win_h */
|
---|
244 |
|
---|