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

Unified Diff: snapshot/win/pe_image_reader_test.cc

Issue 1336823002: win x86: Grab bag of restructuring to get tests working on x86-on-x86 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 3 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
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,

Powered by Google App Engine
This is Rietveld 408576698