diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-19 09:26:57 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-19 09:26:57 +0000 |
commit | 5d99d63b5d185d490531517570e0b0a27ca9dfa0 (patch) | |
tree | 0c8fb2ee51ce9338ca967f32b984e2f040ee9980 /base | |
parent | 9f25130b2cf85b8eae02576967201ac0cbe14846 (diff) | |
download | chromium_src-5d99d63b5d185d490531517570e0b0a27ca9dfa0.zip chromium_src-5d99d63b5d185d490531517570e0b0a27ca9dfa0.tar.gz chromium_src-5d99d63b5d185d490531517570e0b0a27ca9dfa0.tar.bz2 |
Use __ImageBase linker variable instead of VirtualQuery on a global variable.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base_paths_win.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc index 38d30d7..63a6d6e 100644 --- a/base/base_paths_win.cc +++ b/base/base_paths_win.cc @@ -29,14 +29,15 @@ #include "base/base_paths_win.h" +#include <windows.h> #include <shlobj.h> #include "base/file_util.h" #include "base/path_service.h" #include "base/win_util.h" -// This is here for the sole purpose of looking up the corresponding HMODULE. -static int handle_lookup = 0; +// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx +extern "C" IMAGE_DOS_HEADER __ImageBase; namespace base { @@ -59,11 +60,7 @@ bool PathProviderWin(int key, std::wstring* result) { case base::FILE_MODULE: { // the resource containing module is assumed to be the one that // this code lives in, whether that's a dll or exe - MEMORY_BASIC_INFORMATION info = { 0 }; - VirtualQuery(reinterpret_cast<void*>(&handle_lookup), - &info, sizeof(info)); - // Module handles are just the allocation base address of the module. - HMODULE this_module = reinterpret_cast<HMODULE>(info.AllocationBase); + HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); GetModuleFileName(this_module, system_buffer, MAX_PATH); cur = system_buffer; break; |