OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/native_library.h" | 5 #include "base/native_library.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return module; | 48 return module; |
49 } | 49 } |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 std::string NativeLibraryLoadError::ToString() const { | 53 std::string NativeLibraryLoadError::ToString() const { |
54 return StringPrintf("%u", code); | 54 return StringPrintf("%u", code); |
55 } | 55 } |
56 | 56 |
57 // static | 57 // static |
58 NativeLibrary LoadNativeLibrary(const FilePath& library_path, | 58 NativeLibrary LoadNativeLibraryWithOptions(const FilePath& library_path, |
59 NativeLibraryLoadError* error) { | 59 const NativeLibraryOptions& options, |
| 60 NativeLibraryLoadError* error) { |
60 return LoadNativeLibraryHelper(library_path, LoadLibraryW, error); | 61 return LoadNativeLibraryHelper(library_path, LoadLibraryW, error); |
61 } | 62 } |
62 | 63 |
63 NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path) { | 64 NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path) { |
64 typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name); | 65 typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name); |
65 | 66 |
66 LoadLibraryFunction load_library = reinterpret_cast<LoadLibraryFunction>( | 67 LoadLibraryFunction load_library = reinterpret_cast<LoadLibraryFunction>( |
67 GetProcAddress(GetModuleHandle(L"kernel32.dll"), "LoadLibraryW")); | 68 GetProcAddress(GetModuleHandle(L"kernel32.dll"), "LoadLibraryW")); |
68 | 69 |
69 return LoadNativeLibraryHelper(library_path, load_library, NULL); | 70 return LoadNativeLibraryHelper(library_path, load_library, NULL); |
(...skipping 10 matching lines...) Expand all Loading... |
80 return GetProcAddress(library, name.data()); | 81 return GetProcAddress(library, name.data()); |
81 } | 82 } |
82 | 83 |
83 // static | 84 // static |
84 std::string GetNativeLibraryName(StringPiece name) { | 85 std::string GetNativeLibraryName(StringPiece name) { |
85 DCHECK(IsStringASCII(name)); | 86 DCHECK(IsStringASCII(name)); |
86 return name.as_string() + ".dll"; | 87 return name.as_string() + ".dll"; |
87 } | 88 } |
88 | 89 |
89 } // namespace base | 90 } // namespace base |
OLD | NEW |