Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 20:52

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



erledigt! c++ CreateThread & MS Detours

Discussion on erledigt! c++ CreateThread & MS Detours within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2008
Posts: 132
Received Thanks: 120
erledigt! c++ CreateThread & MS Detours

ERLEDIGT

Quote:
Hey ho, ich bin langsam am verzweifeln. Ich versuche seit einer Ewigkeit eine dll in einem Prozess zu injizieren und eine simple Funktion zu hooken.
Kommen wir zum ersten problem, das Starten von einem Thread, eigentlich kein Problem:
Code:
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)initHook,0,0,NULL);
die Funktion ist folgendermaßen definiert:
Code:
void initHook()
Ich rufe CreateThread in der Dllmain auf und überorüfe vorher natürlich, ob fdwReason = dll_process_attach ist. Der Prozess stürtz sofort nach der Injection ab, ohne, dass die initHook Funktion im Thread gestartet wurde.

Kommen wir zum 2. Problem, dem Detour. Ich verwende MsDetours, um die BeginScene Funktion der d3d8.dll zu detourn. Die Adresse kann ich mir sehr gut duch das Handle vom d3d8 Modul + Offset 0x443A0 schnappen:
Code:
DWORD offset = 0x443A0;
DWORD funcadr = (DWORD)GetModuleHandle(L"d3d8.dll") + offset;
nun versuche ich den Detour zu setzen:
Code:
pBeginScene = (oBeginScene)DetourFunction((PBYTE)(funcadr),(PBYTE)GetDevicePointer);
Der Prozess stürzt ab!
Ich habe mir den abstürzenden Prozess in Olly genauer angeschaut. MsDetours setzt einen Jump genau am Funktionsbegin, das ist soweit gut. Nur führt der Jump ins Nichts, das verursacht den Absturz. Eigentlich müsste er zu meiner GetDevicePointer Funktion führen.
Ich habe mich an das 11. Tutorial von KN4CKER gehalten.
Ich verwende VisualC++ 2010 und Winject und den ProcessHacker2 zum injizieren der DLL.
Hat jemand eine Ahnung, warum das ganze fehl schlägt ?
Ohje, wie peinlich. ich hatte vergessen der Dllmain einen Rückgabewert zu verpassen. Nun funktioniert alles so weit.
krustx is offline  
Old 08/10/2011, 19:43   #2


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,902
Received Thanks: 25,407
Ein Thread hat den Prototypen DWORD WINAPI Thread(LPVOID param) und nicht void Thread()!
MrSm!th is offline  
Reply


Similar Threads Similar Threads
[Tutorial] Microsoft Detours
07/24/2013 - Coding Tutorials - 74 Replies
Eine kleine .dll wird geschrieben, die mithilfe der Microsoft Detours Library die MessageBoxA Funktion detourt, und den Text ersetzt, sobald sie in einen Prozess injeziert wird. Ich hoffe ich konnte es einigermaßen verständlich erklären (mein Gedankenfluss ist manchmal etwas wirr). Es ist auf Deutsch. Detours Video Tutorial
Microsoft Detours 2.1
02/28/2012 - CO2 Programming - 26 Replies
When I was working on a proxy a while ago I needed a way redirect the connections from conquer client to my proxy. There is a couple of ways to achieve this but I choose detours (2.1). However I noticed that there was a lack of tutorials on how to actually start using Microsoft detours (or I couldn't use Google properly, which is also possible :D). So here's a little step-by-step tutorial how to start using them and I will also show how to detour Connect and ShellExecute functions. Step 1 -...
c++ Python.h und detours.h
06/15/2011 - C/C++ - 4 Replies
hi ich benutze Microsoft visual c++ 2010 und wenn ich #include "windows.h" #include <Python.h> #include "detours.h" benutze wird nur windows.h gefunden
MS Detours 1.5
07/16/2010 - Kal Online - 10 Replies
hi, i'm having problem trying to compile my dll using ms detours 2.1 (not 1.5, sorry) detours.lib(detours.obj) : error LNK2001: unresolved external symbol "struct HINSTANCE__ * __stdcall Detoured(void)" (?Detoured@@YGPAUHINSTANCE__@@XZ) G:\KalOnline\d3dx9_29.dll : fatal error LNK1120: 1 unresolved externals could someone tell me how to solve it? could not google it.
Can EDX Detours be used for multibotting
06/19/2010 - SRO Private Server - 12 Replies
After editing source code can this be done? In EDX Detours thread he wrote this app can be used for another programs after tweaking the source. But i don't have any programming skills,so anyone who knows c++ please take a look at it http://www.elitepvpers.com/forum/sro-guides-templat es/308740-guide-using-windows-detours-redirect-sil kroad-proxy.html



All times are GMT +1. The time now is 20:53.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.