Changeset 52954 in vbox
- Timestamp:
- Oct 6, 2014 1:44:22 PM (10 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support/win
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h
r52947 r52954 56 56 DECLHIDDEN(int) supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind, 57 57 uint32_t *pcFixes, PRTERRINFO pErrInfo); 58 DECLHIDDEN(int) supHardNtVpThread(HANDLE hProcess, HANDLE hThread, PRTERRINFO pErrInfo); 59 DECLHIDDEN(int) supHardNtVpDebugger(HANDLE hProcess, PRTERRINFO pErrInfo); 60 58 61 59 62 DECLHIDDEN(bool) supHardViUtf16PathIsEqualEx(PCRTUTF16 pawcLeft, size_t cwcLeft, const char *pszRight); -
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp
r52947 r52954 1033 1033 * @param pErrInfo Pointer to error info structure. Optional. 1034 1034 */ 1035 static intsupHardNtVpThread(HANDLE hProcess, HANDLE hThread, PRTERRINFO pErrInfo)1035 DECLHIDDEN(int) supHardNtVpThread(HANDLE hProcess, HANDLE hThread, PRTERRINFO pErrInfo) 1036 1036 { 1037 1037 /* … … 1056 1056 1057 1057 1058 #ifndef VBOX_WITHOUT_DEBUGGER_CHECKS1059 1058 /** 1060 1059 * Verifies that there isn't a debugger attached to the process. … … 1064 1063 * @param pErrInfo Pointer to error info structure. Optional. 1065 1064 */ 1066 static int supHardNtVpDebugger(HANDLE hProcess, PRTERRINFO pErrInfo) 1067 { 1065 DECLHIDDEN(int) supHardNtVpDebugger(HANDLE hProcess, PRTERRINFO pErrInfo) 1066 { 1067 #ifndef VBOX_WITHOUT_DEBUGGER_CHECKS 1068 1068 /* 1069 1069 * Use the ProcessDebugPort request to check there is no debugger … … 1081 1081 return supHardNtVpSetInfo1(pErrInfo, VERR_SUP_VP_DEBUGGED, 1082 1082 "Debugger attached (%#zx)", uPtr); 1083 #endif /* !VBOX_WITHOUT_DEBUGGER_CHECKS */ 1083 1084 return VINF_SUCCESS; 1084 1085 } 1085 #endif /* !VBOX_WITHOUT_DEBUGGER_CHECKS */1086 1086 1087 1087 … … 2140 2140 if (enmKind != SUPHARDNTVPKIND_CHILD_PURIFICATION) 2141 2141 rc = supHardNtVpThread(hProcess, hThread, pErrInfo); 2142 #ifndef VBOX_WITHOUT_DEBUGGER_CHECKS2143 2142 if (RT_SUCCESS(rc)) 2144 2143 rc = supHardNtVpDebugger(hProcess, pErrInfo); 2145 #endif2146 2144 if (RT_SUCCESS(rc)) 2147 2145 { -
trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
r52953 r52954 2368 2368 2369 2369 /** 2370 * Checks if the calling thread is the only one in the process. 2371 * 2372 * @returns true if we're positive we're alone, false if not. 2373 */ 2374 static bool supR3HardenedWinAmIAlone(void) 2375 { 2376 ULONG fAmIAlone = 0; 2377 ULONG cbIgn = 0; 2378 NTSTATUS rcNt = NtQueryInformationThread(NtCurrentThread(), ThreadAmILastThread, &fAmIAlone, sizeof(fAmIAlone), &cbIgn); 2379 Assert(NT_SUCCESS(rcNt)); 2380 return NT_SUCCESS(rcNt) && fAmIAlone != 0; 2381 } 2382 2383 2384 /** 2370 2385 * Simplify NtProtectVirtualMemory interface. 2371 2386 * … … 2428 2443 */ 2429 2444 2430 #if 0 /* For testing purposes. */2431 2445 if (fAmIAlone == ~(ULONG)0) 2432 { 2433 ULONG cbIgn = 0; 2434 NTSTATUS rcNt = NtQueryInformationThread(NtCurrentThread(), ThreadAmILastThread, 2435 &fAmIAlone, sizeof(fAmIAlone), &cbIgn); 2436 fAmIAlone = NT_SUCCESS(rcNt) && fAmIAlone != 0; 2437 } 2438 #else 2439 fAmIAlone = 0; 2440 #endif 2446 fAmIAlone = supR3HardenedWinAmIAlone(); 2441 2447 if (fAmIAlone) 2442 2448 memcpy(pbApi, s_aPatches[i].pabPatch, s_aPatches[i].cbPatch); … … 4626 4632 if (iWhich == 2) 4627 4633 supR3HardenedWinOpenStubDevice(); 4634 4635 /* 4636 * Make sure we're alone in the stub process before creating the VM process 4637 * and that there isn't any debuggers attached. 4638 */ 4639 if (iWhich == 2) 4640 { 4641 int rc = supHardNtVpDebugger(NtCurrentProcess(), RTErrInfoInitStatic(&g_ErrInfoStatic)); 4642 if (RT_SUCCESS(rc)) 4643 rc = supHardNtVpThread(NtCurrentProcess(), NtCurrentThread(), RTErrInfoInitStatic(&g_ErrInfoStatic)); 4644 if (RT_FAILURE(rc)) 4645 supR3HardenedFatalMsg("supR3HardenedWinReSpawn", kSupInitOp_Integrity, rc, "%s", g_ErrInfoStatic.szMsg); 4646 } 4647 4628 4648 4629 4649 /*
Note:
See TracChangeset
for help on using the changeset viewer.