VirtualBox

Ignore:
Timestamp:
Jul 8, 2020 7:33:26 PM (4 years ago)
Author:
vboxsync
Message:

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h

    r82968 r85121  
    4444#ifndef SUP_CERTIFICATES_ONLY
    4545# ifdef RT_OS_WINDOWS
    46 DECLHIDDEN(int)     supHardenedWinInitImageVerifier(PRTERRINFO pErrInfo);
    47 DECLHIDDEN(void)    supHardenedWinTermImageVerifier(void);
    48 DECLHIDDEN(void)    supR3HardenedWinVerifyCacheScheduleImports(RTLDRMOD hLdrMod, PCRTUTF16 pwszName);
    49 DECLHIDDEN(void)    supR3HardenedWinVerifyCachePreload(PCRTUTF16 pwszName);
     46DECL_HIDDEN_NOTHROW(int)     supHardenedWinInitImageVerifier(PRTERRINFO pErrInfo);
     47DECL_HIDDEN_NOTHROW(void)    supHardenedWinTermImageVerifier(void);
     48DECL_HIDDEN_NOTHROW(void)    supR3HardenedWinVerifyCacheScheduleImports(RTLDRMOD hLdrMod, PCRTUTF16 pwszName);
     49DECL_HIDDEN_NOTHROW(void)    supR3HardenedWinVerifyCachePreload(PCRTUTF16 pwszName);
    5050
    5151
     
    7676#define SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_RW        RT_BIT_32(0)
    7777/** @} */
    78 DECLHIDDEN(int)     supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind, uint32_t fFlags,
    79                                                 uint32_t *pcFixes, PRTERRINFO pErrInfo);
    80 DECLHIDDEN(int)     supHardNtVpThread(HANDLE hProcess, HANDLE hThread, PRTERRINFO pErrInfo);
    81 DECLHIDDEN(int)     supHardNtVpDebugger(HANDLE hProcess, PRTERRINFO pErrInfo);
    82 
    83 DECLHIDDEN(bool)    supHardViUtf16PathIsEqualEx(PCRTUTF16 pawcLeft, size_t cwcLeft, const char *pszRight);
    84 DECLHIDDEN(bool)    supHardViUniStrPathStartsWithUniStr(UNICODE_STRING const *pUniStrLeft,
    85                                                         UNICODE_STRING const *pUniStrRight, bool fCheckSlash);
    86 DECLHIDDEN(bool)    supHardViUtf16PathStartsWithEx(PCRTUTF16 pwszLeft, uint32_t cwcLeft,
    87                                                 PCRTUTF16 pwszRight, uint32_t cwcRight, bool fCheckSlash);
    88 DECLHIDDEN(bool)    supHardViIsAppPatchDir(PCRTUTF16 pwszPath, uint32_t cwcName);
     78DECL_HIDDEN_NOTHROW(int)     supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind,
     79                                                         uint32_t fFlags, uint32_t *pcFixes, PRTERRINFO pErrInfo);
     80DECL_HIDDEN_NOTHROW(int)     supHardNtVpThread(HANDLE hProcess, HANDLE hThread, PRTERRINFO pErrInfo);
     81DECL_HIDDEN_NOTHROW(int)     supHardNtVpDebugger(HANDLE hProcess, PRTERRINFO pErrInfo);
     82
     83DECL_HIDDEN_NOTHROW(bool)    supHardViUtf16PathIsEqualEx(PCRTUTF16 pawcLeft, size_t cwcLeft, const char *pszRight);
     84DECL_HIDDEN_NOTHROW(bool)    supHardViUniStrPathStartsWithUniStr(UNICODE_STRING const *pUniStrLeft,
     85                                                                 UNICODE_STRING const *pUniStrRight, bool fCheckSlash);
     86DECL_HIDDEN_NOTHROW(bool)    supHardViUtf16PathStartsWithEx(PCRTUTF16 pwszLeft, uint32_t cwcLeft,
     87                                                            PCRTUTF16 pwszRight, uint32_t cwcRight, bool fCheckSlash);
     88DECL_HIDDEN_NOTHROW(bool)    supHardViIsAppPatchDir(PCRTUTF16 pwszPath, uint32_t cwcName);
    8989
    9090
     
    114114/** Pointer to an SUP image verifier loader reader instance. */
    115115typedef SUPHNTVIRDR *PSUPHNTVIRDR;
    116 DECLHIDDEN(int)  supHardNtViRdrCreate(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, PSUPHNTVIRDR *ppNtViRdr);
    117 DECLHIDDEN(bool) supHardenedWinIsWinVerifyTrustCallable(void);
    118 DECLHIDDEN(int)  supHardenedWinVerifyImageTrust(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, int rc,
    119                                                 bool *pfWinVerifyTrust, PRTERRINFO pErrInfo);
    120 DECLHIDDEN(int)  supHardenedWinVerifyImageByHandle(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, bool fAvoidWinVerifyTrust,
    121                                                    bool *pfWinVerifyTrust, PRTERRINFO pErrInfo);
    122 DECLHIDDEN(int)  supHardenedWinVerifyImageByHandleNoName(HANDLE hFile, uint32_t fFlags, PRTERRINFO pErrInfo);
    123 DECLHIDDEN(int)  supHardenedWinVerifyImageByLdrMod(RTLDRMOD hLdrMod, PCRTUTF16 pwszName, PSUPHNTVIRDR pNtViRdr,
    124                                                    bool fAvoidWinVerifyTrust, bool *pfWinVerifyTrust, PRTERRINFO pErrInfo);
     116DECL_HIDDEN_NOTHROW(int)  supHardNtViRdrCreate(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, PSUPHNTVIRDR *ppNtViRdr);
     117DECL_HIDDEN_NOTHROW(bool) supHardenedWinIsWinVerifyTrustCallable(void);
     118DECL_HIDDEN_NOTHROW(int)  supHardenedWinVerifyImageTrust(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, int rc,
     119                                                         bool *pfWinVerifyTrust, PRTERRINFO pErrInfo);
     120DECL_HIDDEN_NOTHROW(int)  supHardenedWinVerifyImageByHandle(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags,
     121                                                            bool fAvoidWinVerifyTrust, bool *pfWinVerifyTrust, PRTERRINFO pErrInfo);
     122DECL_HIDDEN_NOTHROW(int)  supHardenedWinVerifyImageByHandleNoName(HANDLE hFile, uint32_t fFlags, PRTERRINFO pErrInfo);
     123DECL_HIDDEN_NOTHROW(int)  supHardenedWinVerifyImageByLdrMod(RTLDRMOD hLdrMod, PCRTUTF16 pwszName, PSUPHNTVIRDR pNtViRdr,
     124                                                            bool fAvoidWinVerifyTrust, bool *pfWinVerifyTrust, PRTERRINFO pErrInfo);
    125125/** @name SUPHNTVI_F_XXX - Flags for supHardenedWinVerifyImageByHandle.
    126126 * @{ */
     
    176176/** Pointer to a loader cache entry. */
    177177typedef SUPHNTLDRCACHEENTRY *PSUPHNTLDRCACHEENTRY;
    178 DECLHIDDEN(int)  supHardNtLdrCacheOpen(const char *pszName, PSUPHNTLDRCACHEENTRY *ppEntry, PRTERRINFO pErrInfo);
    179 DECLHIDDEN(int)  supHardNtLdrCacheEntryVerify(PSUPHNTLDRCACHEENTRY pEntry, PCRTUTF16 pwszName, PRTERRINFO pErrInfo);
    180 DECLHIDDEN(int)  supHardNtLdrCacheEntryGetBits(PSUPHNTLDRCACHEENTRY pEntry, uint8_t **ppbBits, RTLDRADDR uBaseAddress,
    181                                                PFNRTLDRIMPORT pfnGetImport, void *pvUser, PRTERRINFO pErrInfo);
     178DECL_HIDDEN_NOTHROW(int)  supHardNtLdrCacheOpen(const char *pszName, PSUPHNTLDRCACHEENTRY *ppEntry, PRTERRINFO pErrInfo);
     179DECL_HIDDEN_NOTHROW(int)  supHardNtLdrCacheEntryVerify(PSUPHNTLDRCACHEENTRY pEntry, PCRTUTF16 pwszName, PRTERRINFO pErrInfo);
     180DECL_HIDDEN_NOTHROW(int)  supHardNtLdrCacheEntryGetBits(PSUPHNTLDRCACHEENTRY pEntry, uint8_t **ppbBits, RTLDRADDR uBaseAddress,
     181                                                        PFNRTLDRIMPORT pfnGetImport, void *pvUser, PRTERRINFO pErrInfo);
    182182
    183183
     
    189189} SUPHARDNTSYSROOTDIR;
    190190
    191 DECLHIDDEN(int) supHardNtGetSystemRootDir(void *pvBuf, uint32_t cbBuf, SUPHARDNTSYSROOTDIR enmDir, PRTERRINFO pErrInfo);
     191DECL_HIDDEN_NOTHROW(int) supHardNtGetSystemRootDir(void *pvBuf, uint32_t cbBuf, SUPHARDNTSYSROOTDIR enmDir, PRTERRINFO pErrInfo);
    192192
    193193#  ifndef SUPHNTVI_NO_NT_STUFF
     
    214214#   ifdef IN_RING0
    215215/** Pointer to NtQueryVirtualMemory. */
    216 typedef NTSTATUS (NTAPI *PFNNTQUERYVIRTUALMEMORY)(HANDLE, void const *, MEMORY_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
     216typedef DECLCALLBACKPTR_EX(NTSTATUS, NTAPI, PFNNTQUERYVIRTUALMEMORY,(HANDLE, void const *, MEMORY_INFORMATION_CLASS,
     217                                                                     PVOID, SIZE_T, PSIZE_T));
    217218extern PFNNTQUERYVIRTUALMEMORY g_pfnNtQueryVirtualMemory;
    218219#   endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette