CoreHook: The UWP example doesn't work

Hi,

I tested the CoreHook.UWP.FileMonitor but it doesn’t work. Am I doing something wrong?

When I launch (with admin privilege) dotnet CoreHook.UWP.FileMonitor.dll Microsoft.WindowsCalculator_8wekyb3d8bbwe!App, the calculator launched but then freezed, and after some time, an exception threw and then the calculator terminated. Also tried to launch Microsoft.MinecraftUWP_8wekyb3d8bbwe!App but also freezed. When launch without admin privilege, the UWP won’t freeze or close but same exception throws.

Unhandled Exception: System.TimeoutException: Unable to wait for injection completion.
   at CoreHook.ManagedHook.Remote.InjectionHelper.WaitForInjection(Int32 InTargetPID) in D:\Documents\Visual Studio 2017\Projects\CoreHook\CoreHook.ManagedHook\Remote\InjectionLoader.cs:line 110
   at CoreHook.ManagedHook.Remote.RemoteHooking.InjectEx(Int32 hostPID, Int32 targetPID, Int32 wakeUpTID, String lbraryPath_x86, String libraryPath_x64, Boolean InCanBypassWOW64, String coreRunDll, String coreLoadDll, String coreClrPath, String coreLibrariesPath, IPipePlatform pipePlatform, IEnumerable`1 dependencies, Object[] InPassThruArgs) in D:\Documents\Visual Studio 2017\Projects\CoreHook\CoreHook.ManagedHook\Remote\RemoteHooking.cs:line 221
...

OS: Windows 10 Pro 17134 .NET Core: 2.1.2 Environment Vars: CORE_LIBRARIES and CORE_ROOT set to C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.2 Both corehook64.dll and CoreRunDLL64.dll are put in the same directory as CoreHook.UWP.FileMonitor.dll

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 42 (23 by maintainers)

Most upvoted comments

Perfect, thank you. Looks like a access pipe issue, so I updated the UWP pipe access code. Try pulling latest changes and try again.

I will also go ahead and add that path fix!

That’s great to hear!!

Thank you for being patient and working together to get it resolved. I hope you have a fun time playing with the library!

I think we finally solved this issue: The lastest code works on my PC now! (Calculator doesn’t load any files so I tried on Minecraft and it works very well.)

Thank you very much!!

Output log in VS:

Starting pipe client...
Attempting to connect to the server pipe
Exception at 0x00007FFBA4CFA388 (KernelBase.dll) in Calculator.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070005, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFCB61A0000).
System.UnauthorizedAccessException: Access to the path is denied.
   at System.IO.Pipes.NamedPipeClientStream.TryConnect(Int32 timeout, CancellationToken cancellationToken)
   at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at CoreHook.IPC.NamedPipes.NamedPipeClient.Connect(Int32 timeoutMilliseconds)
   at CoreHook.CoreLoad.Loader.Load(String paramPtr)

Besides, you should add " for paths in post-build events (CoreHook project) or it always fails when building in a path contains Visual Studio 2017.

copy "$(TargetDir)$(TargetFileName)" "$(OutDir)..\x86\$(TargetFileName)"
...

Thank you for checking!

Checkout the Visual Studio solution the Hooking module here and let me know if that compiles please.

Hey @UlyssesWu ,

I have made more changes and updated the code to the repository so that hopefully it fixes the errors you have. Try checkout out the repo again and building the code. You can also build CoreHook.Host from source, which will give you debug symbols for corerundll64.dll in case that helps. Make sure you build the latest source for CoreHook.Hooking for X64 as well.

Please let me know if the updated version works now.