Index: snapshot/win/pe_image_reader_test.cc |
diff --git a/snapshot/win/pe_image_reader_test.cc b/snapshot/win/pe_image_reader_test.cc |
index 8da329e47d7bf047df5cdb3ce104fd508e6dcea4..6c0733e035f05b2833275d6ca287f1b08f0df011 100644 |
--- a/snapshot/win/pe_image_reader_test.cc |
+++ b/snapshot/win/pe_image_reader_test.cc |
@@ -14,6 +14,7 @@ |
#include "snapshot/win/pe_image_reader.h" |
+#define PSAPI_VERSION 1 |
#include <psapi.h> |
#include "gtest/gtest.h" |
@@ -25,6 +26,17 @@ namespace crashpad { |
namespace test { |
namespace { |
+BOOL CrashpadGetModuleInformation(HANDLE process, |
scottmg
2015/09/15 21:13:34
This craziness is because XP -> 7+ did some weird
Mark Mentovai
2015/09/16 02:57:19
scottmg wrote:
scottmg
2015/09/16 18:05:06
As far as I can tell the K32... goop applies only
|
+ HMODULE module, |
+ MODULEINFO* module_info, |
+ DWORD cb) { |
+ static decltype(::GetModuleInformation)* get_module_information = |
Mark Mentovai
2015/09/16 02:57:19
Usually no :: in Crashpad, here and on the next li
scottmg
2015/09/16 18:05:06
Oops, I was playing with trying to call this funct
|
+ reinterpret_cast<decltype(::GetModuleInformation)*>( |
+ GetProcAddress(LoadLibrary(L"psapi.dll"), "GetModuleInformation")); |
+ DCHECK(get_module_information); |
+ return get_module_information(process, module, module_info, cb); |
+} |
+ |
TEST(PEImageReader, DebugDirectory) { |
PEImageReader pe_image_reader; |
ProcessReaderWin process_reader; |
@@ -32,7 +44,7 @@ TEST(PEImageReader, DebugDirectory) { |
ProcessSuspensionState::kRunning)); |
HMODULE self = reinterpret_cast<HMODULE>(&__ImageBase); |
MODULEINFO module_info; |
- ASSERT_TRUE(GetModuleInformation( |
+ ASSERT_TRUE(CrashpadGetModuleInformation( |
GetCurrentProcess(), self, &module_info, sizeof(module_info))); |
EXPECT_EQ(self, module_info.lpBaseOfDll); |
EXPECT_TRUE(pe_image_reader.Initialize(&process_reader, |