1 | /* $Id: SUPLibInternal.h 54998 2015-03-28 19:57:12Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Support Library - Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___SUPLibInternal_h___
|
---|
28 | #define ___SUPLibInternal_h___
|
---|
29 |
|
---|
30 | #include <VBox/cdefs.h>
|
---|
31 | #include <VBox/types.h>
|
---|
32 | #include <iprt/stdarg.h>
|
---|
33 |
|
---|
34 |
|
---|
35 | /*******************************************************************************
|
---|
36 | * Defined Constants And Macros *
|
---|
37 | *******************************************************************************/
|
---|
38 | /** @def SUPLIB_DLL_SUFF
|
---|
39 | * The (typical) DLL/DYLIB/SO suffix. */
|
---|
40 | #if defined(RT_OS_DARWIN)
|
---|
41 | # define SUPLIB_DLL_SUFF ".dylib"
|
---|
42 | #elif defined(RT_OS_L4)
|
---|
43 | # define SUPLIB_DLL_SUFF ".s.so"
|
---|
44 | #elif defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
45 | # define SUPLIB_DLL_SUFF ".dll"
|
---|
46 | #else
|
---|
47 | # define SUPLIB_DLL_SUFF ".so"
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #ifdef RT_OS_SOLARIS
|
---|
51 | /** Number of dummy files to open (2:ip4, 1:ip6, 1:extra) see
|
---|
52 | * @bugref{4650}. */
|
---|
53 | # define SUPLIB_FLT_DUMMYFILES 4
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /** @def SUPLIB_EXE_SUFF
|
---|
57 | * The (typical) executable suffix. */
|
---|
58 | #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
59 | # define SUPLIB_EXE_SUFF ".exe"
|
---|
60 | #else
|
---|
61 | # define SUPLIB_EXE_SUFF ""
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | /** @def SUP_HARDENED_SUID
|
---|
65 | * Whether we're employing set-user-ID-on-execute in the hardening.
|
---|
66 | */
|
---|
67 | #if !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS) && !defined(RT_OS_L4)
|
---|
68 | # define SUP_HARDENED_SUID
|
---|
69 | #else
|
---|
70 | # undef SUP_HARDENED_SUID
|
---|
71 | #endif
|
---|
72 |
|
---|
73 | #ifdef IN_SUP_HARDENED_R3
|
---|
74 | /** @name Make the symbols in SUPR3HardenedStatic different from the VBoxRT ones.
|
---|
75 | * We cannot rely on DECLHIDDEN to make this separation for us since it doesn't
|
---|
76 | * work with all GCC versions. So, we resort to old fashion precompiler hacking.
|
---|
77 | * @{
|
---|
78 | */
|
---|
79 | # define supR3HardenedPathAppPrivateNoArch supR3HardenedStaticPathAppPrivateNoArch
|
---|
80 | # define supR3HardenedPathAppPrivateArch supR3HardenedStaticPathAppPrivateArch
|
---|
81 | # define supR3HardenedPathSharedLibs supR3HardenedStaticPathSharedLibs
|
---|
82 | # define supR3HardenedPathAppDocs supR3HardenedStaticPathAppDocs
|
---|
83 | # define supR3HardenedPathExecDir supR3HardenedStaticPathExecDir
|
---|
84 | # define supR3HardenedPathFilename supR3HardenedStaticPathFilename
|
---|
85 | # define supR3HardenedFatalV supR3HardenedStaticFatalV
|
---|
86 | # define supR3HardenedFatal supR3HardenedStaticFatal
|
---|
87 | # define supR3HardenedFatalMsgV supR3HardenedStaticFatalMsgV
|
---|
88 | # define supR3HardenedFatalMsg supR3HardenedStaticFatalMsg
|
---|
89 | # define supR3HardenedErrorV supR3HardenedStaticErrorV
|
---|
90 | # define supR3HardenedError supR3HardenedStaticError
|
---|
91 | # define supR3HardenedOpenLog supR3HardenedStaticOpenLog
|
---|
92 | # define supR3HardenedLogV supR3HardenedStaticLogV
|
---|
93 | # define supR3HardenedLog supR3HardenedStaticLog
|
---|
94 | # define supR3HardenedLogFlush supR3HardenedStaticLogFlush
|
---|
95 | # define supR3HardenedVerifyAll supR3HardenedStaticVerifyAll
|
---|
96 | # define supR3HardenedVerifyFixedDir supR3HardenedStaticVerifyFixedDir
|
---|
97 | # define supR3HardenedVerifyFixedFile supR3HardenedStaticVerifyFixedFile
|
---|
98 | # define supR3HardenedVerifyDir supR3HardenedStaticVerifyDir
|
---|
99 | # define supR3HardenedVerifyFile supR3HardenedStaticVerifyFile
|
---|
100 | # define supR3HardenedGetPreInitData supR3HardenedStaticGetPreInitData
|
---|
101 | # define supR3HardenedRecvPreInitData supR3HardenedStaticRecvPreInitData
|
---|
102 | /** @} */
|
---|
103 | #endif /* IN_SUP_HARDENED_R3 */
|
---|
104 |
|
---|
105 |
|
---|
106 | /** @name CRT function mappings (not using CRT on Windows).
|
---|
107 | * @{
|
---|
108 | */
|
---|
109 | #if defined(IN_SUP_HARDENED_R3) && defined(RT_OS_WINDOWS)
|
---|
110 | # define SUP_HARDENED_NEED_CRT_FUNCTIONS
|
---|
111 | DECLHIDDEN(int) suplibHardenedMemComp(void const *pvDst, const void *pvSrc, size_t cbToComp);
|
---|
112 | DECLHIDDEN(void *) suplibHardenedMemCopy(void *pvDst, const void *pvSrc, size_t cbToCopy);
|
---|
113 | DECLHIDDEN(void *) suplibHardenedMemSet(void *pvDst, int ch, size_t cbToSet);
|
---|
114 | DECLHIDDEN(char *) suplibHardenedStrCopy(char *pszDst, const char *pszSrc);
|
---|
115 | DECLHIDDEN(size_t) suplibHardenedStrLen(const char *psz);
|
---|
116 | DECLHIDDEN(char *) suplibHardenedStrCat(char *pszDst, const char *pszSrc);
|
---|
117 | DECLHIDDEN(int) suplibHardenedStrCmp(const char *psz1, const char *psz2);
|
---|
118 | DECLHIDDEN(int) suplibHardenedStrNCmp(const char *psz1, const char *psz2, size_t cchMax);
|
---|
119 | #else
|
---|
120 | # undef SUP_HARDENED_NEED_CRT_FUNCTIONS
|
---|
121 | # define suplibHardenedMemComp memcmp
|
---|
122 | # define suplibHardenedMemCopy memcpy
|
---|
123 | # define suplibHardenedMemSet memset
|
---|
124 | # define suplibHardenedStrCopy strcpy
|
---|
125 | # define suplibHardenedStrLen strlen
|
---|
126 | # define suplibHardenedStrCat strcat
|
---|
127 | # define suplibHardenedStrCmp strcmp
|
---|
128 | # define suplibHardenedStrNCmp strncmp
|
---|
129 | #endif
|
---|
130 | DECLNORETURN(void) suplibHardenedExit(RTEXITCODE rcExit);
|
---|
131 | DECLHIDDEN(void) suplibHardenedPrintF(const char *pszFormat, ...);
|
---|
132 | DECLHIDDEN(void) suplibHardenedPrintFV(const char *pszFormat, va_list va);
|
---|
133 |
|
---|
134 | /** @} */
|
---|
135 |
|
---|
136 | /** Debug output macro. */
|
---|
137 | #ifdef IN_SUP_HARDENED_R3
|
---|
138 | # if defined(DEBUG_bird) && defined(RT_OS_WINDOWS)
|
---|
139 | # define SUP_DPRINTF(a) do { supR3HardenedStaticLog a; suplibHardenedPrintF a; } while (0)
|
---|
140 | # else
|
---|
141 | # define SUP_DPRINTF(a) do { supR3HardenedStaticLog a; } while (0)
|
---|
142 | # endif
|
---|
143 | #else
|
---|
144 | # if defined(DEBUG_bird) && defined(RT_OS_WINDOWS)
|
---|
145 | # define SUP_DPRINTF(a) RTLogPrintf a
|
---|
146 | # else
|
---|
147 | # define SUP_DPRINTF(a) do { } while (0)
|
---|
148 | # endif
|
---|
149 | #endif
|
---|
150 |
|
---|
151 |
|
---|
152 | /*******************************************************************************
|
---|
153 | * Structures and Typedefs *
|
---|
154 | *******************************************************************************/
|
---|
155 | /**
|
---|
156 | * The type of an installed file.
|
---|
157 | */
|
---|
158 | typedef enum SUPINSTFILETYPE
|
---|
159 | {
|
---|
160 | kSupIFT_Invalid = 0,
|
---|
161 | kSupIFT_Exe,
|
---|
162 | kSupIFT_Dll,
|
---|
163 | kSupIFT_Rc,
|
---|
164 | kSupIFT_Sys,
|
---|
165 | kSupIFT_Script,
|
---|
166 | kSupIFT_Data,
|
---|
167 | kSupIFT_TestExe,
|
---|
168 | kSupIFT_TestDll,
|
---|
169 | kSupIFT_End
|
---|
170 | } SUPINSTFILETYPE;
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * Installation directory specifier.
|
---|
174 | */
|
---|
175 | typedef enum SUPINSTDIR
|
---|
176 | {
|
---|
177 | kSupID_Invalid = 0,
|
---|
178 | kSupID_Bin,
|
---|
179 | kSupID_AppBin,
|
---|
180 | kSupID_SharedLib,
|
---|
181 | kSupID_AppPrivArch,
|
---|
182 | kSupID_AppPrivArchComp,
|
---|
183 | kSupID_AppPrivNoArch,
|
---|
184 | kSupID_Testcase,
|
---|
185 | kSupID_End
|
---|
186 | } SUPINSTDIR;
|
---|
187 |
|
---|
188 | /**
|
---|
189 | * Installed file.
|
---|
190 | */
|
---|
191 | typedef struct SUPINSTFILE
|
---|
192 | {
|
---|
193 | /** File type. */
|
---|
194 | SUPINSTFILETYPE enmType;
|
---|
195 | /** Install directory. */
|
---|
196 | SUPINSTDIR enmDir;
|
---|
197 | /** Optional (true) or mandatory (false. */
|
---|
198 | bool fOptional;
|
---|
199 | /** File name. */
|
---|
200 | const char *pszFile;
|
---|
201 | } SUPINSTFILE;
|
---|
202 | typedef SUPINSTFILE *PSUPINSTFILE;
|
---|
203 | typedef SUPINSTFILE const *PCSUPINSTFILE;
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * Status data for a verified file.
|
---|
207 | */
|
---|
208 | typedef struct SUPVERIFIEDFILE
|
---|
209 | {
|
---|
210 | /** The file handle or descriptor. -1 if not open. */
|
---|
211 | intptr_t hFile;
|
---|
212 | /** Whether the file has been validated. */
|
---|
213 | bool fValidated;
|
---|
214 | #ifdef RT_OS_WINDOWS
|
---|
215 | /** Whether we've checked the signature of the file. */
|
---|
216 | bool fCheckedSignature;
|
---|
217 | #endif
|
---|
218 | } SUPVERIFIEDFILE;
|
---|
219 | typedef SUPVERIFIEDFILE *PSUPVERIFIEDFILE;
|
---|
220 | typedef SUPVERIFIEDFILE const *PCSUPVERIFIEDFILE;
|
---|
221 |
|
---|
222 | /**
|
---|
223 | * Status data for a verified directory.
|
---|
224 | */
|
---|
225 | typedef struct SUPVERIFIEDDIR
|
---|
226 | {
|
---|
227 | /** The directory handle or descriptor. -1 if not open. */
|
---|
228 | intptr_t hDir;
|
---|
229 | /** Whether the directory has been validated. */
|
---|
230 | bool fValidated;
|
---|
231 | } SUPVERIFIEDDIR;
|
---|
232 | typedef SUPVERIFIEDDIR *PSUPVERIFIEDDIR;
|
---|
233 | typedef SUPVERIFIEDDIR const *PCSUPVERIFIEDDIR;
|
---|
234 |
|
---|
235 |
|
---|
236 | /**
|
---|
237 | * SUPLib instance data.
|
---|
238 | *
|
---|
239 | * This is data that is passed from the static to the dynamic SUPLib
|
---|
240 | * in a hardened setup.
|
---|
241 | */
|
---|
242 | typedef struct SUPLIBDATA
|
---|
243 | {
|
---|
244 | /** The device handle. */
|
---|
245 | #if defined(RT_OS_WINDOWS)
|
---|
246 | void *hDevice;
|
---|
247 | #else
|
---|
248 | int hDevice;
|
---|
249 | #endif
|
---|
250 | /** Indicates whether we have unrestricted (true) or restricted access to the
|
---|
251 | * support device. */
|
---|
252 | bool fUnrestricted;
|
---|
253 | #if defined(RT_OS_DARWIN)
|
---|
254 | /** The connection to the VBoxSupDrv service. */
|
---|
255 | uintptr_t uConnection;
|
---|
256 | #elif defined(RT_OS_LINUX)
|
---|
257 | /** Indicates whether madvise(,,MADV_DONTFORK) works. */
|
---|
258 | bool fSysMadviseWorks;
|
---|
259 | #elif defined(RT_OS_SOLARIS)
|
---|
260 | /** Extra dummy file descriptors to prevent growing file-descriptor table on
|
---|
261 | * clean up (see @bugref{4650}). */
|
---|
262 | int ahDummy[SUPLIB_FLT_DUMMYFILES];
|
---|
263 | #elif defined(RT_OS_WINDOWS)
|
---|
264 | #endif
|
---|
265 | } SUPLIBDATA;
|
---|
266 | /** Pointer to the pre-init data. */
|
---|
267 | typedef SUPLIBDATA *PSUPLIBDATA;
|
---|
268 | /** Pointer to const pre-init data. */
|
---|
269 | typedef SUPLIBDATA const *PCSUPLIBDATA;
|
---|
270 |
|
---|
271 | /** The NIL value of SUPLIBDATA::hDevice. */
|
---|
272 | #if defined(RT_OS_WINDOWS)
|
---|
273 | # define SUP_HDEVICE_NIL NULL
|
---|
274 | #else
|
---|
275 | # define SUP_HDEVICE_NIL (-1)
|
---|
276 | #endif
|
---|
277 |
|
---|
278 |
|
---|
279 | /**
|
---|
280 | * Pre-init data that is handed over from the hardened executable stub.
|
---|
281 | */
|
---|
282 | typedef struct SUPPREINITDATA
|
---|
283 | {
|
---|
284 | /** Magic value (SUPPREINITDATA_MAGIC). */
|
---|
285 | uint32_t u32Magic;
|
---|
286 | /** The SUPLib instance data. */
|
---|
287 | SUPLIBDATA Data;
|
---|
288 | /** The number of entries in paInstallFiles and paVerifiedFiles. */
|
---|
289 | size_t cInstallFiles;
|
---|
290 | /** g_aSupInstallFiles. */
|
---|
291 | PCSUPINSTFILE paInstallFiles;
|
---|
292 | /** g_aSupVerifiedFiles. */
|
---|
293 | PCSUPVERIFIEDFILE paVerifiedFiles;
|
---|
294 | /** The number of entries in paVerifiedDirs. */
|
---|
295 | size_t cVerifiedDirs;
|
---|
296 | /** g_aSupVerifiedDirs. */
|
---|
297 | PCSUPVERIFIEDDIR paVerifiedDirs;
|
---|
298 | /** Magic value (SUPPREINITDATA_MAGIC). */
|
---|
299 | uint32_t u32EndMagic;
|
---|
300 | } SUPPREINITDATA;
|
---|
301 | typedef SUPPREINITDATA *PSUPPREINITDATA;
|
---|
302 | typedef SUPPREINITDATA const *PCSUPPREINITDATA;
|
---|
303 |
|
---|
304 | /** Magic value for SUPPREINITDATA::u32Magic and SUPPREINITDATA::u32EndMagic. */
|
---|
305 | #define SUPPREINITDATA_MAGIC UINT32_C(0xbeef0001)
|
---|
306 |
|
---|
307 | /** @copydoc supR3PreInit */
|
---|
308 | typedef DECLCALLBACK(int) FNSUPR3PREINIT(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
|
---|
309 | /** Pointer to supR3PreInit. */
|
---|
310 | typedef FNSUPR3PREINIT *PFNSUPR3PREINIT;
|
---|
311 |
|
---|
312 | /** The current SUPR3HardenedMain state / location. */
|
---|
313 | typedef enum SUPR3HARDENEDMAINSTATE
|
---|
314 | {
|
---|
315 | SUPR3HARDENEDMAINSTATE_NOT_YET_CALLED = 0,
|
---|
316 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_INIT_CALLED,
|
---|
317 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_IMPORTS_RESOLVED,
|
---|
318 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_DEVICE_OPENED,
|
---|
319 | SUPR3HARDENEDMAINSTATE_WIN_EP_CALLED,
|
---|
320 | SUPR3HARDENEDMAINSTATE_WIN_IMPORTS_RESOLVED,
|
---|
321 | SUPR3HARDENEDMAINSTATE_WIN_VERSION_INITIALIZED,
|
---|
322 | SUPR3HARDENEDMAINSTATE_WIN_VERIFY_TRUST_READY,
|
---|
323 | SUPR3HARDENEDMAINSTATE_HARDENED_MAIN_CALLED,
|
---|
324 | SUPR3HARDENEDMAINSTATE_INIT_RUNTIME,
|
---|
325 | SUPR3HARDENEDMAINSTATE_GET_TRUSTED_MAIN,
|
---|
326 | SUPR3HARDENEDMAINSTATE_CALLED_TRUSTED_MAIN,
|
---|
327 | SUPR3HARDENEDMAINSTATE_END,
|
---|
328 | SUPR3HARDENEDMAINSTATE_32BIT_HACK = 0x7fffffff
|
---|
329 | } SUPR3HARDENEDMAINSTATE;
|
---|
330 |
|
---|
331 |
|
---|
332 | /*******************************************************************************
|
---|
333 | * Global Variables *
|
---|
334 | *******************************************************************************/
|
---|
335 | extern DECLHIDDEN(uint32_t) g_u32Cookie;
|
---|
336 | extern DECLHIDDEN(uint32_t) g_u32SessionCookie;
|
---|
337 | extern DECLHIDDEN(SUPLIBDATA) g_supLibData;
|
---|
338 | extern DECLHIDDEN(uint32_t) g_uSupFakeMode;
|
---|
339 | extern DECLHIDDEN(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPageR0;
|
---|
340 | #ifdef ___SUPDrvIOC_h___
|
---|
341 | extern DECLHIDDEN(PSUPQUERYFUNCS) g_pSupFunctions;
|
---|
342 | #endif
|
---|
343 | extern DECLHIDDEN(SUPR3HARDENEDMAINSTATE) g_enmSupR3HardenedMainState;
|
---|
344 | #ifdef RT_OS_WINDOWS
|
---|
345 | extern DECLHIDDEN(bool) g_fSupEarlyProcessInit;
|
---|
346 | #endif
|
---|
347 |
|
---|
348 |
|
---|
349 | /*******************************************************************************
|
---|
350 | * OS Specific Function *
|
---|
351 | *******************************************************************************/
|
---|
352 | RT_C_DECLS_BEGIN
|
---|
353 | int suplibOsInstall(void);
|
---|
354 | int suplibOsUninstall(void);
|
---|
355 | int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted, SUPINITOP *penmWhat, PRTERRINFO pErrInfo);
|
---|
356 | int suplibOsTerm(PSUPLIBDATA pThis);
|
---|
357 | int suplibOsHardenedVerifyInit(void);
|
---|
358 | int suplibOsHardenedVerifyTerm(void);
|
---|
359 | int suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq);
|
---|
360 | int suplibOsIOCtlFast(PSUPLIBDATA pThis, uintptr_t uFunction, uintptr_t idCpu);
|
---|
361 | int suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages);
|
---|
362 | int suplibOsPageFree(PSUPLIBDATA pThis, void *pvPages, size_t cPages);
|
---|
363 | int suplibOsQueryVTxSupported(void);
|
---|
364 |
|
---|
365 |
|
---|
366 | /**
|
---|
367 | * Performs the pre-initialization of the support library.
|
---|
368 | *
|
---|
369 | * This is dynamically resolved and invoked by the static library before it
|
---|
370 | * calls RTR3InitEx and thereby SUPR3Init.
|
---|
371 | *
|
---|
372 | * @returns IPRT status code.
|
---|
373 | * @param pPreInitData The pre init data.
|
---|
374 | * @param fFlags The SUPR3HardenedMain flags.
|
---|
375 | */
|
---|
376 | DECLEXPORT(int) supR3PreInit(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
|
---|
377 |
|
---|
378 |
|
---|
379 | /** @copydoc RTPathAppPrivateNoArch */
|
---|
380 | DECLHIDDEN(int) supR3HardenedPathAppPrivateNoArch(char *pszPath, size_t cchPath);
|
---|
381 | /** @copydoc RTPathAppPrivateArch */
|
---|
382 | DECLHIDDEN(int) supR3HardenedPathAppPrivateArch(char *pszPath, size_t cchPath);
|
---|
383 | /** @copydoc RTPathSharedLibs */
|
---|
384 | DECLHIDDEN(int) supR3HardenedPathSharedLibs(char *pszPath, size_t cchPath);
|
---|
385 | /** @copydoc RTPathAppDocs */
|
---|
386 | DECLHIDDEN(int) supR3HardenedPathAppDocs(char *pszPath, size_t cchPath);
|
---|
387 | /** @copydoc RTPathExecDir */
|
---|
388 | DECLHIDDEN(int) supR3HardenedPathExecDir(char *pszPath, size_t cchPath);
|
---|
389 | /** @copydoc RTPathFilename */
|
---|
390 | DECLHIDDEN(char *) supR3HardenedPathFilename(const char *pszPath);
|
---|
391 |
|
---|
392 | /**
|
---|
393 | * Display a fatal error and try call TrustedError or quit.
|
---|
394 | */
|
---|
395 | DECLHIDDEN(void) supR3HardenedFatalMsgV(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va);
|
---|
396 |
|
---|
397 | /**
|
---|
398 | * Display a fatal error and try call TrustedError or quit.
|
---|
399 | */
|
---|
400 | DECLHIDDEN(void) supR3HardenedFatalMsg(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, ...);
|
---|
401 |
|
---|
402 | /**
|
---|
403 | * Display a fatal error and quit.
|
---|
404 | */
|
---|
405 | DECLHIDDEN(void) supR3HardenedFatalV(const char *pszFormat, va_list va);
|
---|
406 |
|
---|
407 | /**
|
---|
408 | * Display a fatal error and quit.
|
---|
409 | */
|
---|
410 | DECLHIDDEN(void) supR3HardenedFatal(const char *pszFormat, ...);
|
---|
411 |
|
---|
412 | /**
|
---|
413 | * Display an error which may or may not be fatal.
|
---|
414 | */
|
---|
415 | DECLHIDDEN(int) supR3HardenedErrorV(int rc, bool fFatal, const char *pszFormat, va_list va);
|
---|
416 |
|
---|
417 | /**
|
---|
418 | * Display an error which may or may not be fatal.
|
---|
419 | */
|
---|
420 | DECLHIDDEN(int) supR3HardenedError(int rc, bool fFatal, const char *pszFormat, ...);
|
---|
421 |
|
---|
422 | /**
|
---|
423 | * Open any startup log file specified in the argument.
|
---|
424 | */
|
---|
425 | DECLHIDDEN(void) supR3HardenedOpenLog(int *pcArgs, char **papszArgs);
|
---|
426 |
|
---|
427 | /**
|
---|
428 | * Write to the startup log file.
|
---|
429 | */
|
---|
430 | DECLHIDDEN(void) supR3HardenedLogV(const char *pszFormat, va_list va);
|
---|
431 |
|
---|
432 | /**
|
---|
433 | * Write to the startup log file.
|
---|
434 | */
|
---|
435 | DECLHIDDEN(void) supR3HardenedLog(const char *pszFormat, ...);
|
---|
436 |
|
---|
437 | /**
|
---|
438 | * Flushes the log file.
|
---|
439 | */
|
---|
440 | DECLHIDDEN(void) supR3HardenedLogFlush(void);
|
---|
441 |
|
---|
442 |
|
---|
443 | DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName);
|
---|
444 | DECLHIDDEN(int) supR3HardenedVerifyFixedDir(SUPINSTDIR enmDir, bool fFatal);
|
---|
445 | DECLHIDDEN(int) supR3HardenedVerifyFixedFile(const char *pszFilename, bool fFatal);
|
---|
446 | DECLHIDDEN(int) supR3HardenedVerifyDir(const char *pszDirPath, bool fRecursive, bool fCheckFiles, PRTERRINFO pErrInfo);
|
---|
447 | DECLHIDDEN(int) supR3HardenedVerifyFile(const char *pszFilename, RTHCUINTPTR hNativeFile, bool fMaybe3rdParty,
|
---|
448 | PRTERRINFO pErrInfo);
|
---|
449 | DECLHIDDEN(void) supR3HardenedGetPreInitData(PSUPPREINITDATA pPreInitData);
|
---|
450 | DECLHIDDEN(int) supR3HardenedRecvPreInitData(PCSUPPREINITDATA pPreInitData);
|
---|
451 |
|
---|
452 | #ifdef RT_OS_WINDOWS
|
---|
453 | DECLHIDDEN(void) supR3HardenedWinInit(uint32_t fFlags, bool fAvastKludge);
|
---|
454 | DECLHIDDEN(void) supR3HardenedWinInitVersion(void);
|
---|
455 | DECLHIDDEN(void) supR3HardenedWinInitImports(void);
|
---|
456 | # ifdef ___iprt_nt_nt_h___
|
---|
457 | DECLHIDDEN(void) supR3HardenedWinGetVeryEarlyImports(uintptr_t uNtDllAddr,
|
---|
458 | PFNNTWAITFORSINGLEOBJECT *ppfnNtWaitForSingleObject,
|
---|
459 | PFNNTSETEVENT *ppfnNtSetEvent);
|
---|
460 | # endif
|
---|
461 | DECLHIDDEN(void) supR3HardenedWinInitImportsEarly(uintptr_t uNtDllAddr);
|
---|
462 | DECLHIDDEN(void) supR3HardenedWinInitSyscalls(bool fReportErrors);
|
---|
463 | DECLHIDDEN(PFNRT) supR3HardenedWinGetRealDllSymbol(const char *pszDll, const char *pszProcedure);
|
---|
464 | DECLHIDDEN(void) supR3HardenedWinEnableThreadCreation(void);
|
---|
465 | DECLHIDDEN(void) supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation(const char *pszProgName);
|
---|
466 | DECLHIDDEN(void) supR3HardenedWinFlushLoaderCache();
|
---|
467 | DECLHIDDEN(bool) supR3HardenedWinIsReSpawnNeeded(int iWhich, int cArgs, char **papszArgs);
|
---|
468 | DECLHIDDEN(int) supR3HardenedWinReSpawn(int iWhich);
|
---|
469 | # ifdef _WINDEF_
|
---|
470 | DECLHIDDEN(void) supR3HardenedWinCreateParentWatcherThread(HMODULE hVBoxRT);
|
---|
471 | # endif
|
---|
472 | DECLHIDDEN(void *) supR3HardenedWinLoadLibrary(const char *pszName, bool fSystem32Only);
|
---|
473 | extern RTUTF16 g_wszSupLibHardenedExePath[1024];
|
---|
474 | # ifdef RTPATH_MAX
|
---|
475 | extern char g_szSupLibHardenedExePath[RTPATH_MAX];
|
---|
476 | # endif
|
---|
477 | DECLHIDDEN(void) supR3HardenedWinCompactHeaps(void);
|
---|
478 | DECLHIDDEN(void) supR3HardenedMainOpenDevice(void);
|
---|
479 | DECLHIDDEN(char *) supR3HardenedWinReadErrorInfoDevice(char *pszErrorInfo, size_t cbErrorInfo, const char *pszPrefix);
|
---|
480 | DECLHIDDEN(void) supR3HardenedWinReportErrorToParent(const char *pszWhere, SUPINITOP enmWhat, int rc,
|
---|
481 | const char *pszFormat, va_list va);
|
---|
482 | #endif
|
---|
483 |
|
---|
484 | SUPR3DECL(int) supR3PageLock(void *pvStart, size_t cPages, PSUPPAGE paPages);
|
---|
485 | SUPR3DECL(int) supR3PageUnlock(void *pvStart);
|
---|
486 |
|
---|
487 | RT_C_DECLS_END
|
---|
488 |
|
---|
489 |
|
---|
490 | #endif
|
---|
491 |
|
---|