You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! If I could when you're not busy I'd like to ask for your help on hooking File.Exists and Directory.Exists, not sure what I'm doing wrong but I've tried hooking these functions
And none of them seem to affect either of those functions in C#. I know the hooks are installing correctly, and sometimes it even hangs when calling File.Exists with $77 at the beginning, but not hang when it's not. Maybe I'm returning it wrong? Would appreciate your help. Not too worried about maintenance at the moment. Here's my current code.
When I'm not sure what function to hook, I just hook everything that I can think of and then use windbg + OutputDebugString to see what functions are called with what parameters.
You shouldn't hook kernel32, but only ntdll functions. Try hook every syscall that has to do with file handling. Then create a C# app that calls File.Exists and inject it to see which hooks get triggered. Then you should know which ntdll function(s) is the right one(s) to hook.
Don't forget to try NtCreateFile and NtOpenFile. I just found this project, maybe you can get an idea from it which functions are the right ones.
Hey! If I could when you're not busy I'd like to ask for your help on hooking File.Exists and Directory.Exists, not sure what I'm doing wrong but I've tried hooking these functions
NtQueryAttributesFile
GetFileAttributesW
FindFirstFileW
GetFileAttributesExW
And none of them seem to affect either of those functions in C#. I know the hooks are installing correctly, and sometimes it even hangs when calling File.Exists with $77 at the beginning, but not hang when it's not. Maybe I'm returning it wrong? Would appreciate your help. Not too worried about maintenance at the moment. Here's my current code.
Hooks.c:
Hooks.h:
ntdll.h:
The text was updated successfully, but these errors were encountered: