From 5418f47e35f5a6c1b6a3248a4927cb2fa4b5aee1 Mon Sep 17 00:00:00 2001 From: "deanm@chromium.org" Date: Thu, 26 Feb 2009 15:21:50 +0000 Subject: Try a new approach to fixing IAT unpatch crashes when the DLL is gone. Have the IAT patcher take some "ownership" of the DLL, by taking a library name and then calling LoadLibrary() / FreeLibrary() to manage the reference count. This means as long is there isn't some other reference count balancing bug happening in the process, the DLL will never be unloaded while we are patched. This effectively reverts r9929, the VirtualQuery additional checks are removed. BUG=7701 Review URL: http://codereview.chromium.org/21453 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10467 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/plugins/webplugin_delegate_impl.cc | 9 +++------ webkit/glue/plugins/webplugin_delegate_impl.h | 3 --- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'webkit/glue/plugins') diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 4163b50..564659d 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -155,8 +155,7 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( handle_event_depth_(0), user_gesture_message_posted_(false), #pragma warning(suppress: 4355) // can use this - user_gesture_msg_factory_(this), - plugin_module_handle_(NULL) { + user_gesture_msg_factory_(this) { memset(&window_, 0, sizeof(window_)); const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); @@ -201,8 +200,6 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( quirks_ |= PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU; quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; } - - plugin_module_handle_ = ::GetModuleHandle(plugin_info.path.value().c_str()); } WebPluginDelegateImpl::~WebPluginDelegateImpl() { @@ -283,7 +280,7 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, if (windowless_ && !g_iat_patch_track_popup_menu.Pointer()->is_patched() && (quirks_ & PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU)) { g_iat_patch_track_popup_menu.Pointer()->Patch( - plugin_module_handle_, "user32.dll", "TrackPopupMenu", + GetPluginPath().value().c_str(), "user32.dll", "TrackPopupMenu", WebPluginDelegateImpl::TrackPopupMenuPatch); } @@ -296,7 +293,7 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, if (windowless_ && !g_iat_patch_set_cursor.Pointer()->is_patched() && (quirks_ & PLUGIN_QUIRK_PATCH_SETCURSOR)) { g_iat_patch_set_cursor.Pointer()->Patch( - plugin_module_handle_, "user32.dll", "SetCursor", + GetPluginPath().value().c_str(), "user32.dll", "SetCursor", WebPluginDelegateImpl::SetCursorPatch); } return true; diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 0474d26..27e17cf 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -247,9 +247,6 @@ class WebPluginDelegateImpl : public WebPluginDelegate { #endif #if defined(OS_WIN) - // The plugin module handle. - HMODULE plugin_module_handle_; - // TrackPopupMenu interceptor. Parameters are the same as the Win32 function // TrackPopupMenu. static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, -- cgit v1.1