1 | /* $Id: SUPLibInternal.h 53002 2014-10-08 23:46:15Z 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 supR3HardenedVerifyAll supR3HardenedStaticVerifyAll
|
---|
95 | # define supR3HardenedVerifyFixedDir supR3HardenedStaticVerifyFixedDir
|
---|
96 | # define supR3HardenedVerifyFixedFile supR3HardenedStaticVerifyFixedFile
|
---|
97 | # define supR3HardenedVerifyDir supR3HardenedStaticVerifyDir
|
---|
98 | # define supR3HardenedVerifyFile supR3HardenedStaticVerifyFile
|
---|
99 | # define supR3HardenedGetPreInitData supR3HardenedStaticGetPreInitData
|
---|
100 | # define supR3HardenedRecvPreInitData supR3HardenedStaticRecvPreInitData
|
---|
101 | /** @} */
|
---|
102 | #endif /* IN_SUP_HARDENED_R3 */
|
---|
103 |
|
---|
104 |
|
---|
105 | /** @name CRT function mappings (not using CRT on Windows).
|
---|
106 | * @{
|
---|
107 | */
|
---|
108 | #if defined(IN_SUP_HARDENED_R3) && defined(RT_OS_WINDOWS)
|
---|
109 | # define SUP_HARDENED_NEED_CRT_FUNCTIONS
|
---|
110 | DECLHIDDEN(int) suplibHardenedMemComp(void const *pvDst, const void *pvSrc, size_t cbToComp);
|
---|
111 | DECLHIDDEN(void *) suplibHardenedMemCopy(void *pvDst, const void *pvSrc, size_t cbToCopy);
|
---|
112 | DECLHIDDEN(void *) suplibHardenedMemSet(void *pvDst, int ch, size_t cbToSet);
|
---|
113 | DECLHIDDEN(char *) suplibHardenedStrCopy(char *pszDst, const char *pszSrc);
|
---|
114 | DECLHIDDEN(size_t) suplibHardenedStrLen(const char *psz);
|
---|
115 | DECLHIDDEN(char *) suplibHardenedStrCat(char *pszDst, const char *pszSrc);
|
---|
116 | DECLHIDDEN(int) suplibHardenedStrCmp(const char *psz1, const char *psz2);
|
---|
117 | DECLHIDDEN(int) suplibHardenedStrNCmp(const char *psz1, const char *psz2, size_t cchMax);
|
---|
118 | #else
|
---|
119 | # undef SUP_HARDENED_NEED_CRT_FUNCTIONS
|
---|
120 | # define suplibHardenedMemComp memcmp
|
---|
121 | # define suplibHardenedMemCopy memcpy
|
---|
122 | # define suplibHardenedMemSet memset
|
---|
123 | # define suplibHardenedStrCopy strcpy
|
---|
124 | # define suplibHardenedStrLen strlen
|
---|
125 | # define suplibHardenedStrCat strcat
|
---|
126 | # define suplibHardenedStrCmp strcmp
|
---|
127 | # define suplibHardenedStrNCmp strncmp
|
---|
128 | #endif
|
---|
129 | DECLNORETURN(void) suplibHardenedExit(RTEXITCODE rcExit);
|
---|
130 | DECLHIDDEN(void) suplibHardenedPrintF(const char *pszFormat, ...);
|
---|
131 | DECLHIDDEN(void) suplibHardenedPrintFV(const char *pszFormat, va_list va);
|
---|
132 |
|
---|
133 | /** @} */
|
---|
134 |
|
---|
135 | /** Debug output macro. */
|
---|
136 | #ifdef IN_SUP_HARDENED_R3
|
---|
137 | # if defined(DEBUG_bird) && defined(RT_OS_WINDOWS)
|
---|
138 | # define SUP_DPRINTF(a) do { supR3HardenedStaticLog a; suplibHardenedPrintF a; } while (0)
|
---|
139 | # else
|
---|
140 | # define SUP_DPRINTF(a) do { supR3HardenedStaticLog a; } while (0)
|
---|
141 | # endif
|
---|
142 | #else
|
---|
143 | # if defined(DEBUG_bird) && defined(RT_OS_WINDOWS)
|
---|
144 | # define SUP_DPRINTF(a) RTLogPrintf a
|
---|
145 | # else
|
---|
146 | # define SUP_DPRINTF(a) do { } while (0)
|
---|
147 | # endif
|
---|
148 | #endif
|
---|
149 |
|
---|
150 |
|
---|
151 | /*******************************************************************************
|
---|
152 | * Structures and Typedefs *
|
---|
153 | *******************************************************************************/
|
---|
154 | /**
|
---|
155 | * The type of an installed file.
|
---|
156 | */
|
---|
157 | typedef enum SUPINSTFILETYPE
|
---|
158 | {
|
---|
159 | kSupIFT_Invalid = 0,
|
---|
160 | kSupIFT_Exe,
|
---|
161 | kSupIFT_Dll,
|
---|
162 | kSupIFT_Rc,
|
---|
163 | kSupIFT_Sys,
|
---|
164 | kSupIFT_Script,
|
---|
165 | kSupIFT_Data,
|
---|
166 | kSupIFT_TestExe,
|
---|
167 | kSupIFT_TestDll,
|
---|
168 | kSupIFT_End
|
---|
169 | } SUPINSTFILETYPE;
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * Installation directory specifier.
|
---|
173 | */
|
---|
174 | typedef enum SUPINSTDIR
|
---|
175 | {
|
---|
176 | kSupID_Invalid = 0,
|
---|
177 | kSupID_Bin,
|
---|
178 | kSupID_AppBin,
|
---|
179 | kSupID_SharedLib,
|
---|
180 | kSupID_AppPrivArch,
|
---|
181 | kSupID_AppPrivArchComp,
|
---|
182 | kSupID_AppPrivNoArch,
|
---|
183 | kSupID_Testcase,
|
---|
184 | kSupID_End
|
---|
185 | } SUPINSTDIR;
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * Installed file.
|
---|
189 | */
|
---|
190 | typedef struct SUPINSTFILE
|
---|
191 | {
|
---|
192 | /** File type. */
|
---|
193 | SUPINSTFILETYPE enmType;
|
---|
194 | /** Install directory. */
|
---|
195 | SUPINSTDIR enmDir;
|
---|
196 | /** Optional (true) or mandatory (false. */
|
---|
197 | bool fOptional;
|
---|
198 | /** File name. */
|
---|
199 | const char *pszFile;
|
---|
200 | } SUPINSTFILE;
|
---|
201 | typedef SUPINSTFILE *PSUPINSTFILE;
|
---|
202 | typedef SUPINSTFILE const *PCSUPINSTFILE;
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * Status data for a verified file.
|
---|
206 | */
|
---|
207 | typedef struct SUPVERIFIEDFILE
|
---|
208 | {
|
---|
209 | /** The file handle or descriptor. -1 if not open. */
|
---|
210 | intptr_t hFile;
|
---|
211 | /** Whether the file has been validated. */
|
---|
212 | bool fValidated;
|
---|
213 | #ifdef RT_OS_WINDOWS
|
---|
214 | /** Whether we've checked the signature of the file. */
|
---|
215 | bool fCheckedSignature;
|
---|
216 | #endif
|
---|
217 | } SUPVERIFIEDFILE;
|
---|
218 | typedef SUPVERIFIEDFILE *PSUPVERIFIEDFILE;
|
---|
219 | typedef SUPVERIFIEDFILE const *PCSUPVERIFIEDFILE;
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * Status data for a verified directory.
|
---|
223 | */
|
---|
224 | typedef struct SUPVERIFIEDDIR
|
---|
225 | {
|
---|
226 | /** The directory handle or descriptor. -1 if not open. */
|
---|
227 | intptr_t hDir;
|
---|
228 | /** Whether the directory has been validated. */
|
---|
229 | bool fValidated;
|
---|
230 | } SUPVERIFIEDDIR;
|
---|
231 | typedef SUPVERIFIEDDIR *PSUPVERIFIEDDIR;
|
---|
232 | typedef SUPVERIFIEDDIR const *PCSUPVERIFIEDDIR;
|
---|
233 |
|
---|
234 |
|
---|
235 | /**
|
---|
236 | * SUPLib instance data.
|
---|
237 | *
|
---|
238 | * This is data that is passed from the static to the dynamic SUPLib
|
---|
239 | * in a hardened setup.
|
---|
240 | */
|
---|
241 | typedef struct SUPLIBDATA
|
---|
242 | {
|
---|
243 | /** The device handle. */
|
---|
244 | #if defined(RT_OS_WINDOWS)
|
---|
245 | void *hDevice;
|
---|
246 | #else
|
---|
247 | int hDevice;
|
---|
248 | #endif
|
---|
249 | /** Indicates whether we have unrestricted (true) or restricted access to the
|
---|
250 | * support device. */
|
---|
251 | bool fUnrestricted;
|
---|
252 | #if defined(RT_OS_DARWIN)
|
---|
253 | /** The connection to the VBoxSupDrv service. */
|
---|
254 | uintptr_t uConnection;
|
---|
255 | #elif defined(RT_OS_LINUX)
|
---|
256 | /** Indicates whether madvise(,,MADV_DONTFORK) works. */
|
---|
257 | bool fSysMadviseWorks;
|
---|
258 | #elif defined(RT_OS_SOLARIS)
|
---|
259 | /** Extra dummy file descriptors to prevent growing file-descriptor table on
|
---|
260 | * clean up (see @bugref{4650}). */
|
---|
261 | int ahDummy[SUPLIB_FLT_DUMMYFILES];
|
---|
262 | #elif defined(RT_OS_WINDOWS)
|
---|
263 | #endif
|
---|
264 | } SUPLIBDATA;
|
---|
265 | /** Pointer to the pre-init data. */
|
---|
266 | typedef SUPLIBDATA *PSUPLIBDATA;
|
---|
267 | /** Pointer to const pre-init data. */
|
---|
268 | typedef SUPLIBDATA const *PCSUPLIBDATA;
|
---|
269 |
|
---|
270 | /** The NIL value of SUPLIBDATA::hDevice. */
|
---|
271 | #if defined(RT_OS_WINDOWS)
|
---|
272 | # define SUP_HDEVICE_NIL NULL
|
---|
273 | #else
|
---|
274 | # define SUP_HDEVICE_NIL (-1)
|
---|
275 | #endif
|
---|
276 |
|
---|
277 |
|
---|
278 | /**
|
---|
279 | * Pre-init data that is handed over from the hardened executable stub.
|
---|
280 | */
|
---|
281 | typedef struct SUPPREINITDATA
|
---|
282 | {
|
---|
283 | /** Magic value (SUPPREINITDATA_MAGIC). */
|
---|
284 | uint32_t u32Magic;
|
---|
285 | /** The SUPLib instance data. */
|
---|
286 | SUPLIBDATA Data;
|
---|
287 | /** The number of entries in paInstallFiles and paVerifiedFiles. */
|
---|
288 | size_t cInstallFiles;
|
---|
289 | /** g_aSupInstallFiles. */
|
---|
290 | PCSUPINSTFILE paInstallFiles;
|
---|
291 | /** g_aSupVerifiedFiles. */
|
---|
292 | PCSUPVERIFIEDFILE paVerifiedFiles;
|
---|
293 | /** The number of entries in paVerifiedDirs. */
|
---|
294 | size_t cVerifiedDirs;
|
---|
295 | /** g_aSupVerifiedDirs. */
|
---|
296 | PCSUPVERIFIEDDIR paVerifiedDirs;
|
---|
297 | /** Magic value (SUPPREINITDATA_MAGIC). */
|
---|
298 | uint32_t u32EndMagic;
|
---|
299 | } SUPPREINITDATA;
|
---|
300 | typedef SUPPREINITDATA *PSUPPREINITDATA;
|
---|
301 | typedef SUPPREINITDATA const *PCSUPPREINITDATA;
|
---|
302 |
|
---|
303 | /** Magic value for SUPPREINITDATA::u32Magic and SUPPREINITDATA::u32EndMagic. */
|
---|
304 | #define SUPPREINITDATA_MAGIC UINT32_C(0xbeef0001)
|
---|
305 |
|
---|
306 | /** @copydoc supR3PreInit */
|
---|
307 | typedef DECLCALLBACK(int) FNSUPR3PREINIT(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
|
---|
308 | /** Pointer to supR3PreInit. */
|
---|
309 | typedef FNSUPR3PREINIT *PFNSUPR3PREINIT;
|
---|
310 |
|
---|
311 | /** The current SUPR3HardenedMain state / location. */
|
---|
312 | typedef enum SUPR3HARDENEDMAINSTATE
|
---|
313 | {
|
---|
314 | SUPR3HARDENEDMAINSTATE_NOT_YET_CALLED = 0,
|
---|
315 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_INIT_CALLED,
|
---|
316 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_IMPORTS_RESOLVED,
|
---|
317 | SUPR3HARDENEDMAINSTATE_WIN_EARLY_DEVICE_OPENED,
|
---|
318 | SUPR3HARDENEDMAINSTATE_WIN_EP_CALLED,
|
---|
319 | SUPR3HARDENEDMAINSTATE_WIN_IMPORTS_RESOLVED,
|
---|
320 | SUPR3HARDENEDMAINSTATE_WIN_VERSION_INITIALIZED,
|
---|
321 | SUPR3HARDENEDMAINSTATE_WIN_VERIFY_TRUST_READY,
|
---|
322 | SUPR3HARDENEDMAINSTATE_HARDENED_MAIN_CALLED,
|
---|
323 | SUPR3HARDENEDMAINSTATE_INIT_RUNTIME,
|
---|
324 | SUPR3HARDENEDMAINSTATE_GET_TRUSTED_MAIN,
|
---|
325 | SUPR3HARDENEDMAINSTATE_CALLED_TRUSTED_MAIN,
|
---|
326 | SUPR3HARDENEDMAINSTATE_END,
|
---|
327 | SUPR3HARDENEDMAINSTATE_32BIT_HACK = 0x7fffffff
|
---|
328 | } SUPR3HARDENEDMAINSTATE;
|
---|
329 |
|
---|
330 |
|
---|
331 | /*******************************************************************************
|
---|
332 | * Global Variables *
|
---|
333 | *******************************************************************************/
|
---|
334 | extern DECLHIDDEN(uint32_t) g_u32Cookie;
|
---|
335 | extern DECLHIDDEN(uint32_t) g_u32SessionCookie;
|
---|
336 | extern DECLHIDDEN(SUPLIBDATA) g_supLibData;
|
---|
337 | extern DECLHIDDEN(uint32_t) g_uSupFakeMode;
|
---|
338 | extern DECLHIDDEN(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPageR0;
|
---|
339 | #ifdef ___SUPDrvIOC_h___
|
---|
340 | extern DECLHIDDEN(PSUPQUERYFUNCS) g_pSupFunctions;
|
---|
341 | #endif
|
---|
342 | extern DECLHIDDEN(SUPR3HARDENEDMAINSTATE) g_enmSupR3HardenedMainState;
|
---|
343 | #ifdef RT_OS_WINDOWS
|
---|
344 | extern DECLHIDDEN(bool) g_fSupEarlyProcessInit;
|
---|
345 | #endif
|
---|
346 |
|
---|
347 |
|
---|
348 | /*******************************************************************************
|
---|
349 | * OS Specific Function *
|
---|
350 | *******************************************************************************/
|
---|
351 | RT_C_DECLS_BEGIN
|
---|
352 | int suplibOsInstall(void);
|
---|
353 | int suplibOsUninstall(void);
|
---|
354 | int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted, SUPINITOP *penmWhat, PRTERRINFO pErrInfo);
|
---|
355 | int suplibOsTerm(PSUPLIBDATA pThis);
|
---|
356 | int suplibOsHardenedVerifyInit(void);
|
---|
357 | int suplibOsHardenedVerifyTerm(void);
|
---|
358 | int suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq);
|
---|
359 | int suplibOsIOCtlFast(PSUPLIBDATA pThis, uintptr_t uFunction, uintptr_t idCpu);
|
---|
360 | int suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages);
|
---|
361 | int suplibOsPageFree(PSUPLIBDATA pThis, void *pvPages, size_t cPages);
|
---|
362 | int suplibOsQueryVTxSupported(void);
|
---|
363 |
|
---|
364 |
|
---|
365 | /**
|
---|
366 | * Performs the pre-initialization of the support library.
|
---|
367 | *
|
---|
368 | * This is dynamically resolved and invoked by the static library before it
|
---|
369 | * calls RTR3InitEx and thereby SUPR3Init.
|
---|
370 | *
|
---|
371 | * @returns IPRT status code.
|
---|
372 | * @param pPreInitData The pre init data.
|
---|
373 | * @param fFlags The SUPR3HardenedMain flags.
|
---|
374 | */
|
---|
375 | DECLEXPORT(int) supR3PreInit(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
|
---|
376 |
|
---|
377 |
|
---|
378 | /** @copydoc RTPathAppPrivateNoArch */
|
---|
379 | DECLHIDDEN(int) supR3HardenedPathAppPrivateNoArch(char *pszPath, size_t cchPath);
|
---|
380 | /** @copydoc RTPathAppPrivateArch */
|
---|
381 | DECLHIDDEN(int) supR3HardenedPathAppPrivateArch(char *pszPath, size_t cchPath);
|
---|
382 | /** @copydoc RTPathSharedLibs */
|
---|
383 | DECLHIDDEN(int) supR3HardenedPathSharedLibs(char *pszPath, size_t cchPath);
|
---|
384 | /** @copydoc RTPathAppDocs */
|
---|
385 | DECLHIDDEN(int) supR3HardenedPathAppDocs(char *pszPath, size_t cchPath);
|
---|
386 | /** @copydoc RTPathExecDir */
|
---|
387 | DECLHIDDEN(int) supR3HardenedPathExecDir(char *pszPath, size_t cchPath);
|
---|
388 | /** @copydoc RTPathFilename */
|
---|
389 | DECLHIDDEN(char *) supR3HardenedPathFilename(const char *pszPath);
|
---|
390 |
|
---|
391 | /**
|
---|
392 | * Display a fatal error and try call TrustedError or quit.
|
---|
393 | */
|
---|
394 | DECLHIDDEN(void) supR3HardenedFatalMsgV(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va);
|
---|
395 |
|
---|
396 | /**
|
---|
397 | * Display a fatal error and try call TrustedError or quit.
|
---|
398 | */
|
---|
399 | DECLHIDDEN(void) supR3HardenedFatalMsg(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, ...);
|
---|
400 |
|
---|
401 | /**
|
---|
402 | * Display a fatal error and quit.
|
---|
403 | */
|
---|
404 | DECLHIDDEN(void) supR3HardenedFatalV(const char *pszFormat, va_list va);
|
---|
405 |
|
---|
406 | /**
|
---|
407 | * Display a fatal error and quit.
|
---|
408 | */
|
---|
409 | DECLHIDDEN(void) supR3HardenedFatal(const char *pszFormat, ...);
|
---|
410 |
|
---|
411 | /**
|
---|
412 | * Display an error which may or may not be fatal.
|
---|
413 | */
|
---|
414 | DECLHIDDEN(int) supR3HardenedErrorV(int rc, bool fFatal, const char *pszFormat, va_list va);
|
---|
415 |
|
---|
416 | /**
|
---|
417 | * Display an error which may or may not be fatal.
|
---|
418 | */
|
---|
419 | DECLHIDDEN(int) supR3HardenedError(int rc, bool fFatal, const char *pszFormat, ...);
|
---|
420 |
|
---|
421 | /**
|
---|
422 | * Open any startup log file specified in the argument.
|
---|
423 | */
|
---|
424 | DECLHIDDEN(void) supR3HardenedOpenLog(int *pcArgs, char **papszArgs);
|
---|
425 |
|
---|
426 | /**
|
---|
427 | * Write to the startup log file.
|
---|
428 | */
|
---|
429 | DECLHIDDEN(void) supR3HardenedLogV(const char *pszFormat, va_list va);
|
---|
430 |
|
---|
431 | /**
|
---|
432 | * Write to the startup log file.
|
---|
433 | */
|
---|
434 | DECLHIDDEN(void) supR3HardenedLog(const char *pszFormat, ...);
|
---|
435 |
|
---|
436 |
|
---|
437 | DECLHIDDEN(int) supR3HardenedVerifyAll(bool fFatal, const char *pszProgName);
|
---|
438 | DECLHIDDEN(int) supR3HardenedVerifyFixedDir(SUPINSTDIR enmDir, bool fFatal);
|
---|
439 | DECLHIDDEN(int) supR3HardenedVerifyFixedFile(const char *pszFilename, bool fFatal);
|
---|
440 | DECLHIDDEN(int) supR3HardenedVerifyDir(const char *pszDirPath, bool fRecursive, bool fCheckFiles, PRTERRINFO pErrInfo);
|
---|
441 | DECLHIDDEN(int) supR3HardenedVerifyFile(const char *pszFilename, RTHCUINTPTR hNativeFile, bool fMaybe3rdParty,
|
---|
442 | PRTERRINFO pErrInfo);
|
---|
443 | DECLHIDDEN(void) supR3HardenedGetPreInitData(PSUPPREINITDATA pPreInitData);
|
---|
444 | DECLHIDDEN(int) supR3HardenedRecvPreInitData(PCSUPPREINITDATA pPreInitData);
|
---|
445 |
|
---|
446 | #ifdef RT_OS_WINDOWS
|
---|
447 | DECLHIDDEN(void) supR3HardenedWinInit(uint32_t fFlags, bool fAvastKludge);
|
---|
448 | DECLHIDDEN(void) supR3HardenedWinInitVersion(void);
|
---|
449 | DECLHIDDEN(void) supR3HardenedWinInitImports(void);
|
---|
450 | # ifdef ___iprt_nt_nt_h___
|
---|
451 | DECLHIDDEN(void) supR3HardenedWinGetVeryEarlyImports(uintptr_t uNtDllAddr,
|
---|
452 | PFNNTWAITFORSINGLEOBJECT *ppfnNtWaitForSingleObject,
|
---|
453 | PFNNTSETEVENT *ppfnNtSetEvent);
|
---|
454 | # endif
|
---|
455 | DECLHIDDEN(void) supR3HardenedWinInitImportsEarly(uintptr_t uNtDllAddr);
|
---|
456 | DECLHIDDEN(void) supR3HardenedWinInitSyscalls(bool fReportErrors);
|
---|
457 | DECLHIDDEN(PFNRT) supR3HardenedWinGetRealDllSymbol(const char *pszDll, const char *pszProcedure);
|
---|
458 | DECLHIDDEN(void) supR3HardenedWinEnableThreadCreation(void);
|
---|
459 | DECLHIDDEN(void) supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation(const char *pszProgName);
|
---|
460 | DECLHIDDEN(void) supR3HardenedWinFlushLoaderCache();
|
---|
461 | DECLHIDDEN(bool) supR3HardenedWinIsReSpawnNeeded(int iWhich, int cArgs, char **papszArgs);
|
---|
462 | DECLHIDDEN(int) supR3HardenedWinReSpawn(int iWhich);
|
---|
463 | # ifdef _WINDEF_
|
---|
464 | DECLHIDDEN(void) supR3HardenedWinCreateParentWatcherThread(HMODULE hVBoxRT);
|
---|
465 | # endif
|
---|
466 | DECLHIDDEN(void *) supR3HardenedWinLoadLibrary(const char *pszName, bool fSystem32Only);
|
---|
467 | extern RTUTF16 g_wszSupLibHardenedExePath[1024];
|
---|
468 | # ifdef RTPATH_MAX
|
---|
469 | extern char g_szSupLibHardenedExePath[RTPATH_MAX];
|
---|
470 | # endif
|
---|
471 | DECLHIDDEN(void) supR3HardenedWinCompactHeaps(void);
|
---|
472 | DECLHIDDEN(void) supR3HardenedMainOpenDevice(void);
|
---|
473 | DECLHIDDEN(char *) supR3HardenedWinReadErrorInfoDevice(char *pszErrorInfo, size_t cbErrorInfo, const char *pszPrefix);
|
---|
474 | DECLHIDDEN(void) supR3HardenedWinReportErrorToParent(const char *pszWhere, SUPINITOP enmWhat, int rc,
|
---|
475 | const char *pszFormat, va_list va);
|
---|
476 | #endif
|
---|
477 |
|
---|
478 | SUPR3DECL(int) supR3PageLock(void *pvStart, size_t cPages, PSUPPAGE paPages);
|
---|
479 | SUPR3DECL(int) supR3PageUnlock(void *pvStart);
|
---|
480 |
|
---|
481 | RT_C_DECLS_END
|
---|
482 |
|
---|
483 |
|
---|
484 | #endif
|
---|
485 |
|
---|