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

Unified Diff: util/win/process_info_test.cc

Issue 1139103003: win: Fix module timestamp test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 7 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 | « util/util_test.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/win/process_info_test.cc
diff --git a/util/win/process_info_test.cc b/util/win/process_info_test.cc
index 792b3f3e0238aa1378e24f956adf6024bbf0b9ac..3bc18c723831c4e4c17cfcb7bd36b60095007ad9 100644
--- a/util/win/process_info_test.cc
+++ b/util/win/process_info_test.cc
@@ -14,6 +14,7 @@
#include "util/win/process_info.h"
+#include <imagehlp.h>
#include <rpc.h>
#include <wchar.h>
@@ -32,15 +33,12 @@ namespace {
const wchar_t kNtdllName[] = L"\\ntdll.dll";
time_t GetTimestampForModule(HMODULE module) {
- wchar_t filename[MAX_PATH];
- if (!GetModuleFileName(module, filename, arraysize(filename)))
+ char filename[MAX_PATH];
+ // `char` and GetModuleFileNameA because ImageLoad is ANSI only.
+ if (!GetModuleFileNameA(module, filename, arraysize(filename)))
return 0;
- struct _stat stat_buf;
- int rv = _wstat(filename, &stat_buf);
- EXPECT_EQ(0, rv);
- if (rv != 0)
- return 0;
- return stat_buf.st_mtime;
+ LOADED_IMAGE* loaded_image = ImageLoad(filename, nullptr);
+ return loaded_image->FileHeader->FileHeader.TimeDateStamp;
}
TEST(ProcessInfo, Self) {
« no previous file with comments | « util/util_test.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698