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

Unified Diff: base/win/win_util.cc

Issue 2722323002: Free mdm library after use. (Closed)
Patch Set: Make windows specific Created 3 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/win_util.cc
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index d380821c71889ee9d9f5287040395e1bd50fbff6..130d6499e48d60c41b9578e8191ca84e1993c13d 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -33,8 +33,10 @@
#include "base/base_switches.h"
#include "base/command_line.h"
+#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/scoped_native_library.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -499,8 +501,9 @@ bool IsEnrolledToDomain() {
bool IsDeviceRegisteredWithManagement() {
static bool is_device_registered_with_management = []() {
- HMODULE mdm_dll = ::LoadLibrary(L"MDMRegistration.dll");
- if (!mdm_dll)
+ ScopedNativeLibrary library(
+ FilePath(FILE_PATH_LITERAL("MDMRegistration.dll")));
+ if (!library.is_valid())
return false;
using IsDeviceRegisteredWithManagementFunction =
@@ -508,7 +511,7 @@ bool IsDeviceRegisteredWithManagement() {
IsDeviceRegisteredWithManagementFunction
is_device_registered_with_management_function =
reinterpret_cast<IsDeviceRegisteredWithManagementFunction>(
- ::GetProcAddress(mdm_dll, "IsDeviceRegisteredWithManagement"));
+ library.GetFunctionPointer("IsDeviceRegisteredWithManagement"));
if (!is_device_registered_with_management_function)
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698