Bug 1460022: Part 6 - Update GMP code to work with new DLL interceptor interface; r=cpearce
authorAaron Klotz <aklotz@mozilla.com>
Wed, 27 Jun 2018 11:49:49 -0600
changeset 424936 137f27a03ba3b56b87a698adc34cbcf4b2def52f
parent 424935 388defa609728a5bcacd0bb48f461f5fca783e0e
child 424937 88494d07fbcd14ced0c83f00c12b4bae5d566b48
push id104944
push useraklotz@mozilla.com
push dateWed, 04 Jul 2018 02:23:52 +0000
treeherdermozilla-inbound@ff25e66da36e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1460022
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1460022: Part 6 - Update GMP code to work with new DLL interceptor interface; r=cpearce
dom/media/gmp/ChromiumCDMAdapter.cpp
--- a/dom/media/gmp/ChromiumCDMAdapter.cpp
+++ b/dom/media/gmp/ChromiumCDMAdapter.cpp
@@ -192,17 +192,18 @@ ChromiumCDMAdapter::Supports(int32_t aMo
 #ifdef XP_WIN
 
 static WindowsDllInterceptor sKernel32Intercept;
 
 typedef DWORD(WINAPI* QueryDosDeviceWFnPtr)(_In_opt_ LPCWSTR lpDeviceName,
                                             _Out_ LPWSTR lpTargetPath,
                                             _In_ DWORD ucchMax);
 
-static QueryDosDeviceWFnPtr sOriginalQueryDosDeviceWFnPtr = nullptr;
+static WindowsDllInterceptor::FuncHookType<QueryDosDeviceWFnPtr>
+  sOriginalQueryDosDeviceWFnPtr;
 
 static std::unordered_map<std::wstring, std::wstring>* sDeviceNames = nullptr;
 
 DWORD WINAPI
 QueryDosDeviceWHook(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
 {
   if (!sDeviceNames) {
     return 0;
@@ -271,19 +272,18 @@ InitializeHooks()
   }
   initialized = true;
   sDeviceNames = new std::unordered_map<std::wstring, std::wstring>();
   for (const std::wstring& name : GetDosDeviceNames()) {
     sDeviceNames->emplace(name, GetDeviceMapping(name));
   }
 
   sKernel32Intercept.Init("kernelbase.dll");
-  sKernel32Intercept.AddHook("QueryDosDeviceW",
-                             reinterpret_cast<intptr_t>(QueryDosDeviceWHook),
-                             (void**)(&sOriginalQueryDosDeviceWFnPtr));
+  sOriginalQueryDosDeviceWFnPtr.Set(sKernel32Intercept, "QueryDosDeviceW",
+                                    &QueryDosDeviceWHook);
 }
 #endif
 
 HostFile::HostFile(HostFile&& aOther)
   : mPath(aOther.mPath)
   , mFile(aOther.TakePlatformFile())
 {
 }