macote / Winook

Winook - .NET thread-level hooks library
MIT License
81 stars 13 forks source link

FindMainWindow failed with master branch #36

Closed csabo closed 1 year ago

csabo commented 1 year ago

I ran into issues with poeLurker, and the dev recommended I try building the demo test app and see if the issue persists. I see "installing hook" then it crashes when doing keyboard input. Below are the two event viewer entries. (windows 11 22H2)

Faulting application name: Winook.Desktop.Core.Test.exe, version: 1.0.0.0, time stamp: 0x63747414 Faulting module name: KERNELBASE.dll, version: 10.0.22621.1555, time stamp: 0x235a45d0 Exception code: 0xe0434352 Fault offset: 0x000000000008fdec Faulting process id: 0x0x4FB4 Faulting application start time: 0x0x1D9791C0A81C2C9 Faulting application path: Z:\Downloads\Winook-master\test\Winook.Desktop.Core.Test\bin\Debug\netcoreapp3.1\Winook.Desktop.Core.Test.exe Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll Report Id: f42d63a8-2015-4b1d-b2d7-e2970f284c15 Faulting package full name: Faulting package-relative application ID:

Application: Winook.Desktop.Core.Test.exe CoreCLR Version: 4.700.22.55902 .NET Core Version: 3.1.32 Description: The process was terminated due to an unhandled exception. Exception Info: Winook.WinookException: FindMainWindow() failed at Winook.HookBase.InstallAsync() in Z:\Downloads\Winook-master\src\Winook\HookBase.cs:line 109 at Winook.Desktop.Core.Test.MainWindow.keyboardButton_Click(Object sender, EventArgs e) in Z:\Downloads\Winook-master\test\Winook.Desktop.Core.Test\MainWindow.xaml.cs:line 144 at System.Threading.Tasks.Task.<>c.b__139_0(Object state) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run() at Winook.Desktop.Core.Test.App.Main()

macote commented 1 year ago

Hi,

Can you try again with wordpad instead? Notepad is no longer working since Microsoft has replaced the traditional application with a Store App.

Replace the app here with C:\Program Files\Windows NT\Accessories\wordpad.exe.

Let me know.

macote commented 1 year ago

Closing.