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

Unified Diff: util/win/process_info.cc

Issue 1405323003: win: Add and use GET_FUNCTION() and GET_FUNCTION_REQUIRED() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 2 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/win/nt_internals.cc ('k') | util/win/process_info_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/win/process_info.cc
diff --git a/util/win/process_info.cc b/util/win/process_info.cc
index ee5668b44ada059f95e99a9ab585ab69dbfdca64..7f3ff286c1dd0e6cf4c209407707b563a5327076 100644
--- a/util/win/process_info.cc
+++ b/util/win/process_info.cc
@@ -25,6 +25,7 @@
#include "base/template_util.h"
#include "build/build_config.h"
#include "util/numeric/safe_assignment.h"
+#include "util/win/get_function.h"
#include "util/win/nt_internals.h"
#include "util/win/ntstatus_logging.h"
#include "util/win/process_structs.h"
@@ -39,10 +40,8 @@ NTSTATUS NtQueryInformationProcess(HANDLE process_handle,
PVOID process_information,
ULONG process_information_length,
PULONG return_length) {
- static decltype(::NtQueryInformationProcess)* nt_query_information_process =
- reinterpret_cast<decltype(::NtQueryInformationProcess)*>(GetProcAddress(
- LoadLibrary(L"ntdll.dll"), "NtQueryInformationProcess"));
- DCHECK(nt_query_information_process);
+ static const auto nt_query_information_process =
+ GET_FUNCTION_REQUIRED(L"ntdll.dll", ::NtQueryInformationProcess);
return nt_query_information_process(process_handle,
process_information_class,
process_information,
@@ -51,9 +50,8 @@ NTSTATUS NtQueryInformationProcess(HANDLE process_handle,
}
bool IsProcessWow64(HANDLE process_handle) {
- static decltype(IsWow64Process)* is_wow64_process =
- reinterpret_cast<decltype(IsWow64Process)*>(
- GetProcAddress(LoadLibrary(L"kernel32.dll"), "IsWow64Process"));
+ static const auto is_wow64_process =
+ GET_FUNCTION(L"kernel32.dll", ::IsWow64Process);
if (!is_wow64_process)
return false;
BOOL is_wow64;
« no previous file with comments | « util/win/nt_internals.cc ('k') | util/win/process_info_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698