diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 03:18:31 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 03:18:31 +0000 |
commit | fcf0272855583c84d6695865e12c7006e2c40467 (patch) | |
tree | 85d92b260c7435b1de197b8048413bfcc34974a7 /base/win_util.cc | |
parent | 5d15ca3b908891e9a9d514448510651484c1c207 (diff) | |
download | chromium_src-fcf0272855583c84d6695865e12c7006e2c40467.zip chromium_src-fcf0272855583c84d6695865e12c7006e2c40467.tar.gz chromium_src-fcf0272855583c84d6695865e12c7006e2c40467.tar.bz2 |
An experimental fix for Issue 11046.
This change replaces some ImmAssociateContextEx() calls with a LoadLibrary() call and a GetProcAddress() call to prevent Chrome from loading "imm32.dll" on a PC which doesn't have valid "imm32.dll" installed. (Since I have not been able to reproduce this issue on my XP box, this is just a blind fix.)
BUG=11046 "repeated crash on launch"
Review URL: http://codereview.chromium.org/113096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win_util.cc')
-rw-r--r-- | base/win_util.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/base/win_util.cc b/base/win_util.cc index 2f1ceb9..b71ac30 100644 --- a/base/win_util.cc +++ b/base/win_util.cc @@ -436,6 +436,26 @@ void NotifyHWNDDestruction(const tracked_objects::Location& from_here, from_here)); } +bool IMEAttach(HWND window, bool attach) { + // To prevent a crash when calling ImmAssociateContextEx() function on a PC + // which has a valid "imm32.dll" installed, we manually load "imm32.dll" and + // call its "ImmAssociateContextEx() function. + bool result = false; + HMODULE imm32_module = LoadLibrary(L"imm32.dll"); + if (imm32_module) { + typedef BOOL (WINAPI* Imm32_ImmAssociateContextEx)(HWND, HIMC, DWORD); + Imm32_ImmAssociateContextEx imm_associate_context_ex = + reinterpret_cast<Imm32_ImmAssociateContextEx>( + GetProcAddress(imm32_module, "ImmAssociateContextEx")); + if (imm_associate_context_ex) { + result = !!imm_associate_context_ex(window, NULL, + attach ? IACE_DEFAULT : 0); + } + FreeLibrary(imm32_module); + } + return result; +} + } // namespace win_util #ifdef _MSC_VER |