Questions tagged [detours]

This tag is about the Microsoft Detours library for intercepting arbitrary Win32 binary functions on x86, x64, and ARM machines.

Detours is a library for intercepting arbitrary Win32 binary functions on x86, x64, and ARM machines.

245 questions
0
votes
2 answers

Detours DLL injection works only for specific applications

I try to hook some functions using Microsoft Detours. The method I'm using is CreateRemoteThread + LoadLibrary. Yet, I've encountered that the exact same code works on notepad.exe, some chrome processes etc., but not on wmplayer.exe(Windows Media…
KMint
  • 33
  • 1
  • 5
0
votes
1 answer

How does System.Net.Sockets.Socket.Disconnect disconnect from the socket?

My DLL gets injected into a program and then hooks to connect, send, recv and closesocket functions using Detours. The point is to stop the program from connecting to some server and instead communicate with my DLL directly. My recv function uses an…
0
votes
2 answers

C++ receive functions

I am hooking a few functions from my server(C++). I want to hook certain functions, to be able to dump the packets, some clients send(connect/disconnect packages). I already hooked the functions recv/recvfrom and WSARecv/WSARecvFrom. Only the…
cpppp
  • 1
0
votes
0 answers

x64 to x86 conversion problem with Detours

I want to use the repo detours.net in my project to hook native win32 api functions. It is working create for x64 applications but not for x86 applications. So I have changed to CMakeList.txt in the detours directory to -E env…
Sebi
  • 71
  • 1
  • 4
0
votes
1 answer

C++ Missing type specifier: syntax error

I hook a function with windows detours in C++. I get an error in following code: void (*asmFunction)(const char *text); void hookFunction(const char *text) { __asm nop; asmFunction(text); } asmFunction = (void (__cdecl *)(const char…
0
votes
1 answer

Access Violation when using struct

I'm trying to hook OpenSSL's int SSL_connect(SSL *s) method. OpenSSL 1.0.2l version. Here's the source code: SSL_connect SSL structure SSL_SESSION structure GOAL: Printing out any SSL_SESSION member (like ssl_version or master_key) THE PROBLEM: I…
StackOverflow
  • 47
  • 1
  • 6
0
votes
1 answer

Needs to compile the missing `detour 3.0` lib in Visual Studio

I am going to compile old project(visual studio 2012 platform-v110xp) in visual studio 2013 or Visual Studio 2019. It's using boost and Microsoft detour 3.0 libraries. But the detour 3.0 has been deleted accidentally. And now I can only find…
0
votes
2 answers

Simulate JS execution to read heap memory

I have a problem where I need to see if a particular JavaScript source code takes a lot of heap space. Ideally I would like to have access to heap memory usage and data type of objects in the heap. The trouble is that it seems I'll have to execute…
pairwiseseq
  • 313
  • 2
  • 13
0
votes
1 answer

DetourDetach() throws ERROR_INVALID_BLOCK error

I want to hook the Bitblt function with the Detours library. https://github.com/microsoft/Detours/blob/master/samples/simple/simple.cpp By referring to the example source above, I succeeded in creating a dll that hooks the Bitblt function, but the…
Sylvia
  • 141
  • 7
0
votes
0 answers

Cannot add Microsoft Detours to project (Compile errors)

I'm trying to add Microsoft Detours 3.0 to my project. I compiled the project with nmake in the readme instructions on the Github, I then went to my project properties and added C:\Program Files (x86)\Microsoft Research\Detours Express…
Inverse
  • 1
  • 1
0
votes
1 answer

MS Detours 2.1 - Unresolved externals

I'm using MS Detours 2.1 Library and VS 2010. I'm trying to detour PlaySoundW function. I can't compile that code and I'm getting these errors: Error 2 error LNK1120: 1 unresolved externals (...)\detoursLearning.dll detoursLearning Error 1 …
Hooch
  • 28,817
  • 29
  • 102
  • 161
0
votes
0 answers

C++ Detour hooking

I've got an application(made by myself) and now I decided I want to try some hooking. So the function I'm trying to hook looks like this: void PrintMessage(const char* c_szFormat, ...) { char szBuf[1024 + 2]; strncpy_s(szBuf, "I got: ",…
Dennis
  • 19
  • 5
0
votes
3 answers

is it possible to inject multiple Dlls with MS detours?

In c++ ,I want to hook more than one dll to a process. Right now I use CreateProcesswithdll() which can hook only one api at a time. What can I do to inject multiple dlls? I came across this problem because MS detours requires us to name our custom…
ash
  • 1,170
  • 1
  • 15
  • 24
0
votes
0 answers

MSVS C++: how to find address of pure virtual function at runtime

I'm writing a 64-bit Windows DLL using MSVS that is loaded by a 3rd party executable. The 3rd party exe has an API that includes some classes with pure virtual functions. Example: //3rdPartyAPI.h class foo { virtual void doWork() = 0; }; …
Tyson
  • 1,226
  • 1
  • 10
  • 33
0
votes
1 answer

Why hooking HeapFree with Detours not working for delete/free?

I'm trying to write a memory tracker for my Windows app. I've already finished a prototype using Detours. I hooked HeapAlloc, HeapReAlloc, HeapFree, HeapDestroy and output some logs for me to check. However there's something wrong. Here's my sample…
Zimian
  • 1
  • 1