OldSchoolHack

Register / Login English

C++ source problem (fehlermeldung)

icon Thread: C++ source problem (fehlermeldung)

Join Date: Mar 2009

Posts: 8

Hi ich hab mir nen source code besorgt zum testen ob bei mir das c++ auch funtzt (DEV-C++).

aber nun kommt immer eine fehler meldung bei der zeile: # i n c l u d e < d e t o u r s . h > <--- musste so schrtieben sonst is es unsichbar ^^ im

den code hab ich net selber geschrieben, war nur so zum testen.


TEXT Code:
  1. #include <windows.h>
  2. #include <detours.h>
  3. #include <d3d8.h>
  4. #include <d3dx8.h>
  5. #include \"log.h\"
  6. #include <fstream>
  7. #include <fstream>
  8. #pragma comment(lib, \"d3dx8.lib\")
  9. #pragma comment(lib, \"d3d8.lib\")
  10. using namespace std;
  11. static DWORD dwBeginScene = 0x6D9D9250;
  12. static DWORD dwEndScene = 0x6d9d93a0;
  13. static DWORD dwDrawIndexedPrimitive = 0x6d9d73a0;
  14. static DWORD dwSetStreamSource = 0x6d9d6760;
  15. static DWORD dwSetViewport = 0x6d9d5b90 ;
  16.  
  17.  
  18. int m_Stride;
  19. int texnum;
  20. int nNumVertices;
  21. int nPrimitiveCount;
  22.  
  23. LPDIRECT3DTEXTURE8 Red,Yellow,Green,Blue,Purple,Pink,Orange;
  24. bool Color = true;
  25. bool Logger = false;
  26. ofstream ofile;
  27. char dlldir[320];
  28. float ScreenCenterX = 0.0f;
  29. float ScreenCenterY = 0.0f;
  30. bool xhair = false;
  31. bool WallHack = false;
  32. bool WallHack2 = false;
  33. HANDLE hand1 =NULL;
  34. HANDLE hand2 =NULL;
  35.  
  36. DWORD bytes;
  37.  
  38. //Logger
  39. int texarray[1000];
  40. int arraycounter;
  41. int delarray[500];
  42. int dcount;
  43. unsigned int arrc;
  44. int i=0;
  45.  
  46.  
  47. D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 );
  48.  
  49.  
  50. char *GetDirectoryFile(char *filename)
  51. {
  52. static char path[320];
  53. strcpy(path, dlldir);
  54. strcat(path, filename);
  55. return path;
  56. }
  57.  
  58. void __cdecl add_log (const char *fmt, ...)
  59. {
  60. if(ofile != NULL)
  61. {
  62. if(!fmt) { return; }
  63.  
  64. va_list va_alist;
  65. char logbuf[256] = {0};
  66.  
  67. va_start (va_alist, fmt);
  68. _vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
  69. va_end (va_alist);
  70.  
  71. ofile << logbuf << endl;
  72. }
  73. }
  74.  
  75. HRESULT GenerateTexture(IDirect3DDevice8 *pD3Ddev, IDirect3DTexture8 **ppD3Dtex, DWORD colour32)
  76. {
  77. if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) )
  78. return E_FAIL;
  79.  
  80. WORD colour16 = ((WORD)((colour32>>2 [Augenrollen] &0xF)<<12)
  81. |(WORD)(((colour32>>20)&0xF)<< [Augenrollen]
  82. |(WORD)(((colour32>>12)&0xF)<<4)
  83. |(WORD)(((colour32>>4)&0xF)<<0);
  84.  
  85. D3DLOCKED_RECT d3dlr;
  86. (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
  87. WORD *pDst16 = (WORD*)d3dlr.pBits;
  88.  
  89. for(int xy=0; xy < 8*8; xy++)
  90. *pDst16++ = colour16;
  91.  
  92. (*ppD3Dtex)->UnlockRect(0);
  93.  
  94. return S_OK;
  95. }
  96.  
  97.  
  98. //=================================EndScene_Start=== ================================================== ============================//
  99. typedef HRESULT ( WINAPI* oEndScene ) ( LPDIRECT3DDEVICE8 pDevice );
  100. oEndScene pEndScene;
  101.  
  102. HRESULT WINAPI myEndScene(LPDIRECT3DDEVICE8 pDevice)
  103. {
  104. if(Color)
  105. {
  106. GenerateTexture(pDevice, &Red, D3DCOLOR_ARGB (255 , 255 , 0 , 0 ));
  107. GenerateTexture(pDevice, &Yellow, D3DCOLOR_ARGB (255 , 255 , 255 , 0 ));
  108. GenerateTexture(pDevice, &Green, D3DCOLOR_ARGB (255 , 0 , 255 , 0 ));
  109. GenerateTexture(pDevice, &Blue, D3DCOLOR_ARGB (255 , 0 , 0 , 255 ));
  110. GenerateTexture(pDevice, &Purple, D3DCOLOR_ARGB (255 , 102 , 0 , 153 ));
  111. GenerateTexture(pDevice, &Pink, D3DCOLOR_ARGB (255 , 255 , 20 , 147 ));
  112. GenerateTexture(pDevice, &Orange, D3DCOLOR_ARGB (255 , 255 , 165 , 0 ));
  113. Color=false;
  114. }
  115.  
  116. if(xhair)
  117. {
  118. D3DRECT rec2 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+2};
  119. D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 2,ScreenCenterY+20};
  120. pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,redt, 0, 0);
  121. pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,redt, 0, 0);
  122. }
  123.  
  124. //=============================================UnHoo K_Start=========================================== ========//
  125.  
  126. if((GetAsyncKeyState(VK_F5)&1))
  127. {
  128. int end =NULL;
  129. int dip =NULL;
  130. int svp =NULL;
  131. int sss =NULL;
  132.  
  133.  
  134. BYTE Unhook[5] = {0x8B,0xFF,0x55,0x8B,0xEC};//Original Function Bytes.
  135. hand1 = GetCurrentProcess();
  136. DWORD dwmodualBase=(DWORD)GetModuleHandle(\"d3d8.dll\");
  137. end = 0x6d9d93a0;
  138. dip = 0x6d9d73a0;
  139. svp = 0x6d9d5b90;
  140. sss = 0x6d9d6760;
  141.  
  142. WriteProcessMemory(hand1, (void*) end, Unhook, 5, &bytes);
  143. WriteProcessMemory(hand1, (void*) dip, Unhook, 5, &bytes);
  144. WriteProcessMemory(hand1, (void*) svp ,Unhook, 5, &bytes);
  145. WriteProcessMemory(hand1, (void*) sss,Unhook, 5, &bytes);
  146. }
  147. //=========================================UnHook_En d================================================= ========//
  148.  
  149. if((GetAsyncKeyState(VK_F1)&1)){xhair=!xhair;}
  150. if((GetAsyncKeyState(VK_F2)&1)){WallHack=!WallHack ;}
  151.  
  152. return pEndScene(pDevice);
  153. }
  154. //====================================EndScene_End== ================================================== ========================//
  155.  
  156.  
  157.  
  158.  
  159. //=================================Dip_Start======== ================================================== ==================================//
  160. typedef HRESULT ( WINAPI* oDrawIndexedPrimitive ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount );
  161. oDrawIndexedPrimitive pDrawIndexedPrimitive;
  162.  
  163. HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)
  164. {
  165.  
  166.  
  167.  
  168.  
  169. if(WallHack)
  170. {
  171. texnum = (nNumVertices*100000)+nPrimitiveCount;
  172. if(m_Stride==40 &&
  173.  
  174. (texnum==7500121 )||(texnum==8500105 )||(texnum==1240016 [Augenrollen] ||(texnum==37000650)||
  175. (texnum==18000274)||(texnum==8800105 )||(texnum==36900650)||(texnum==19600314)||
  176. (texnum==21800306)||(texnum==7500121 )||(texnum==8500105 )||(texnum==1240016 [Augenrollen] ||
  177. (texnum==21800306)||(texnum==36900650)||(texnum==7 500121 )||(texnum==37000650)||
  178. (texnum==18000274)||(texnum==7500121 )||(texnum==8500105 )||(texnum==3800065 [Augenrollen] ||
  179. (texnum==2210026 [Augenrollen] ||(texnum==62400752)||(texnum==2 7900456)||(texnum==45700654)||
  180. (texnum==4800040 )||(texnum==83600752)||(texnum==33400477)||(texnum ==38100666)||
  181. (texnum==2800036 )||(texnum==62400752)||(texnum==29700492)||(texnum ==8490077 [Augenrollen] ||
  182. (texnum==27500442)||(texnum==5210065 [Augenrollen] ||(texnum==6 2400752)||(texnum==33600552)||
  183. (texnum==44100646)||(texnum==18000274)||(texnum==3 720050 [Augenrollen] ||(texnum==45700654)||
  184. (texnum==3720050 [Augenrollen] ||(texnum==5210065 [Augenrollen] ||(texnum==5 210065 [Augenrollen] &&
  185.  
  186.  
  187.  
  188. (nNumVertices == 100 && nPrimitiveCount == 121) || //Foot
  189. (nNumVertices == 105 && nPrimitiveCount == 16 [Augenrollen] || //Right Arm
  190. (nNumVertices == 132 && nPrimitiveCount == 180) || //
  191. (nNumVertices == 159 && nPrimitiveCount == 200) || //Left Arm
  192. (nNumVertices == 338 && nPrimitiveCount == 534) || //Underbody thanks japennese guy =)
  193. //(nNumVertices == 448 && nPrimitiveCount == 776) || //Head
  194. (nNumVertices == 804 && nPrimitiveCount == 1016) || // //SRG Option item
  195. (nNumVertices == 109 && nPrimitiveCount == 110) || //Bulletproof Vest
  196. (nNumVertices == 336 && nPrimitiveCount == 532)) //Battle Pants
  197.  
  198. {
  199. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  200. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  201. pDevice->SetTexture(0,Orange);
  202. //pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME );
  203.  
  204. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  205.  
  206. //pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID );
  207. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  208. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  209. pDevice->SetTexture(0,Pink);
  210. }
  211.  
  212. if(m_Stride==40 && texnum== 21300174)
  213. {
  214. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  215. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  216. pDevice->SetTexture(0,Green);//GreenNade
  217. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  218. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  219. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  220. pDevice->SetTexture(0,Purple);
  221. }
  222.  
  223.  
  224. if(nNumVertices == 158 && nPrimitiveCount == 131)
  225. {
  226. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  227. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  228. pDevice->SetTexture(0,Red);//GreenNade
  229. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  230. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  231. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  232. pDevice->SetTexture(0,Yellow);
  233. }
  234.  
  235. if (nNumVertices == 171 && nPrimitiveCount == 143)
  236. {
  237.  
  238. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  239. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  240. pDevice->SetTexture(0,Red);//GreenNade
  241. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  242. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  243. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  244. pDevice->SetTexture(0,Yellow);
  245. }
  246.  
  247.  
  248.  
  249. if(m_Stride==40 &&//face,mask etc...
  250. (texnum==36700612) ||
  251. (texnum==9600172 ) ||
  252. (texnum==14200236) ||
  253. (texnum==37800552) ||
  254. (texnum==28100486) ||
  255. (texnum==3550056 [Augenrollen] ||
  256. (texnum==2200024 ) ||
  257. (texnum==16200243) ||
  258. (texnum==31900466) ||
  259. (texnum==19300342) ||
  260. (texnum==36200604) ||
  261. (texnum==21300290) ||
  262. (texnum==3570055 [Augenrollen] ||
  263. (texnum==22100396) ||
  264. (texnum==36100604) ||
  265. (texnum==27100464) ||
  266. (texnum==11400180) ||
  267. (texnum==34900580) ||
  268. (texnum==13200212) ||
  269. (texnum==3470053 [Augenrollen] ||
  270. (texnum==19500352)&&
  271. (nNumVertices == 448 && nPrimitiveCount == 776))
  272.  
  273. {
  274. pDevice->SetTexture(0,Blue);
  275. }
  276.  
  277.  
  278. {
  279. pDevice->SetRenderState(D3DRS_FOGENABLE,false);
  280. }
  281.  
  282. /*Logger
  283. if(m_Stride==40){
  284.  
  285.  
  286. while(GetAsyncKeyState(VK_NUMPAD1)&1) arrc--; //Used as manual for adding textures to delarray
  287. while(GetAsyncKeyState(VK_NUMPAD3)&1) arrc++;
  288. bool alrdy=false;
  289. bool inarr=false;
  290.  
  291. if(texarray[arrc]==texnum)
  292. if(delarray[i]==texarray[arrc])
  293. alrdy=true;
  294. for(int i=0;i
  295. if(delarray[i]==texnum)
  296. inarr=true;
  297. if(texarray[arrc]==texnum || inarr){ //If true, color model differently
  298. LPDIRECT3DTEXTURE8 texCol;
  299. DWORD dwOldZEnable = D3DZB_TRUE;
  300. pDevice->SetTexture(0, NULL);
  301. pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
  302. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  303. if(alrdy) //Different colors for selected models that are already being logged (For removal from array)
  304. texCol=Blue;
  305. else
  306. texCol=Red;
  307. pDevice->SetTexture(0, texCol);
  308. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  309. pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
  310.  
  311. }
  312. }
  313. if(GetAsyncKeyState(VK_F5)&1) add_log(\"Logged tesx: %i\", texarray[arrc]); //F5 will currently selected texnum to logfile
  314. if(GetAsyncKeyState(VK_F6)&1) { //For adding/removing textures to array
  315. bool inarr=true;
  316. for(int k=0;k
  317. if(delarray[k]==texarray[arrc])
  318. {
  319. inarr=false;//Found selected texture to already exist
  320. delarray[k]=0;//Delete texture
  321. break;//Cancel loop
  322. }
  323. }
  324. if(inarr==true)
  325. {
  326. delarray[dcount]=texarray[arrc];//Add texture
  327. dcount++;
  328. }
  329. }
  330. if(GetAsyncKeyState(VK_F7)&1){
  331. int total=1;
  332. add_log(\"omfg values?!? {\");
  333. for(int x=0;x
  334. if(delarray[x]){
  335. add_log(\"%i,\",delarray[x]); //add_log2==add_log but without endl
  336. total++;
  337. }
  338. add_log(\"}; %i variables in array\",total);
  339. }
  340. bool found = false; //THIS PART CREDITS TO KRYPTEC
  341. for(int y=0; y
  342. {
  343. if(texnum==texarray[y])found=true; //I JUST CREATED AN FOR IT
  344. }
  345. if(!found && arraycounter < 1000)
  346. {
  347. texarray[arraycounter]=texnum;
  348. arraycounter++;
  349. }*/
  350.  
  351. }
  352. return pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  353. }
  354. //=====================================Dip_End====== ================================================== ===================//
  355.  
  356.  
  357. //=====================================Sss_Start==== ================================================== ====================//
  358. typedef HRESULT ( WINAPI* oSetStreamSource ) ( LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride );
  359. oSetStreamSource pSetStreamSource;
  360.  
  361. HRESULT WINAPI mySetStreamSource(LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride)
  362. {
  363. if(nStreamNumber==0)
  364. m_Stride = nStride;
  365.  
  366. return pSetStreamSource(pDevice, nStreamNumber, pStreamData, nStride);
  367. }
  368. //====================================Sss_End======= ================================================== ===================//
  369.  
  370. //====================================Svp_Start===== ================================================== ===================//
  371. typedef HRESULT (WINAPI* oSetViewport)(LPDIRECT3DDEVICE8 pDevice,CONST D3DVIEWPORT8* pViewport);
  372. oSetViewport pSetViewport;
  373.  
  374. HRESULT WINAPI mySetViewport(LPDIRECT3DDEVICE8 pDevice,CONST D3DVIEWPORT8* pViewport)
  375. {
  376. ScreenCenterX = ( float )pViewport->Width / 2;
  377. ScreenCenterY = ( float )pViewport->Height / 2;
  378.  
  379. return pSetViewport(pDevice,pViewport);
  380. }
  381. //===================================Svp_End======== ================================================== ===================//
  382.  
  383. typedef HRESULT ( WINAPI* oBeginScene ) ( LPDIRECT3DDEVICE8 pDevice );
  384. oBeginScene pBeginScene;
  385.  
  386. HRESULT WINAPI myBeginScene(LPDIRECT3DDEVICE8 pDevice)
  387. {
  388. if((GetAsyncKeyState(VK_F6)&1))
  389. {
  390. pEndScene = (oEndScene)DetourFunction((PBYTE)dwEndScene, (PBYTE)myEndScene);
  391. pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)dwDra wIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive);
  392. pSetStreamSource = (oSetStreamSource)DetourFunction((PBYTE)dwSetStrea mSource, (PBYTE)mySetStreamSource);
  393. pSetViewport=(oSetViewport)DetourFunction((PBYTE)d wSetViewport,(PBYTE)mySetViewport);
  394. }
  395.  
  396. return pBeginScene(pDevice);
  397. }
  398.  
  399.  
  400. BOOL WINAPI DllMain ( HMODULE hModule, DWORD dwReason, LPVOID lpReserved )
  401. {
  402. DisableThreadLibraryCalls(hModule);
  403.  
  404. if ( dwReason == DLL_PROCESS_ATTACH )
  405. {
  406.  
  407. //=========Log==========================//
  408. GetModuleFileName(hModule, dlldir, 512);
  409. for(int i = strlen(dlldir); i > 0; i--) { if(dlldir[i] == \'\\\') { dlldir[i+1] = 0; break; } }
  410. ofile.(GetDirectoryFile(\"log.txt\"), ios::app);
  411. //=========Log=========================//
  412.  
  413. pBeginScene = (oBeginScene)DetourFunction((PBYTE)dwBeginScene, (PBYTE)myBeginScene);
  414. pEndScene = (oEndScene)DetourFunction((PBYTE)dwEndScene, (PBYTE)myEndScene);
  415. pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)dwDra wIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive);
  416. pSetStreamSource = (oSetStreamSource)DetourFunction((PBYTE)dwSetStrea mSource, (PBYTE)mySetStreamSource);
  417. pSetViewport=(oSetViewport)DetourFunction((PBYTE)d wSetViewport,(PBYTE)mySetViewport);
  418.  
  419. }
  420. return TRUE;
  421. }