Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: base/base_paths_win.cc

Issue 1852143002: win: Remove GetModuleFromAddress, deduplicate __ImageBase code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/debug/profiler.cc » ('j') | base/process/memory_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_win.cc
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc
index 58f925f7e1f69d06529a1f7489faea656ce7285b..7102f7487533e696240352f62380ed7b6029422f 100644
--- a/base/base_paths_win.cc
+++ b/base/base_paths_win.cc
@@ -10,12 +10,10 @@
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/win/current_module.h"
#include "base/win/scoped_co_mem.h"
#include "base/win/windows_version.h"
-// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
-extern "C" IMAGE_DOS_HEADER __ImageBase;
-
using base::FilePath;
namespace base {
@@ -39,8 +37,7 @@ bool PathProviderWin(int key, FilePath* 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
- HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase);
- if (GetModuleFileName(this_module, system_buffer, MAX_PATH) == 0)
+ if (GetModuleFileName(CURRENT_MODULE(), system_buffer, MAX_PATH) == 0)
return false;
cur = FilePath(system_buffer);
break;
« no previous file with comments | « no previous file | base/debug/profiler.cc » ('j') | base/process/memory_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698