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

Side by Side Diff: base/native_library_win.cc

Issue 2277863002: Enable loading native libraries with RTLD_DEEPBIND (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « base/native_library_unittest.cc ('k') | base/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/native_library_unittest.cc ('k') | base/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698