Commit 897ea8c3 authored by Makoto Kato's avatar Makoto Kato
Browse files

Bug 1438955 - Remove ImmReleaseContext hook. r=masayuki

--HG--
extra : rebase_source : 78eeb24aa1b89c634cb9da089b43c01bdd390906
parent ba2ac04f
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ static HWND sWinlessPopupSurrogateHWND = nullptr;
static User32TrackPopupMenu sUser32TrackPopupMenuStub = nullptr;

typedef HIMC (WINAPI *Imm32ImmGetContext)(HWND hWND);
typedef BOOL (WINAPI *Imm32ImmReleaseContext)(HWND hWND, HIMC hIMC);
typedef LONG (WINAPI *Imm32ImmGetCompositionString)(HIMC hIMC,
                                                    DWORD dwIndex,
                                                    LPVOID lpBuf,
@@ -87,7 +86,6 @@ typedef BOOL (WINAPI *Imm32ImmNotifyIME)(HIMC hIMC, DWORD dwAction,
                                        DWORD dwIndex, DWORD dwValue);
static WindowsDllInterceptor sImm32Intercept;
static Imm32ImmGetContext sImm32ImmGetContextStub = nullptr;
static Imm32ImmReleaseContext sImm32ImmReleaseContextStub = nullptr;
static Imm32ImmGetCompositionString sImm32ImmGetCompositionStringStub = nullptr;
static Imm32ImmSetCandidateWindow sImm32ImmSetCandidateWindowStub = nullptr;
static Imm32ImmNotifyIME sImm32ImmNotifyIME = nullptr;
@@ -2035,17 +2033,6 @@ PluginInstanceChild::ImmGetContextProc(HWND aWND)
    return sHookIMC;
}

// static
BOOL
PluginInstanceChild::ImmReleaseContextProc(HWND aWND, HIMC aIMC)
{
    if (aIMC == sHookIMC) {
        return TRUE;
    }

    return sImm32ImmReleaseContextStub(aWND, aIMC);
}

// static
LONG
PluginInstanceChild::ImmGetCompositionStringProc(HIMC aIMC, DWORD aIndex,
@@ -2130,16 +2117,15 @@ PluginInstanceChild::InitImm32Hook()
    }

    // When using windowless plugin, IMM API won't work due ot OOP.
    //
    // ImmReleaseContext on Windows 7+ just returns TRUE only, so we don't
    // need to hook this.

    sImm32Intercept.Init("imm32.dll");
    sImm32Intercept.AddHook(
        "ImmGetContext",
        reinterpret_cast<intptr_t>(ImmGetContextProc),
        (void**)&sImm32ImmGetContextStub);
    sImm32Intercept.AddHook(
        "ImmReleaseContext",
        reinterpret_cast<intptr_t>(ImmReleaseContextProc),
        (void**)&sImm32ImmReleaseContextStub);
    sImm32Intercept.AddHook(
        "ImmGetCompositionStringW",
        reinterpret_cast<intptr_t>(ImmGetCompositionStringProc),
+0 −1
Original line number Diff line number Diff line
@@ -335,7 +335,6 @@ private:
#endif

    static HIMC WINAPI ImmGetContextProc(HWND aWND);
    static BOOL WINAPI ImmReleaseContextProc(HWND aWND, HIMC aIMC);
    static LONG WINAPI ImmGetCompositionStringProc(HIMC aIMC, DWORD aIndex,
                                                   LPVOID aBuf, DWORD aLen);
    static BOOL WINAPI ImmSetCandidateWindowProc(HIMC hIMC,
+0 −1
Original line number Diff line number Diff line
@@ -675,7 +675,6 @@ int main()
      TestDetour("user32.dll", "CreateWindowExW") &&
      TestHook(TestInSendMessageEx, "user32.dll", "InSendMessageEx") &&
      TestHook(TestImmGetContext, "imm32.dll", "ImmGetContext") &&
      // TestHook("imm32.dll", "ImmReleaseContext") &&    // see Bug 1316415
      TestHook(TestImmGetCompositionStringW, "imm32.dll", "ImmGetCompositionStringW") &&
      TestHook(TestImmSetCandidateWindow, "imm32.dll", "ImmSetCandidateWindow") &&
      TestHook(TestImmNotifyIME, "imm32.dll", "ImmNotifyIME") &&