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

Unified Diff: base/native_library_win.cc

Issue 5190005: Fixes a crash in the Windows media player plugin caused when the Real player ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « base/native_library.h ('k') | webkit/glue/plugins/plugin_lib.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/native_library_win.cc
===================================================================
--- base/native_library_win.cc (revision 66680)
+++ base/native_library_win.cc (working copy)
@@ -12,8 +12,10 @@
namespace base {
-// static
-NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
+typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name);
+
+NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
+ LoadLibraryFunction load_library_api) {
// LoadLibrary() opens the file off disk.
base::ThreadRestrictions::AssertIOAllowed();
@@ -29,7 +31,7 @@
}
}
- HMODULE module = LoadLibrary(library_path.value().c_str());
+ HMODULE module = (*load_library_api)(library_path.value().c_str());
if (restore_directory)
file_util::SetCurrentDirectory(current_directory);
@@ -37,6 +39,21 @@
}
// static
+NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
+ return LoadNativeLibraryHelper(library_path, LoadLibraryW);
+}
+
+NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path) {
+ typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name);
+
+ LoadLibraryFunction load_library;
+ load_library = reinterpret_cast<LoadLibraryFunction>(
+ GetProcAddress(GetModuleHandle(L"kernel32.dll"), "LoadLibraryW"));
+
+ return LoadNativeLibraryHelper(library_path, load_library);
+}
+
+// static
void UnloadNativeLibrary(NativeLibrary library) {
FreeLibrary(library);
}
« no previous file with comments | « base/native_library.h ('k') | webkit/glue/plugins/plugin_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698