justinstenning / Direct3DHook

DirectX Capture and Overlays by using Direct3D API hooks
http://spazzarama.com/2011/03/14/c-screen-capture-and-overlays-for-direct3d-9-10-and-11-using-api-hooks
MIT License
584 stars 176 forks source link

STATUS_ACCESS_DENIED: The given process is not accessible. (Code: 5) #49

Closed weituotian closed 7 years ago

weituotian commented 7 years ago

when i hook war3.

Error: An unexpected error occured: System.AccessViolationException: STATUS_ACCESS_DENIED: The given process is not accessible. (Code: 5) 在 EasyHook.NativeAPI.Force(Int32 InErrorCode) 在 EasyHook.NativeAPI.RhIsX64Process(Int32 InProcessId, Boolean& OutResult) 在 EasyHook.RemoteHooking.IsX64Process(Int32 InTargetPID) 在 Capture.EntryPoint.InitialiseDirectXHook(CaptureConfig config) 位置 e:\c\game\Direct3DHook\Capture\EntryPoint.cs:行号 146 在 Capture.EntryPoint.Run(IContext context, String channelName, CaptureConfig config) 位置 e:\c\game\Direct3DHook\Capture\EntryPoint.cs:行号 70 Information: Injected into process Id:12068.

bool isX64Process = EasyHook.RemoteHooking.IsX64Process(EasyHook.RemoteHooking.GetCurrentProcessId());
justinstenning commented 7 years ago

A bit odd, looks like it successfully injects and then getting access denied attempting to check if 64-bit.

You could try instead replacing that check with the following and see if it makes it much further. bool isX64Process = IntPtr.Size > 4;

weituotian commented 7 years ago

@spazzarama thanks! it work fine!