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

Location:
trunk/src/VBox/HostDrivers/Support
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIDC.h

    r82968 r85121  
    268268 */
    269269/** @todo move this and change to function proto */
    270 typedef DECLCALLBACK(int) FNSUPDRVIDCENTRY(PSUPDRVSESSION pSession, uint32_t uReq, void *pvReq, uint32_t cbReq);
     270typedef DECLCALLBACKTYPE(int, FNSUPDRVIDCENTRY,(PSUPDRVSESSION pSession, uint32_t uReq, void *pvReq, uint32_t cbReq));
    271271
    272272/** @} */
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r82968 r85121  
    358358 * @param   hMod        Image handle for use in APIs.
    359359 */
    360 typedef DECLCALLBACK(int) FNR0MODULEINIT(void *hMod);
     360typedef DECLCALLBACKTYPE(int, FNR0MODULEINIT,(void *hMod));
    361361/** Pointer to a FNR0MODULEINIT(). */
    362362typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT;
     
    368368 * @param   hMod        Image handle for use in APIs.
    369369 */
    370 typedef DECLCALLBACK(void) FNR0MODULETERM(void *hMod);
     370typedef DECLCALLBACKTYPE(void, FNR0MODULETERM,(void *hMod));
    371371/** Pointer to a FNR0MODULETERM(). */
    372372typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM;
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r82968 r85121  
    8383*   Structures and Typedefs                                                                                                      *
    8484*********************************************************************************************************************************/
    85 typedef DECLCALLBACK(int) FNCALLVMMR0(PVMR0 pVMR0, unsigned uOperation, void *pvArg);
     85typedef DECLCALLBACKTYPE(int, FNCALLVMMR0,(PVMR0 pVMR0, unsigned uOperation, void *pvArg));
    8686typedef FNCALLVMMR0 *PFNCALLVMMR0;
    8787
  • trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h

    r85095 r85121  
    311311
    312312/** @copydoc supR3PreInit */
    313 typedef DECLCALLBACK(int) FNSUPR3PREINIT(PSUPPREINITDATA pPreInitData, uint32_t fFlags);
     313typedef DECLCALLBACKTYPE(int, FNSUPR3PREINIT,(PSUPPREINITDATA pPreInitData, uint32_t fFlags));
    314314/** Pointer to supR3PreInit. */
    315315typedef FNSUPR3PREINIT *PFNSUPR3PREINIT;
  • trunk/src/VBox/HostDrivers/Support/SUPLibLdr.cpp

    r82968 r85121  
    6565*   Structures and Typedefs                                                                                                      *
    6666*********************************************************************************************************************************/
    67 typedef DECLCALLBACK(int) FNCALLVMMR0(PVMR0 pVMR0, unsigned uOperation, void *pvArg);
     67typedef DECLCALLBACKTYPE(int, FNCALLVMMR0,(PVMR0 pVMR0, unsigned uOperation, void *pvArg));
    6868typedef FNCALLVMMR0 *PFNCALLVMMR0;
    6969
  • trunk/src/VBox/HostDrivers/Support/SUPR0IdcClientStubs.c

    r82968 r85121  
    8181SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2)
    8282{
    83     static DECLCALLBACKPTR(void *, s_pfn)(PSUPDRVSESSION /* pSession */, SUPDRVOBJTYPE /* enmType */, PFNSUPDRVDESTRUCTOR /* pfnDestructor */, void * /* pvUser1 */, void * /* pvUser2 */);
    84     DECLCALLBACKPTR(void *,          pfn)(PSUPDRVSESSION /* pSession */, SUPDRVOBJTYPE /* enmType */, PFNSUPDRVDESTRUCTOR /* pfnDestructor */, void * /* pvUser1 */, void * /* pvUser2 */);
     83    static DECLCALLBACKPTR(void *, s_pfn,(PSUPDRVSESSION /* pSession */, SUPDRVOBJTYPE /* enmType */, PFNSUPDRVDESTRUCTOR /* pfnDestructor */, void * /* pvUser1 */, void * /* pvUser2 */));
     84    DECLCALLBACKPTR(void *,          pfn,(PSUPDRVSESSION /* pSession */, SUPDRVOBJTYPE /* enmType */, PFNSUPDRVDESTRUCTOR /* pfnDestructor */, void * /* pvUser1 */, void * /* pvUser2 */));
    8585    pfn = s_pfn;
    8686    if (!pfn)
     
    9898SUPR0DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession)
    9999{
    100     static DECLCALLBACKPTR(int, s_pfn)(void * /* pvObj */, PSUPDRVSESSION /* pSession */);
    101     DECLCALLBACKPTR(int,          pfn)(void * /* pvObj */, PSUPDRVSESSION /* pSession */);
     100    static DECLCALLBACKPTR(int, s_pfn,(void * /* pvObj */, PSUPDRVSESSION /* pSession */));
     101    DECLCALLBACKPTR(int,          pfn,(void * /* pvObj */, PSUPDRVSESSION /* pSession */));
    102102    pfn = s_pfn;
    103103    if (!pfn)
     
    115115SUPR0DECL(int) SUPR0ObjRelease(void *pvObj, PSUPDRVSESSION pSession)
    116116{
    117     static DECLCALLBACKPTR(int, s_pfn)(void * /* pvObj */, PSUPDRVSESSION /* pSession */);
    118     DECLCALLBACKPTR(int,          pfn)(void * /* pvObj */, PSUPDRVSESSION /* pSession */);
     117    static DECLCALLBACKPTR(int, s_pfn,(void * /* pvObj */, PSUPDRVSESSION /* pSession */));
     118    DECLCALLBACKPTR(int,          pfn,(void * /* pvObj */, PSUPDRVSESSION /* pSession */));
    119119    pfn = s_pfn;
    120120    if (!pfn)
     
    132132SUPR0DECL(int) SUPR0ObjVerifyAccess(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName)
    133133{
    134     static DECLCALLBACKPTR(int, s_pfn)(void * /* pvObj */, PSUPDRVSESSION /* pSession */, const char * /* pszObjName */);
    135     DECLCALLBACKPTR(int,          pfn)(void * /* pvObj */, PSUPDRVSESSION /* pSession */, const char * /* pszObjName */);
     134    static DECLCALLBACKPTR(int, s_pfn,(void * /* pvObj */, PSUPDRVSESSION /* pSession */, const char * /* pszObjName */));
     135    DECLCALLBACKPTR(int,          pfn,(void * /* pvObj */, PSUPDRVSESSION /* pSession */, const char * /* pszObjName */));
    136136    pfn = s_pfn;
    137137    if (!pfn)
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp

    r85095 r85121  
    485485*********************************************************************************************************************************/
    486486/** @see RTR3InitEx */
    487 typedef DECLCALLBACK(int) FNRTR3INITEX(uint32_t iVersion, uint32_t fFlags, int cArgs,
    488                                        char **papszArgs, const char *pszProgramPath);
     487typedef DECLCALLBACKTYPE(int, FNRTR3INITEX,(uint32_t iVersion, uint32_t fFlags, int cArgs,
     488                                            char **papszArgs, const char *pszProgramPath));
    489489typedef FNRTR3INITEX *PFNRTR3INITEX;
    490490
    491491/** @see RTLogRelPrintf */
    492 typedef DECLCALLBACK(void) FNRTLOGRELPRINTF(const char *pszFormat, ...);
     492typedef DECLCALLBACKTYPE(void, FNRTLOGRELPRINTF,(const char *pszFormat, ...));
    493493typedef FNRTLOGRELPRINTF *PFNRTLOGRELPRINTF;
    494494
  • trunk/src/VBox/HostDrivers/Support/SUPSvc.cpp

    r82968 r85121  
    7373     * @param   ppvInstance     Where to store the instance handle.
    7474     */
    75     DECLCALLBACKMEMBER(int,  pfnCreate)(void **ppvInstance);
     75    DECLCALLBACKMEMBER(int, pfnCreate,(void **ppvInstance));
    7676
    7777    /**
     
    8181     * @param   pvInstance      The instance handle.
    8282     */
    83     DECLCALLBACKMEMBER(void, pfnStart)(void *pvInstance);
     83    DECLCALLBACKMEMBER(void, pfnStart,(void *pvInstance));
    8484
    8585    /**
     
    9292     * @param   pvInstance      The instance handle.
    9393     */
    94     DECLCALLBACKMEMBER(int,  pfnTryStop)(void *pvInstance);
     94    DECLCALLBACKMEMBER(int, pfnTryStop,(void *pvInstance));
    9595
    9696    /**
     
    100100     * @param   fRunning        Whether the service is running or not.
    101101     */
    102     DECLCALLBACKMEMBER(void, pfnStopAndDestroy)(void *pvInstance, bool fRunning);
     102    DECLCALLBACKMEMBER(void, pfnStopAndDestroy,(void *pvInstance, bool fRunning));
    103103} SUPSVCSERVICE;
    104104/** Pointer to a service descriptor. */
  • trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp

    r82968 r85121  
    8282 * to patch the lazy loader trampoline function, but rather the real function!
    8383 */
    84 typedef DECLCALLBACK(void) FNSUPHARDENEDSYMRESOLVE(void);
     84typedef DECLCALLBACKTYPE(void, FNSUPHARDENEDSYMRESOLVE,(void));
    8585/** Pointer to FNSUPHARDENEDSYMRESOLVE. */
    8686typedef FNSUPHARDENEDSYMRESOLVE *PFNSUPHARDENEDSYMRESOLVE;
  • 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
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp

    r84398 r85121  
    8585
    8686#ifdef IN_RING3
    87 typedef LONG (WINAPI * PFNWINVERIFYTRUST)(HWND hwnd, GUID const *pgActionID, PVOID pWVTData);
    88 typedef BOOL (WINAPI * PFNCRYPTCATADMINACQUIRECONTEXT)(HCATADMIN *phCatAdmin, const GUID *pGuidSubsystem, DWORD dwFlags);
    89 typedef BOOL (WINAPI * PFNCRYPTCATADMINACQUIRECONTEXT2)(HCATADMIN *phCatAdmin, const GUID *pGuidSubsystem, PCWSTR pwszHashAlgorithm,
    90                                                         struct _CERT_STRONG_SIGN_PARA const *pStrongHashPolicy, DWORD dwFlags);
    91 typedef BOOL (WINAPI * PFNCRYPTCATADMINCALCHASHFROMFILEHANDLE)(HANDLE hFile, DWORD *pcbHash, BYTE *pbHash, DWORD dwFlags);
    92 typedef BOOL (WINAPI * PFNCRYPTCATADMINCALCHASHFROMFILEHANDLE2)(HCATADMIN hCatAdmin, HANDLE hFile, DWORD *pcbHash,
    93                                                                 BYTE *pbHash, DWORD dwFlags);
    94 typedef HCATINFO (WINAPI *PFNCRYPTCATADMINENUMCATALOGFROMHASH)(HCATADMIN hCatAdmin, BYTE *pbHash, DWORD cbHash,
    95                                                                DWORD dwFlags, HCATINFO *phPrevCatInfo);
    96 typedef BOOL (WINAPI * PFNCRYPTCATADMINRELEASECATALOGCONTEXT)(HCATADMIN hCatAdmin, HCATINFO hCatInfo, DWORD dwFlags);
    97 typedef BOOL (WINAPI * PFNCRYPTCATDADMINRELEASECONTEXT)(HCATADMIN hCatAdmin, DWORD dwFlags);
    98 typedef BOOL (WINAPI * PFNCRYPTCATCATALOGINFOFROMCONTEXT)(HCATINFO hCatInfo, CATALOG_INFO *psCatInfo, DWORD dwFlags);
    99 
    100 typedef HCERTSTORE (WINAPI *PFNCERTOPENSTORE)(PCSTR pszStoreProvider, DWORD dwEncodingType, HCRYPTPROV_LEGACY hCryptProv,
    101                                               DWORD dwFlags, const void *pvParam);
    102 typedef BOOL (WINAPI *PFNCERTCLOSESTORE)(HCERTSTORE hCertStore, DWORD dwFlags);
    103 typedef PCCERT_CONTEXT (WINAPI *PFNCERTENUMCERTIFICATESINSTORE)(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrevCertContext);
    104 
    105 typedef NTSTATUS (WINAPI *PFNBCRYPTOPENALGORTIHMPROVIDER)(BCRYPT_ALG_HANDLE *phAlgo, PCWSTR pwszAlgoId,
    106                                                           PCWSTR pwszImpl, DWORD dwFlags);
     87typedef DECLCALLBACKPTR_EX(LONG, WINAPI, PFNWINVERIFYTRUST,(HWND hwnd, GUID const *pgActionID, PVOID pWVTData));
     88typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATADMINACQUIRECONTEXT,(HCATADMIN *phCatAdmin, const GUID *pGuidSubsystem,
     89                                                                         DWORD dwFlags));
     90typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATADMINACQUIRECONTEXT2,(HCATADMIN *phCatAdmin, const GUID *pGuidSubsystem,
     91                                                                          PCWSTR pwszHashAlgorithm,
     92                                                                          struct _CERT_STRONG_SIGN_PARA const *pStrongHashPolicy,
     93                                                                          DWORD dwFlags));
     94typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATADMINCALCHASHFROMFILEHANDLE,(HANDLE hFile, DWORD *pcbHash, BYTE *pbHash,
     95                                                                                 DWORD dwFlags));
     96typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATADMINCALCHASHFROMFILEHANDLE2,(HCATADMIN hCatAdmin, HANDLE hFile,
     97                                                                                  DWORD *pcbHash, BYTE *pbHash, DWORD dwFlags));
     98typedef DECLCALLBACKPTR_EX(HCATINFO, WINAPI, PFNCRYPTCATADMINENUMCATALOGFROMHASH,(HCATADMIN hCatAdmin, BYTE *pbHash, DWORD cbHash,
     99                                                                                  DWORD dwFlags, HCATINFO *phPrevCatInfo));
     100typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATADMINRELEASECATALOGCONTEXT,(HCATADMIN hCatAdmin, HCATINFO hCatInfo,
     101                                                                                DWORD dwFlags));
     102typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATDADMINRELEASECONTEXT,(HCATADMIN hCatAdmin, DWORD dwFlags));
     103typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCRYPTCATCATALOGINFOFROMCONTEXT,(HCATINFO hCatInfo, CATALOG_INFO *psCatInfo,
     104                                                                            DWORD dwFlags));
     105
     106typedef DECLCALLBACKPTR_EX(HCERTSTORE, WINAPI, PFNCERTOPENSTORE,(PCSTR pszStoreProvider, DWORD dwEncodingType,
     107                                                                 HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvParam));
     108typedef DECLCALLBACKPTR_EX(BOOL, WINAPI, PFNCERTCLOSESTORE,(HCERTSTORE hCertStore, DWORD dwFlags));
     109typedef DECLCALLBACKPTR_EX(PCCERT_CONTEXT, WINAPI, PFNCERTENUMCERTIFICATESINSTORE,(HCERTSTORE hCertStore,
     110                                                                                   PCCERT_CONTEXT pPrevCertContext));
     111
     112typedef DECLCALLBACKPTR_EX(NTSTATUS, WINAPI, PFNBCRYPTOPENALGORTIHMPROVIDER,(BCRYPT_ALG_HANDLE *phAlgo, PCWSTR pwszAlgoId,
     113                                                                             PCWSTR pwszImpl, DWORD dwFlags));
    107114#endif
    108115
     
    363370 * @param   ppNtViRdr       Where to store the reader instance on success.
    364371 */
    365 DECLHIDDEN(int) supHardNtViRdrCreate(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, PSUPHNTVIRDR *ppNtViRdr)
     372DECL_HIDDEN_NOTHROW(int) supHardNtViRdrCreate(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, PSUPHNTVIRDR *ppNtViRdr)
    366373{
    367374    /*
     
    526533 * @param   pszRight            The ascii string.
    527534 */
    528 DECLHIDDEN(bool) supHardViUtf16PathIsEqualEx(PCRTUTF16 pawcLeft, size_t cwcLeft, const char *pszRight)
     535DECL_HIDDEN_NOTHROW(bool) supHardViUtf16PathIsEqualEx(PCRTUTF16 pawcLeft, size_t cwcLeft, const char *pszRight)
    529536{
    530537    for (;;)
     
    641648 * @param   fCheckSlash         Check for a slash following the prefix.
    642649 */
    643 DECLHIDDEN(bool) supHardViUtf16PathStartsWithEx(PCRTUTF16 pwszLeft, uint32_t cwcLeft,
    644                                                 PCRTUTF16 pwszRight, uint32_t cwcRight, bool fCheckSlash)
     650DECL_HIDDEN_NOTHROW(bool) supHardViUtf16PathStartsWithEx(PCRTUTF16 pwszLeft, uint32_t cwcLeft,
     651                                                         PCRTUTF16 pwszRight, uint32_t cwcRight, bool fCheckSlash) RT_NOTHROW_DEF
    645652{
    646653    if (cwcLeft < cwcRight || !cwcRight || !pwszRight)
     
    685692 * @param   fCheckSlash         Check for a slash following the prefix.
    686693 */
    687 DECLHIDDEN(bool) supHardViUniStrPathStartsWithUniStr(UNICODE_STRING const *pUniStrLeft, UNICODE_STRING const *pUniStrRight,
    688                                                      bool fCheckSlash)
     694DECL_HIDDEN_NOTHROW(bool) supHardViUniStrPathStartsWithUniStr(UNICODE_STRING const *pUniStrLeft,
     695                                                              UNICODE_STRING const *pUniStrRight, bool fCheckSlash) RT_NOTHROW_DEF
    689696{
    690697    return supHardViUtf16PathStartsWithEx(pUniStrLeft->Buffer, pUniStrLeft->Length / sizeof(WCHAR),
     
    719726 * @param   pwszPath        The path to examine.
    720727 */
    721 DECLHIDDEN(bool) supHardViIsAppPatchDir(PCRTUTF16 pwszPath, uint32_t cwcName)
     728DECL_HIDDEN_NOTHROW(bool) supHardViIsAppPatchDir(PCRTUTF16 pwszPath, uint32_t cwcName)
    722729{
    723730    uint32_t cwcWinDir = (g_System32NtPath.UniStr.Length - sizeof(L"System32")) / sizeof(WCHAR);
     
    11591166 * @param   pErrInfo            Pointer to error info structure. Optional.
    11601167 */
    1161 DECLHIDDEN(int) supHardenedWinVerifyImageByLdrMod(RTLDRMOD hLdrMod, PCRTUTF16 pwszName, PSUPHNTVIRDR pNtViRdr,
    1162                                                   bool fAvoidWinVerifyTrust, bool *pfWinVerifyTrust, PRTERRINFO pErrInfo)
     1168DECL_HIDDEN_NOTHROW(int) supHardenedWinVerifyImageByLdrMod(RTLDRMOD hLdrMod, PCRTUTF16 pwszName, PSUPHNTVIRDR pNtViRdr,
     1169                                                           bool fAvoidWinVerifyTrust, bool *pfWinVerifyTrust, PRTERRINFO pErrInfo)
    11631170{
    11641171    if (pfWinVerifyTrust)
     
    13581365 * @param   pErrInfo            Pointer to error info structure. Optional.
    13591366 */
    1360 DECLHIDDEN(int) supHardenedWinVerifyImageByHandle(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, bool fAvoidWinVerifyTrust,
    1361                                                   bool *pfWinVerifyTrust, PRTERRINFO pErrInfo)
     1367DECL_HIDDEN_NOTHROW(int) supHardenedWinVerifyImageByHandle(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags,
     1368                                                           bool fAvoidWinVerifyTrust, bool *pfWinVerifyTrust, PRTERRINFO pErrInfo)
    13621369{
    13631370    /*
     
    14051412 * @param   pErrInfo    Pointer to error info structure. Optional.
    14061413 */
    1407 DECLHIDDEN(int) supHardenedWinVerifyImageByHandleNoName(HANDLE hFile, uint32_t fFlags, PRTERRINFO pErrInfo)
     1414DECL_HIDDEN_NOTHROW(int) supHardenedWinVerifyImageByHandleNoName(HANDLE hFile, uint32_t fFlags, PRTERRINFO pErrInfo)
    14081415{
    14091416    /*
     
    14481455 * @param   pErrInfo            Pointer to error info structure. Optional.
    14491456 */
    1450 DECLHIDDEN(int) supHardNtGetSystemRootDir(void *pvBuf, uint32_t cbBuf, SUPHARDNTSYSROOTDIR enmDir, PRTERRINFO pErrInfo)
     1457DECL_HIDDEN_NOTHROW(int) supHardNtGetSystemRootDir(void *pvBuf, uint32_t cbBuf, SUPHARDNTSYSROOTDIR enmDir, PRTERRINFO pErrInfo)
    14511458{
    14521459    HANDLE              hFile = RTNT_INVALID_HANDLE_VALUE;
     
    17931800 * @param   pErrInfo            Where to return extended error info. Optional.
    17941801 */
    1795 DECLHIDDEN(int) supHardenedWinInitImageVerifier(PRTERRINFO pErrInfo)
     1802DECL_HIDDEN_NOTHROW(int) supHardenedWinInitImageVerifier(PRTERRINFO pErrInfo)
    17961803{
    17971804    AssertReturn(!RTCrX509Certificate_IsPresent(&g_BuildX509Cert), VERR_WRONG_ORDER);
     
    18841891 * Releases resources allocated by supHardenedWinInitImageVerifier.
    18851892 */
    1886 DECLHIDDEN(void) supHardenedWinTermImageVerifier(void)
     1893DECL_HIDDEN_NOTHROW(void) supHardenedWinTermImageVerifier(void)
    18871894{
    18881895    if (RTCrX509Certificate_IsPresent(&g_BuildX509Cert))
     
    20492056 * @param   fMandatory          Whether the library is mandatory.
    20502057 */
    2051 DECLHIDDEN(HMODULE) supR3HardenedWinLoadSystem32Dll(const char *pszName, bool fMandatory)
     2058DECL_HIDDEN_NOTHROW(HMODULE) supR3HardenedWinLoadSystem32Dll(const char *pszName, bool fMandatory)
    20522059{
    20532060    WCHAR wszName[200+60];
     
    21632170 * @param   pszProgName     The program name.
    21642171 */
    2165 DECLHIDDEN(void) supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation(const char *pszProgName)
     2172DECL_HIDDEN_NOTHROW(void) supR3HardenedWinResolveVerifyTrustApiAndHookThreadCreation(const char *pszProgName)
    21662173{
    21672174# ifdef IN_SUP_HARDENED_R3
     
    27692776 * @param   pErrInfo            Pointer to error info structure. Optional.
    27702777 */
    2771 DECLHIDDEN(int) supHardenedWinVerifyImageTrust(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, int rc,
    2772                                                bool *pfWinVerifyTrust, PRTERRINFO pErrInfo)
     2778DECL_HIDDEN_NOTHROW(int) supHardenedWinVerifyImageTrust(HANDLE hFile, PCRTUTF16 pwszName, uint32_t fFlags, int rc,
     2779                                                        bool *pfWinVerifyTrust, PRTERRINFO pErrInfo)
    27732780{
    27742781    if (pfWinVerifyTrust)
     
    28802887 * @returns true if callable on current thread, false if not.
    28812888 */
    2882 DECLHIDDEN(bool) supHardenedWinIsWinVerifyTrustCallable(void)
     2889DECL_HIDDEN_NOTHROW(bool) supHardenedWinIsWinVerifyTrustCallable(void)
    28832890{
    28842891    return g_pfnWinVerifyTrust != NULL
     
    28942901 * Called from suplibHardenedWindowsMain and suplibOsInit.
    28952902 */
    2896 DECLHIDDEN(void) supR3HardenedWinInitVersion(bool fEarly)
     2903DECL_HIDDEN_NOTHROW(void) supR3HardenedWinInitVersion(bool fEarly)
    28972904{
    28982905    /*
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r84394 r85121  
    413413static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, bool fIgnoreArch, PULONG pfAccess, PULONG pfProtect,
    414414                                         bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust,
    415                                          bool *pfQuiet);
     415                                         bool *pfQuiet) RT_NOTHROW_PROTO;
    416416static void     supR3HardenedWinRegisterDllNotificationCallback(void);
    417 static void     supR3HardenedWinReInstallHooks(bool fFirst);
     417static void     supR3HardenedWinReInstallHooks(bool fFirst) RT_NOTHROW_PROTO;
    418418DECLASM(void)   supR3HardenedEarlyProcessInitThunk(void);
    419419DECLASM(void)   supR3HardenedMonitor_KiUserApcDispatcher(void);
     
    556556 * @param   pIndexNumber    where to return the index number.
    557557 */
    558 static bool supR3HardenedWinVerifyCacheGetIndexNumber(HANDLE hFile, PLARGE_INTEGER pIndexNumber)
     558static bool supR3HardenedWinVerifyCacheGetIndexNumber(HANDLE hFile, PLARGE_INTEGER pIndexNumber) RT_NOTHROW_DEF
    559559{
    560560    IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
     
    576576 * @param   pUniStr             String to hash.
    577577 */
    578 static uint32_t supR3HardenedWinVerifyCacheHashPath(PCUNICODE_STRING pUniStr)
     578static uint32_t supR3HardenedWinVerifyCacheHashPath(PCUNICODE_STRING pUniStr) RT_NOTHROW_DEF
    579579{
    580580    uint32_t uHash   = 0;
     
    603603 * @param   pszName             The import name (UTF-8).
    604604 */
    605 static uint32_t supR3HardenedWinVerifyCacheHashDirAndFile(PCRTUTF16 pawcDir, uint32_t cwcDir, const char *pszName)
     605static uint32_t supR3HardenedWinVerifyCacheHashDirAndFile(PCRTUTF16 pawcDir, uint32_t cwcDir, const char *pszName) RT_NOTHROW_DEF
    606606{
    607607    uint32_t uHash = 0;
     
    635635 * @param   cwcToCompare        The number of chars to compare.
    636636 */
    637 static bool supR3HardenedWinVerifyCacheIsMatch(PCRTUTF16 pawcLeft, PCRTUTF16 pawcRight, uint32_t cwcToCompare)
     637static bool supR3HardenedWinVerifyCacheIsMatch(PCRTUTF16 pawcLeft, PCRTUTF16 pawcRight, uint32_t cwcToCompare) RT_NOTHROW_DEF
    638638{
    639639    /* Try a quick memory compare first. */
     
    671671 */
    672672static void supR3HardenedWinVerifyCacheInsert(PCUNICODE_STRING pUniStr, HANDLE hFile, int rc,
    673                                               bool fWinVerifyTrust, uint32_t fFlags)
     673                                              bool fWinVerifyTrust, uint32_t fFlags) RT_NOTHROW_DEF
    674674{
    675675    /*
     
    734734 * @param   hFile               The file handle.
    735735 */
    736 static PVERIFIERCACHEENTRY supR3HardenedWinVerifyCacheLookup(PCUNICODE_STRING pUniStr, HANDLE hFile)
     736static PVERIFIERCACHEENTRY supR3HardenedWinVerifyCacheLookup(PCUNICODE_STRING pUniStr, HANDLE hFile) RT_NOTHROW_DEF
    737737{
    738738    PRTUTF16 const      pwszPath = pUniStr->Buffer;
     
    12031203 * @param   rc                      VBox status code.
    12041204 */
    1205 static NTSTATUS supR3HardenedScreenImageCalcStatus(int rc)
     1205static NTSTATUS supR3HardenedScreenImageCalcStatus(int rc) RT_NOTHROW_DEF
    12061206{
    12071207    /* This seems to be what LdrLoadDll returns when loading a 32-bit DLL into
     
    12401240 *                                  lots of times already).  Optional.
    12411241 */
    1242 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, bool fIgnoreArch, PULONG pfAccess, PULONG pfProtect,
    1243                                          bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust, bool *pfQuiet)
     1242static NTSTATUS
     1243supR3HardenedScreenImage(HANDLE hFile, bool fImage, bool fIgnoreArch, PULONG pfAccess, PULONG pfProtect,
     1244                         bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust, bool *pfQuiet) RT_NOTHROW_DEF
    12441245{
    12451246    *pfCallRealApi = false;
     
    23582359 * @remarks The loader lock is held when we're called, at least on Windows 7.
    23592360 */
    2360 static VOID CALLBACK supR3HardenedDllNotificationCallback(ULONG ulReason, PCLDR_DLL_NOTIFICATION_DATA pData, PVOID pvUser)
     2361static VOID CALLBACK
     2362supR3HardenedDllNotificationCallback(ULONG ulReason, PCLDR_DLL_NOTIFICATION_DATA pData, PVOID pvUser) RT_NOTHROW_DEF
    23612363{
    23622364    NOREF(pvUser);
     
    27662768 * @returns true if we're positive we're alone, false if not.
    27672769 */
    2768 static bool supR3HardenedWinAmIAlone(void)
     2770static bool supR3HardenedWinAmIAlone(void) RT_NOTHROW_DEF
    27692771{
    27702772    ULONG    fAmIAlone = 0;
     
    27872789 * @param   fNewProt            The new protection.
    27882790 */
    2789 static NTSTATUS supR3HardenedWinProtectMemory(PVOID pvMem, SIZE_T cbMem, ULONG fNewProt)
     2791static NTSTATUS supR3HardenedWinProtectMemory(PVOID pvMem, SIZE_T cbMem, ULONG fNewProt) RT_NOTHROW_DEF
    27902792{
    27912793    ULONG fOldProt = 0;
     
    27972799 * Installs or reinstalls the NTDLL patches.
    27982800 */
    2799 static void supR3HardenedWinReInstallHooks(bool fFirstCall)
     2801static void supR3HardenedWinReInstallHooks(bool fFirstCall) RT_NOTHROW_DEF
    28002802{
    28012803    struct
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