summaryrefslogtreecommitdiffstats
path: root/chrome/app/delay_load_hook_win.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-28 18:38:06 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-28 18:38:06 +0000
commit5f952964e16ccdcc7bbad878356a50954e57c0f2 (patch)
treeca33d68f8020116d72c3cabe70cb0f1cc5f9a8e5 /chrome/app/delay_load_hook_win.cc
parentc71ea72e8b2b5419ec0d12981812f28297829219 (diff)
downloadchromium_src-5f952964e16ccdcc7bbad878356a50954e57c0f2.zip
chromium_src-5f952964e16ccdcc7bbad878356a50954e57c0f2.tar.gz
chromium_src-5f952964e16ccdcc7bbad878356a50954e57c0f2.tar.bz2
Revert 191173 "Check in a custom-built import library for user32..."
> Check in a custom-built import library for user32 exports up to Windows XP SP2/SP3, which is used by chrome.dll in preference to the Platform SDK's user32.lib import library. > Custom build an import library for Chrome's post-WinXP imports, that binds to a fictional "user32-delay.dll". > Implement and test a delay load hook that diverts dynamic loading of any dll "foo-delay.dll" to "foo.dll". > > R=cpu@chromium.org > BUG=176040 > > > Review URL: https://chromiumcodereview.appspot.com/12295040 TBR=siggi@chromium.org Review URL: https://codereview.chromium.org/13208002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/delay_load_hook_win.cc')
-rw-r--r--chrome/app/delay_load_hook_win.cc84
1 files changed, 0 insertions, 84 deletions
diff --git a/chrome/app/delay_load_hook_win.cc b/chrome/app/delay_load_hook_win.cc
deleted file mode 100644
index e911cc4..0000000
--- a/chrome/app/delay_load_hook_win.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/app/delay_load_hook_win.h"
-
-#if defined(_WIN32_WINNT_WIN8) && _MSC_VER < 1700
-// The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h, and in
-// delayimp.h previous to VS2012.
-#undef FACILITY_VISUALCPP
-#endif
-#include <DelayIMP.h>
-
-#include "base/logging.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
-
-// So long as these symbols are supplied to the final binary through an
-// object file (as opposed to indirectly through a library), these pointers
-// will override the CRT's symbols and direct the notifications to our hook.
-// Alternatively referencing the ChromeDelayLoadHook function somehow will
-// cause this declaration of these variables to take preference to the delay
-// load runtime's defaults (in delayimp.lib).
-PfnDliHook __pfnDliNotifyHook2 = ChromeDelayLoadHook;
-PfnDliHook __pfnDliFailureHook2 = ChromeDelayLoadHook;
-
-
-namespace {
-
-FARPROC OnPreLoadLibrary(DelayLoadInfo* info) {
- // If the DLL name ends with "-delay.dll", this call is about one of our
- // custom import libraries. In this case we need to snip the suffix off,
- // and bind to the real DLL.
- std::string dll_name(info->szDll);
- const char kDelaySuffix[] = "-delay.dll";
- if (EndsWith(dll_name, kDelaySuffix, false)) {
- // Trim the "-delay.dll" suffix from the string.
- dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1));
- dll_name.append(".dll");
-
- return reinterpret_cast<FARPROC>(::LoadLibraryA(dll_name.c_str()));
- }
-
- return NULL;
-}
-
-} // namespace
-
-// This function is a delay load notification hook. It is invoked by the
-// delay load support in the visual studio runtime.
-// See http://msdn.microsoft.com/en-us/library/z9h1h6ty(v=vs.100).aspx for
-// details.
-FARPROC WINAPI ChromeDelayLoadHook(unsigned reason, DelayLoadInfo* info) {
- switch (reason) {
- case dliNoteStartProcessing:
- case dliNoteEndProcessing:
- // Nothing to do here.
- break;
-
- case dliNotePreLoadLibrary:
- return OnPreLoadLibrary(info);
- break;
-
- case dliNotePreGetProcAddress:
- // Nothing to do here.
- break;
-
- case dliFailLoadLib:
- case dliFailGetProc:
- // Returning NULL from error notifications will cause the delay load
- // runtime to raise a VcppException structured exception, that some code
- // might want to handle.
- return NULL;
- break;
-
- default:
- NOTREACHED() << "Impossible delay load notification.";
- break;
- }
-
- // Returning NULL causes the delay load machinery to perform default
- // processing for this notification.
- return NULL;
-}