Changeset 53051 in vbox
- Timestamp:
- Oct 13, 2014 7:46:51 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96546
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
r53045 r53051 1724 1724 supR3HardenedMonitor_LdrLoadDll(PWSTR pwszSearchPath, PULONG pfFlags, PUNICODE_STRING pName, PHANDLE phMod) 1725 1725 { 1726 DWORD dwSavedLastError = RtlGetLastWin32Error();1727 bool fQuiet = false;1728 NTSTATUS rcNt;1726 DWORD dwSavedLastError = RtlGetLastWin32Error(); 1727 PUNICODE_STRING const pOrgName = pName; 1728 NTSTATUS rcNt; 1729 1729 1730 1730 /* … … 1771 1771 * Absolute path? 1772 1772 */ 1773 NTSTATUS rcNtResolve = STATUS_SUCCESS; 1773 1774 bool fSkipValidation = false; 1774 1775 WCHAR wszPath[260]; … … 1787 1788 ) 1788 1789 { 1789 rcNt = RtlDosApplyFileIsolationRedirection_Ustr(1 /*fFlags*/,1790 pName,1791 (PUNICODE_STRING)&s_DefaultSuffix,1792 &UniStrStatic,1793 &UniStrDynamic,1794 &pUniStrResult,1795 NULL /*pNewFlags*/,1796 NULL /*pcbFilename*/,1797 NULL /*pcbNeeded*/);1798 if (NT_SUCCESS(rcNt ))1790 rcNtResolve = RtlDosApplyFileIsolationRedirection_Ustr(1 /*fFlags*/, 1791 pName, 1792 (PUNICODE_STRING)&s_DefaultSuffix, 1793 &UniStrStatic, 1794 &UniStrDynamic, 1795 &pUniStrResult, 1796 NULL /*pNewFlags*/, 1797 NULL /*pcbFilename*/, 1798 NULL /*pcbNeeded*/); 1799 if (NT_SUCCESS(rcNtResolve)) 1799 1800 { 1800 1801 UINT cwc; … … 1883 1884 */ 1884 1885 UINT cwc; 1885 rcNt = RtlDosApplyFileIsolationRedirection_Ustr(1 /*fFlags*/,1886 pName,1887 (PUNICODE_STRING)&s_DefaultSuffix,1888 &UniStrStatic,1889 &UniStrDynamic,1890 &pUniStrResult,1891 NULL /*pNewFlags*/,1892 NULL /*pcbFilename*/,1893 NULL /*pcbNeeded*/);1894 if (NT_SUCCESS(rcNt ))1886 rcNtResolve = RtlDosApplyFileIsolationRedirection_Ustr(1 /*fFlags*/, 1887 pName, 1888 (PUNICODE_STRING)&s_DefaultSuffix, 1889 &UniStrStatic, 1890 &UniStrDynamic, 1891 &pUniStrResult, 1892 NULL /*pNewFlags*/, 1893 NULL /*pcbFilename*/, 1894 NULL /*pcbNeeded*/); 1895 if (NT_SUCCESS(rcNtResolve)) 1895 1896 { 1896 1897 rcNt = supR3HardenedCopyRedirectionResult(wszPath, RT_ELEMENTS(wszPath), pUniStrResult, pName, &cwc); … … 1935 1936 ResolvedName.Length = (USHORT)(cwc * sizeof(WCHAR)); 1936 1937 ResolvedName.MaximumLength = ResolvedName.Length + sizeof(WCHAR); 1937 1938 /** @todo need to cache the translation so we can get at fQuiet here! */1939 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: '%.*ls' -> '%.*ls' [rcNt=%#x]\n",1940 (unsigned)pName->Length / sizeof(WCHAR), pName->Buffer,1941 ResolvedName.Length / sizeof(WCHAR), ResolvedName.Buffer, rcNt));1942 1938 pName = &ResolvedName; 1943 1939 } 1944 1940 1941 bool fQuiet = false; 1945 1942 if (!fSkipValidation) 1946 1943 { … … 1992 1989 if (!fQuiet) 1993 1990 { 1994 supR3HardenedError(VINF_SUCCESS, false, "supR3HardenedMonitor_LdrLoadDll: rejecting '%ls': rcNt=%#x\n", 1995 wszPath, rcNt); 1991 if (pOrgName != pName) 1992 supR3HardenedError(VINF_SUCCESS, false, "supR3HardenedMonitor_LdrLoadDll: rejecting '%ls': rcNt=%#x\n", 1993 wszPath, rcNt); 1994 else 1995 supR3HardenedError(VINF_SUCCESS, false, "supR3HardenedMonitor_LdrLoadDll: rejecting '%ls' (%.*ls): rcNt=%#x\n", 1996 wszPath, pOrgName->Length / sizeof(WCHAR), pOrgName->Buffer, rcNt); 1996 1997 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: returns rcNt=%#x '%ls'\n", rcNt, wszPath)); 1997 1998 } … … 2005 2006 { 2006 2007 DWORD dwErr = RtlGetLastWin32Error(); 2007 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: error opening '%ls': %u (NtPath=%.*ls)\n", 2008 wszPath, dwErr, NtPathUniStr.Length / sizeof(RTUTF16), NtPathUniStr.Buffer)); 2008 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: error opening '%ls': %u (NtPath=%.*ls; Input=%.*ls)\n", 2009 wszPath, dwErr, NtPathUniStr.Length / sizeof(RTUTF16), NtPathUniStr.Buffer, 2010 pOrgName->Length / sizeof(WCHAR), pOrgName->Buffer)); 2009 2011 } 2010 2012 RTNtPathFree(&NtPathUniStr, &hRootDir); … … 2015 2017 */ 2016 2018 if (!fQuiet) 2017 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: pName=%.*ls *pfFlags=%#x pwszSearchPath=%p:%ls [calling]\n", 2018 (unsigned)pName->Length / sizeof(WCHAR), pName->Buffer, pfFlags ? *pfFlags : UINT32_MAX, pwszSearchPath, 2019 !((uintptr_t)pwszSearchPath & 1) && (uintptr_t)pwszSearchPath >= 0x2000U ? pwszSearchPath : L"<flags>")); 2019 { 2020 if (pOrgName != pName) 2021 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: pName=%.*ls (Input=%.*ls, rcNtResolve=%#x) *pfFlags=%#x pwszSearchPath=%p:%ls [calling]\n", 2022 (unsigned)pName->Length / sizeof(WCHAR), pName->Buffer, 2023 (unsigned)pOrgName->Length / sizeof(WCHAR), pOrgName->Buffer, rcNtResolve, 2024 pfFlags ? *pfFlags : UINT32_MAX, pwszSearchPath, 2025 !((uintptr_t)pwszSearchPath & 1) && (uintptr_t)pwszSearchPath >= 0x2000U ? pwszSearchPath : L"<flags>")); 2026 else 2027 SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: pName=%.*ls (rcNtResolve=%#x) *pfFlags=%#x pwszSearchPath=%p:%ls [calling]\n", 2028 (unsigned)pName->Length / sizeof(WCHAR), pName->Buffer, rcNtResolve, 2029 pfFlags ? *pfFlags : UINT32_MAX, pwszSearchPath, 2030 !((uintptr_t)pwszSearchPath & 1) && (uintptr_t)pwszSearchPath >= 0x2000U ? pwszSearchPath : L"<flags>")); 2031 } 2032 2020 2033 RtlRestoreLastWin32Error(dwSavedLastError); 2021 2034 rcNt = g_pfnLdrLoadDllReal(pwszSearchPath, pfFlags, pName, phMod);
Note:
See TracChangeset
for help on using the changeset viewer.