summaryrefslogtreecommitdiffstats
path: root/base/native_library_win.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 23:33:13 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 23:33:13 +0000
commit3e24622628f9b80010c3784b7ee615c25236fc7f (patch)
tree4da8b15c4e8e012abaa553be00849a968ae2dc8e /base/native_library_win.cc
parentf2ba4e66c27fe30a9575db9816458fb497bd6f29 (diff)
downloadchromium_src-3e24622628f9b80010c3784b7ee615c25236fc7f.zip
chromium_src-3e24622628f9b80010c3784b7ee615c25236fc7f.tar.gz
chromium_src-3e24622628f9b80010c3784b7ee615c25236fc7f.tar.bz2
Fixes a crash in the Windows media player plugin caused when the Real player recorder
plugin is installed on the machine. This plugin intercepts LoadLibrary calls issued by chrome.dll and wraps NPAPI calls provided the actual plugin dll, in this case media player. This is to provide the Download this video functionality. Crash occurs probably due to an interacton with Real player and media player. Fix is to load the plugin dynamically via the exported kernel32 function LoadLibrary instead of invoking it via the LoadLibrary import from chrome.dll. This would bypass the recorder plugin. Fixes bug http://code.google.com/p/chromium/issues/detail?id=63552 Bug=63552 Test=Install real player and media player on the machine and navigate to the url mentioned in the bug. It should not crash Review URL: http://codereview.chromium.org/5190005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66839 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/native_library_win.cc')
-rw-r--r--base/native_library_win.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/base/native_library_win.cc b/base/native_library_win.cc
index b498eba..b8a806b 100644
--- a/base/native_library_win.cc
+++ b/base/native_library_win.cc
@@ -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 @@ NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
}
}
- 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 @@ NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
}
// 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);
}