OldSchoolHack

Register / Login English

User Search: OrkSchamane

Search-Information
OrkSchamane
Threads
Thread Forum Last Post Posts Views
icon

Go to first new post [Help] D3D Hook - D3DXCreateFont & DrawFont Posted on: Thu 3. Apr 2014, 23:03

OrkSchamane

preview Preview

Go To Post

Hallo ich arbeite z.Z. ein paar tut's durch und würde gerne "Deutsche" schrift in eine Fremde Anwendung Zeichnen.

Mein derzeitiger Stand:
Only registered and activated users can see links.


CPP Code:
  1.  
  2.  
  3. const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grün, Blau
  4. const D3DCOLOR txtBlaue = D3DCOLOR_ARGB(255, 0, 0, 255); // Alpha, Rot, Grün, Blau
  5. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...);
  6.  
  7.  
  8. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color);
  9. //Our font interface
  10. ID3DXFont *g_font=NULL;
  11.  
  12. HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  13. {
  14. DrawRect ( pDevice, 10, 10, 200, 200, txtPink);
  15.  
  16. if ( g_font == 0 )
  17. {
  18. D3DXCreateFont(pDevice, 14, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, (LPCWSTR)"Arial", &g_font );
  19. }
  20. else
  21. {
  22. DrawFont ( 20, 50, txtBlaue, "Hife" );
  23. g_font->OnLostDevice();
  24. g_font->OnResetDevice();
  25.  
  26. }
  27.  
  28. DrawFont ( 300, 50, txtPink, "Bitte" );
  29.  
  30.  
  31. return pEndScene(pDevice);
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. //Draw------------
  40.  
  41. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
  42. {
  43. D3DRECT rect = {X, Y, X+L, Y+H};
  44. Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
  45. }
  46.  
  47. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...)
  48. {
  49. //const char *fps_string;
  50. //fps_string = "a";
  51. char buffer[256];
  52. va_list args; // deswegen: #include <cstdio>
  53. va_start (args, format);
  54. vsprintf (buffer,format, args);
  55. RECT FontRect = { X, Y, X + 120, Y + 16 };
  56. g_font->DrawText(NULL,        //pSprite
  57.                               (LPCWSTR) buffer,  //pString
  58.                                -1,          //Count
  59.                                &FontRect,  //pRect
  60.                                DT_NOCLIP,//Format,
  61.                                Color); //Color
  62. //( NULL, buffer, -1, &FontRect, DT_NOCLIP , Color ); // Zeichnen
  63. va_end (args);
  64. }
  65.  

Frage 2:

Warum bekomme ich immer wieder den Fehler (in Visual Studio 2010) wenn ich bei buffer das (LPCWSTR) weg lasse:


Das Argument vom Typ ""char *"" ist mit dem Parameter vom Typ ""LPCWSTR"" inkompatibel.

Hier der Code zur Frage 2:

CPP Code:
  1.  
  2.  
  3. g_font->DrawText(      NULL,        
  4.                                (LPCWSTR) buffer,  //<--- hier ist der Bösewicht
  5.                                -1,        
  6.                                &FontRect,  
  7.                                DT_NOCLIP,
  8.                                Color);
  9.  

und bei

CPP Code:
  1.  
  2. D3DXCreateFont(pDevice,
  3.                       14,
  4.                       0,
  5.                       FW_NORMAL,
  6.                        1,
  7.                       false,
  8.                       DEFAULT_CHARSET,
  9.                       OUT_DEFAULT_PRECIS,
  10.                       ANTIALIASED_QUALITY,
  11.                       DEFAULT_PITCH | FF_DONTCARE,
  12.                       "Arial", //<--- hier wurde jetzt der Fehler erscheinen
  13.                       &g_font );
  14.  
  15.  

wird bei mir immer das "Arial" als Fehler angegeben:

Das Argument vom Typ ""const char *"" ist mit dem Parameter vom Typ ""LPCWSTR"" inkompatibel.


Frage 3:
Wenn die Anwendung scalliere oder full Scren aktivere kommt diese Fehlermeldung:

Only registered and activated users can see links.


Was kann/muss ich tun?
Danke
VB, C/C++, Delphi, etc

Thu 21. Aug 2014, 10:23

by vedel Go to last post
4 1792
icon

Go to first new post [Help] D3D Hook - D3DXCreateFont & DrawFont Posted on: Thu 3. Apr 2014, 23:03

OrkSchamane

preview Preview

Go To Post

kann mir nochmal jemand sagen was in meinem code falsch ist? 


Situation: ich möchte ein rectangle und schrift in eine directx9 Anwendung rein malen, wenn ich nun die Fenstergröße verändere wird das spiel nicht mehr gezeichnet. Der Fehlerhafte C++ Code dazu:



TEXT Code:
  1.  
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <Windows.h>
  4. #include <cstdio>
  5. #include <time.h>
  6. #include <d3d9.h> //einmal endscene() hooken.
  7. #include <d3dx9.h>
  8.  
  9.  
  10. #pragma once
  11. #pragma comment(lib, "d3d9.lib")
  12. #pragma comment(lib,"d3dx9d.lib")
  13. #pragma comment(lib,"d3dx9.lib")
  14.  
  15. const D3DCOLOR txtGreen = D3DCOLOR_ARGB(255, 0, 255, 0); //um zu in das game-Fenster zu malen brauch man ein D3DCOLOR
  16. HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice);
  17. typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
  18. EndScene_t pEndScene;
  19. DWORD WINAPI HookThread(); //typedef und einen Funktionspointer davon
  20.  
  21.  
  22.  
  23. void add_log(char* format, ...);
  24. void* DetourFunc(PBYTE src, const PBYTE dst, const int len);
  25. bool bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask);
  26. DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask);
  27.  
  28. HMODULE hModD3D9 = NULL;
  29. FARPROC dwEndScene = NULL;
  30. HANDLE tmpHandle = NULL;
  31. DWORD* VTableStart = NULL; //Pointer auf die VTable
  32. DWORD tempadd = NULL;
  33.  
  34.  
  35. const D3DCOLOR txtPink = D3DCOLOR_ARGB(100, 255, 0, 255); // Alpha, Rot, Grün, Blau
  36. const D3DCOLOR txtBlaue = D3DCOLOR_ARGB(100, 0, 0, 255); // Alpha, Rot, Grün, Blau
  37. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...);
  38.  
  39.  
  40. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color);
  41. //Our font interface
  42. ID3DXFont *g_font=NULL;
  43. #pragma endregion
  44.  
  45. typedef HRESULT(__stdcall* Reset_t)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*); //<--
  46. bool DIPInit = true;
  47. Reset_t OrigReset;
  48.  
  49.  
  50.  
  51. //---------------
  52.  
  53.  
  54.  
  55. BOOL WINAPI DllMain(HINSTANCE hinstDll,DWORD Reason,LPVOID Reserved)
  56. {
  57. switch(Reason)
  58. {
  59. case DLL_PROCESS_ATTACH: add_log("==========LOG START==========");
  60. add_log("DLL Attached");
  61. add_log("Creating Thread...");
  62. tmpHandle = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&HookThread, 0, 0, 0);
  63. if (!tmpHandle)
  64. {
  65. add_log("ThreadCreation Failed!");
  66. }
  67. break;
  68. case DLL_PROCESS_DETACH: add_log("DLL Detached");
  69. add_log("==========LOG END==========\n\n\n");
  70. break;
  71. }
  72. return 1;
  73. }
  74.  
  75.  
  76.  
  77.  
  78. DWORD WINAPI HookThread(void)
  79. {
  80. add_log("Thread Created");
  81. while (!hModD3D9)
  82. {
  83. add_log("Searching d3d9.dll...");
  84. hModD3D9 = GetModuleHandle("d3d9.dll");
  85. Sleep(100);
  86. }
  87.  
  88. add_log("Found d3d9.dll: %x !", hModD3D9);
  89.  
  90. //---------VTable finden
  91. tempadd = dwFindPattern((DWORD)hModD3D9, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
  92. VTableStart = (DWORD*) *(DWORD*)(tempadd+2);
  93. //---------VTable finden---Ende
  94.  
  95. //---------EndScene Adresse holen und dann hooken
  96. dwEndScene = (FARPROC) VTableStart[42];
  97.  
  98. pEndScene = (EndScene_t) DetourFunc((PBYTE) dwEndScene, (PBYTE)hkEndScene, 5); while (true)
  99. OrigReset = (Reset_t) DetourFunc((BYTE*) VTableStart[16], (BYTE*) ResetHook, 5);
  100.  
  101. {
  102. Sleep(500);
  103. }
  104. return 0;
  105. }
  106.  
  107.  
  108.  
  109.  
  110. HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  111. {
  112.  
  113. DrawRect ( pDevice, 10, 10, 200, 200, txtPink);
  114.  
  115. if (DIPInit)
  116. {
  117. D3DXCreateFont(pDevice, 14, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_font );
  118. DIPInit = false;
  119. }
  120. else
  121. {
  122.  
  123. char *a = "a"; // so kann man eine variable erstellen und sie zeichnen lassen
  124. DrawFont ( 20, 50, txtBlaue, a );
  125.  
  126. /* g_font->OnResetDevice();
  127. g_font->OnLostDevice();*/
  128. DrawFont ( 300, 50, txtPink, "Bitte" );
  129.  
  130. }
  131. return pEndScene(pDevice);
  132. }
  133.  
  134.  
  135. //----------
  136. HRESULT __stdcall ResetHook(IDirect3DDevice9* Device, D3DPRESENT_PARAMETERS* Params)
  137. {
  138. if (!DIPInit)
  139. {
  140. g_font->Release();
  141. }
  142. DIPInit = true;
  143. return OrigReset(Device, Params);
  144. }
  145. //----------
  146.  
  147.  
  148. #pragma region Draw------------dinge
  149.  
  150. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
  151. {
  152. D3DRECT rect = {X, Y, X+L, Y+H};
  153. Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
  154. }
  155.  
  156. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...)
  157. {
  158. //const char *fps_string;
  159. //fps_string = "a";
  160. char buffer[256];
  161. va_list args; // deswegen: #include <cstdio>
  162. va_start (args, format);
  163. vsprintf ( buffer,format, args);
  164. RECT FontRect = { X, Y, X + 120, Y + 16 };
  165. g_font->DrawText(NULL, //pSprite
  166. buffer, //pString
  167. -1, //Count
  168. &FontRect, //pRect
  169. DT_NOCLIP,//Format,
  170. Color); //Color
  171.  
  172. va_end (args);
  173. }
  174.  
  175.  
  176.  
  177.  
  178.  
  179. void* DetourFunc(PBYTE src, const PBYTE dst, const int len) // Adresse der OriginalFunktion ( src) und Adresse der HookFunktion (dst)
  180. {
  181. DWORD dwback;
  182. BYTE* jmp = (BYTE*)malloc(len+5); //Speicher für unser Trampolin allokieren und die <len> Bytes aus Source hineinkopieren
  183. VirtualProtect(src, len, PAGE_READWRITE, &dwback); //save ^ und readwrite rechte geben --- mit VirtualProtect die entsprechenden Rechte zusichern
  184. memcpy(jmp, src, len);
  185. jmp += len;
  186. jmp[0] = 0xE9; // jmp befehl in den anfang der Originalfunktion reinschreiben
  187. *(DWORD*)(jmp+1) = (DWORD)(src + len - jmp) - 5; // relative adresse zu dst eintragen
  188. src[0] = 0xE9;
  189. *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
  190. VirtualProtect(src, len, dwback, &dwback); // vp wieder herstellen.
  191. VirtualProtect(jmp-len, len+5, PAGE_EXECUTE_READWRITE, &dwback); //Trampolin Execute Rechte geben
  192. return (jmp - len);
  193. }
  194.  
  195. //---------------------
  196. //um die Adresse der EndScene Funktion zu finden, ein sogenanntes "Search-Pattern", also ein Suchmuster.
  197. //Dazu benutzen wir diese beiden Funktionen hier:
  198. bool bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
  199. {
  200. for(;*szMask;++szMask,++pData,++bMask)
  201. {
  202. if(*szMask=='x' && *pData!=*bMask )
  203. {
  204. return false;
  205. }
  206. }
  207. return (*szMask) == NULL;
  208. }
  209.  
  210.  
  211. DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
  212. {
  213. for(DWORD i=0; i < dwLen; i++)
  214. {
  215. if( bDataCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
  216. {
  217. return (DWORD)(dwAddress+i);
  218. }
  219. }
  220. return 0;
  221. }
  222.  
  223. //Erstellt eine Log.txt in dem ausführendem verzeichniss und schreibt den erfolg/misserfolg dahinein
  224. void add_log(char* format, ...)
  225. {
  226. HANDLE filehandle;
  227. DWORD dwReadBytes;
  228. char buffer[2048];
  229. char writebuffer[2048];
  230. va_list args;
  231. va_start(args, format);
  232. vsprintf (buffer, format, args);
  233. filehandle = CreateFile("Log.txt", GENERIC_WRITE, 0, 0, OPEN_ALWAYS, 0, 0);
  234. SetFilePointer(filehandle, 0, 0, FILE_END);
  235. char date[18]; _strdate(date);
  236. date[8] = ' ';
  237. _strtime(date+9);
  238. sprintf_s(writebuffer, 2048, "Log Added (%s): %s\r\n", date, buffer);
  239. WriteFile(filehandle, writebuffer, strlen(writebuffer), &dwReadBytes, 0); CloseHandle(filehandle);
  240. }
  241.  
VB, C/C++, Delphi, etc

Thu 21. Aug 2014, 10:23

by vedel Go to last post
4 1792
icon

Go to first new post WallHack v.5 Undetectable 100%! Posted on: Fri 11. Apr 2014, 12:39

manueeelillo

preview Preview

Go To Post

War ja fast klar ... der typ ist erst 5 Minuten hier angemeldet und postet gleich einen Hack?
Counter-Strike: Global Offensive

Fri 11. Apr 2014, 22:27

by OrkSchamane Go to last post
3 455
icon

Go to first new post [Help] D3D Hook - D3DXCreateFont & DrawFont Posted on: Thu 3. Apr 2014, 22:58

OrkSchamane

preview Preview

Go To Post

Hallo ich arbeite z.Z. ein paar tut's durch und würde gerne "Deutsche" schrift in eine Fremde Anwendung Zeichnen.

Mein derzeitiger Stand:
Only registered and activated users can see links.

Frage 1:
Wie zuerkennen, Ein pinktes Rechteck in der linken oberen ecke, dann noch 2 Zeilen geschriebenes ( ist leider nicht deutsch, eigentlich steht da: links "Hilfe", rechts "Bitte"). Was muss ich verändern um da auch wirklich Deutsch herauszubekommen

Mein Code ausschnitt zu den Fonts:


CPP Code:
  1.  
  2. const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grün, Blau
  3. const D3DCOLOR txtBlaue = D3DCOLOR_ARGB(255, 0, 0, 255); // Alpha, Rot, Grün, Blau
  4. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...);
  5.  
  6.  
  7. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color);
  8. //Our font interface
  9. ID3DXFont *g_font=NULL;
  10.  
  11. HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  12. {
  13. DrawRect ( pDevice, 10, 10, 200, 200, txtPink);
  14.  
  15. if ( g_font == 0 )
  16. {
  17. D3DXCreateFont(pDevice, 14, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, (LPCWSTR)"Arial", &g_font );
  18. }
  19. else
  20. {
  21. DrawFont ( 20, 50, txtBlaue, "Hife" );
  22. g_font->OnLostDevice();
  23. g_font->OnResetDevice();
  24.  
  25. }
  26.  
  27. DrawFont ( 300, 50, txtPink, "Bitte" );
  28.  
  29.  
  30. return pEndScene(pDevice);
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. //Draw------------
  39.  
  40. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
  41. {
  42. D3DRECT rect = {X, Y, X+L, Y+H};
  43. Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
  44. }
  45.  
  46. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...)
  47. {
  48. //const char *fps_string;
  49. //fps_string = "a";
  50. char buffer[256];
  51. va_list args; // deswegen: #include <cstdio>
  52. va_start (args, format);
  53. vsprintf (buffer,format, args);
  54. RECT FontRect = { X, Y, X + 120, Y + 16 };
  55. g_font->DrawText(NULL,        //pSprite
  56.                               (LPCWSTR) buffer,  //pString
  57.                                -1,          //Count
  58.                                &FontRect,  //pRect
  59.                                DT_NOCLIP,//Format,
  60.                                Color); //Color
  61. //( NULL, buffer, -1, &FontRect, DT_NOCLIP , Color ); // Zeichnen
  62. va_end (args);
  63. }
  64.  

Frage 2:

Warum bekomme ich immer wieder den Fehler (in Visual Studio 2010) wenn ich bei buffer das (LPCWSTR) weg lasse:


Das Argument vom Typ ""char *"" ist mit dem Parameter vom Typ ""LPCWSTR"" inkompatibel.

Hier der Code zur Frage 2:
CPP Code:
  1.  
  2. g_font->DrawText(      NULL,        
  3.                                (LPCWSTR) buffer,  //<--- hier ist der Bösewicht
  4.                                -1,        
  5.                                &FontRect,  
  6.                                DT_NOCLIP,
  7.                                Color);
  8.  


und bei
CPP Code:
  1.  
  2. D3DXCreateFont(  pDevice, [...] , DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_font );
  3.  

wird bei mir immer das "Arial" als Fehler angegeben:
Das Argument vom Typ ""const char *"" ist mit dem Parameter vom Typ ""LPCWSTR"" inkompatibel.

Frage 3:

Wenn ich die Anwendung scalliere oder full Scren aktivere kommt diese Fehlermeldung:
Only registered and activated users can see links.

Was kann ich tun^^
VB, C/C++, Delphi, etc

Thu 3. Apr 2014, 22:58

by OrkSchamane Go to last post
0 361
Downloads
No downloads found.