From eef875bd6b5c99f82a27a4b5d040b8bd5dadadb0 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 18 Dec 2015 11:15:10 -0500 Subject: [PATCH] Backout 62dab36901e2 and 9b4445c0f202 (bug 1232458) for Windows bustage; r=me --- mozglue/build/WindowsDllBlocklist.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mozglue/build/WindowsDllBlocklist.cpp b/mozglue/build/WindowsDllBlocklist.cpp index 7e0b61775b1..de47976cc9f 100644 --- a/mozglue/build/WindowsDllBlocklist.cpp +++ b/mozglue/build/WindowsDllBlocklist.cpp @@ -16,7 +16,6 @@ #include "nsAutoPtr.h" #include "nsWindowsDllInterceptor.h" -#include "mozilla/UniquePtrExtensions.h" #include "mozilla/WindowsVersion.h" #include "nsWindowsHelpers.h" @@ -479,8 +478,8 @@ DllBlockSet::Write(HANDLE file) ::LeaveCriticalSection(&sLock); } -static UniquePtr -getFullPath (PWCHAR filePath, wchar_t* fname) +static +wchar_t* getFullPath (PWCHAR filePath, wchar_t* fname) { // In Windows 8, the first parameter seems to be used for more than just the // path name. For example, its numerical value can be 1. Passing a non-valid @@ -495,14 +494,14 @@ getFullPath (PWCHAR filePath, wchar_t* fname) return nullptr; } - auto full_fname = MakeUniqueFallible(pathlen+1); + wchar_t* full_fname = new wchar_t[pathlen+1]; if (!full_fname) { // couldn't allocate memory? return nullptr; } // now actually grab it - SearchPathW(sanitizedFilePath, fname, L".dll", pathlen + 1, full_fname.get(), + SearchPathW(sanitizedFilePath, fname, L".dll", pathlen + 1, full_fname, nullptr); return full_fname; } @@ -530,7 +529,7 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam int len = moduleFileName->Length / 2; wchar_t *fname = moduleFileName->Buffer; - UniquePtr full_fname; + nsAutoArrayPtr full_fname; // The filename isn't guaranteed to be null terminated, but in practice // it always will be; ensure that this is so, and bail if not. @@ -653,23 +652,23 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam } if (info->flags & DllBlockInfo::USE_TIMESTAMP) { - fVersion = GetTimestamp(full_fname.get()); + fVersion = GetTimestamp(full_fname); if (fVersion > info->maxVersion) { load_ok = true; } } else { DWORD zero; - DWORD infoSize = GetFileVersionInfoSizeW(full_fname.get(), &zero); + DWORD infoSize = GetFileVersionInfoSizeW(full_fname, &zero); // If we failed to get the version information, we block. if (infoSize != 0) { - auto infoData = MakeUnique(infoSize); + nsAutoArrayPtr infoData(new unsigned char[infoSize]); VS_FIXEDFILEINFO *vInfo; UINT vInfoLen; - if (GetFileVersionInfoW(full_fname.get(), 0, infoSize, infoData.get()) && - VerQueryValueW(infoData.get(), L"\\", (LPVOID*) &vInfo, &vInfoLen)) + if (GetFileVersionInfoW(full_fname, 0, infoSize, infoData) && + VerQueryValueW(infoData, L"\\", (LPVOID*) &vInfo, &vInfoLen)) { fVersion = ((unsigned long long)vInfo->dwFileVersionMS) << 32 | @@ -705,7 +704,7 @@ continue_loading: return STATUS_DLL_NOT_FOUND; } - if (IsVistaOrLater() && !CheckASLR(full_fname.get())) { + if (IsVistaOrLater() && !CheckASLR(full_fname)) { printf_stderr("LdrLoadDll: Blocking load of '%s'. XPCOM components must support ASLR.\n", dllName); return STATUS_DLL_NOT_FOUND; }