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

Unified Diff: base/win/win_util.cc

Issue 2722323002: Free mdm library after use. (Closed)
Patch Set: Remove namespace 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..acf1d26429811a4f0f3c3028573a60b5173dc3f6 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::FromUTF8Unsafe(GetNativeLibraryName("MDMRegistration")));
grt (UTC plus 2) 2017/03/03 09:31:35 since this isn't cross-platform code, please simpl
Roger Tawa OOO till Jul 10th 2017/03/03 15:18:46 Done.
+ 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