• Victor Costan's avatar
    base: Add more diagnostics to COM hook injection. · 212dfda2
    Victor Costan authored
    On 32-bit Windows builds where DCHECK is enabled, ComInitCheckHook
    hot-patches CoCreateInstance() to DCHECK that it is called in
    appropriate circumstances. The hot-patching method can only be used once
    (details in base/win/com_init_check_hook.cc), and Chrome's usage may
    conflict with other drivers that may want to hot-patch the same method
    (example in https://crbug.com/737090).
    
    This CL adds answers to the following questions that may arise when
    investigating hot-patch failures.
    
    1) Is hot-patching failing due to a bug where the HookManager singleton
       is instantiated twice? This can happen if base is linked in twice.
       This question is answered by printing the bytes that would be written
       to the hot-patch area, so they can be compared with the current
       values.
    2) Is hot-patching failing due to a previous failure to revert the
       hot-patch? This question is answered by DCHECKing that reverting the
       hot-patch never fails. (The code previously just assumed that.)
    
    Bug: 877868
    Change-Id: I94f81b3816417447d31fc700c6b81d8325222d1a
    Reviewed-on: https://chromium-review.googlesource.com/1189143
    Commit-Queue: Victor Costan <pwnall@chromium.org>
    Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#586375}
    212dfda2
com_init_check_hook_unittest.cc 6.28 KB