Windowsの組み込みイベントビューアーでエラーを見たので、エラーについて知りました:
説明: 未処理の例外が発生したため、プロセスが終了しました。例外情報: System.MissingMethodException スタック: Injection.Main.DrawText_Hooked(...) で
easyhook を使用した ac# アプリケーションがあります。私のdllの重要なコード:
public void Run(RemoteHooking.IContext InContext, String InChannelName)
{
// Install system hook to detect calls to DrawTextExW that is made by the client and call the function DrawText_Hooked when ever this happens
try
{
DrawTextExHook = LocalHook.Create(LocalHook.GetProcAddress("user32.dll", "DrawTextExW"), new DDrawTextEx(DrawText_Hooked), this);
DrawTextExHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
}....
そして、フックされた関数を処理する私のデリゲートは次のとおりです。
int DrawText_Hooked(...)
{
Interface.Read(hdc, lpString, cchText, dwDTFormat);
return DrawTextExW(hdc, lpString, cchText, ref lprc, dwDTFormat, ref dparams);
}
メイン アプリケーションをシャットダウンすると、次を使用Interface.Read(...)
しない限りすべて正常に動作します。この場合、フックされたアプリケーションがクラッシュします。Interface.Read(...)
アプリを終了すると、おそらくもう存在しないためだと読みましたが、dllにそれを停止するか、単にアンロードして実行しようとせず、検出しないように指示する方法がわかりInterface.Read(...)
ません'実際にはもう存在しません。どうすればいいですか?