Chromium Code Reviews| 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; |