[EasyHook-Tutorialsのサンプル](https://github.com/EasyHook/EasyHook-
Tutorials/tree/master/Managed/RemoteFileMonitor)を変更して、exttextoutwをフックするようにプログラムを書きました。しかし、notepad.exeで実行してもhookのメッセージが表示されません。

なにが悪いのでしょうか？

変更したコードは下記のとおりです。  
FileMonitorHook以外は変更しておりません。

```

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace FileMonitorHook
    {
        public class InjectionEntryPoint: EasyHook.IEntryPoint
        {
            ServerInterface _server = null;
            Queue<string> _messageQueue = new Queue<string>();
    
            [StructLayout(LayoutKind.Sequential)]
            public struct RECT
            {
                public long left;
                public long top;
                public long right;
                public long bottom;
            }
    
            public InjectionEntryPoint(
                EasyHook.RemoteHooking.IContext context,
                string channelName)
            {
                _server = EasyHook.RemoteHooking.IpcConnectClient<ServerInterface>(channelName);
                _server.Ping();
            }
    
            public void Run(
                EasyHook.RemoteHooking.IContext context,
                string channelName)
            {
                _server.IsInstalled(EasyHook.RemoteHooking.GetCurrentProcessId());
    
                var ExtTextOutHook = EasyHook.LocalHook.Create(
                    EasyHook.LocalHook.GetProcAddress("Gdi32.dll", "ExtTextOutW"),
                    new ExtTextOut_Delegate(ExtTextOut_Hook),
                    this);
    
                _server.ReportMessage("ExtTextOut hook installed");
    
                EasyHook.RemoteHooking.WakeUpProcess();
    
                try
                {
                    // Loop until FileMonitor closes (i.e. IPC fails)
                    while (true)
                    {
                        System.Threading.Thread.Sleep(500);
                        string[] queued = null;
                        lock (_messageQueue)
                        {
                            queued = _messageQueue.ToArray();
                            _messageQueue.Clear();
                        }
                        if (queued != null && queued.Length > 0)
                        {
                            _server.ReportMessages(queued);
                        }
                        else
                        {
                            _server.Ping();
                        }
                    }
                }
                catch
                {
                }
    
                ExtTextOutHook.Dispose();
                EasyHook.LocalHook.Release();
            }
    
            #region ExtTextOutW Hook
    
            [UnmanagedFunctionPointer(CallingConvention.StdCall,
                        CharSet = CharSet.Unicode,
                        SetLastError = true)]
            delegate bool ExtTextOut_Delegate(
                IntPtr hdc,
                int x,
                int y,
                uint fuOptions,
                [In] ref RECT lprc,
                string lpString,
                uint cbCount,
                [In] IntPtr lpDx);
    
            [DllImport("Gdi32.dll",
                CharSet = CharSet.Unicode,
                SetLastError = true, CallingConvention = CallingConvention.StdCall)]
            static extern bool ExtTextOutW(
                IntPtr hdc,
                int x,
                int y,
                uint fuOptions,
                [In] ref RECT lprc,
                string lpString,
                uint cbCount,
                [In] IntPtr lpDx);
    
            bool ExtTextOut_Hook(
                IntPtr hdc,
                int x,
                int y,
                uint fuOptions,
                [In] ref RECT lprc,
                string lpString,
                uint cbCount,
                [In] IntPtr lpDx)
            {
                try
                {
                    lock (this._messageQueue)
                    {
                        this._messageQueue.Enqueue("ExtTextOut_Hook called");
                    }
                }
                catch
                {
                }
    
                return ExtTextOutW(
                    hdc,
                    x,
                    y,
                    fuOptions,
                    ref lprc,
                    lpString,
                    cbCount,
                    lpDx);
            }
    
            #endregion
        }
    }
    
```
CC BY-SA 3.0
2017-02-07T15:34:33.147
32468
2017-06-26T09:36:56.190
2298
question
c# windows
easyhookでexttextoutwをフックしたい
手元のWindows 10ではnotepad.exeは`ExtTextOutW`を使っておらず`TextOutW`を使っているようです。

```

    C:\Program Files (x86)\Microsoft Visual Studio 14.0>dumpbin /imports:gdi32.dll c:\windows\notepad.exe
    Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    
    Dump of file c:\windows\notepad.exe
    
    File Type: EXECUTABLE IMAGE
    
      Section contains the following imports:
    
        GDI32.dll
                 14001A708 Import Address Table
                 14001F640 Import Name Table
                         0 time date stamp
                         0 Index of first forwarder reference
    
                             2C1 GetTextFaceW
                              3D CreateDCW
                             5E3 StartPage
                             5E0 StartDocW
                             59E SetAbortProc
                             156 DeleteDC
                             168 EndDoc
                               0 AbortDoc
                             16C EndPage
                             2C4 GetTextMetricsW
                             5A5 SetBkMode
                             2D7 LPtoDP
                             5DB SetWindowExtEx
                             5D7 SetViewportExtEx
                             5BC SetMapMode
                             2BA GetTextExtentPoint32W
                             5EE TextOutW
                             1A5 EnumFontsW
                             59B SelectObject
                             15A DeleteObject
                              4D CreateFontIndirectW
                             25D GetDeviceCaps
    
      Summary
    
            3000 .data
            1000 .pdata
            8000 .rdata
            1000 .reloc
           1A000 .rsrc
           19000 .text
    
```
CC BY-SA 3.0
2017-02-08T00:38:45.557
32477
2017-02-08T00:38:45.557
4236
32468
answer