Guest User

Untitled

a guest
May 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.81 KB | None | 0 0
  1.  
  2. #define WIN32_LEAN_AND_MEAN
  3. #include <windows.h>
  4. #include "apihook.h"
  5. #include "utils.h"
  6. #include "absoui.h"
  7. #include "CDetour.h"
  8. #include "gui/draw.h"
  9. #include "gui/drawogl.h"
  10. #include "Hack/AbsoHack.h"
  11. #include "main.h"
  12.  
  13. #define MakePtr( cast, ptr, addValue ) (cast)( (DWORD_PTR)(ptr) + (DWORD_PTR)(addValue))
  14. //#pragma optimize("gsy",on)
  15. _orig orig;
  16. _api api;
  17.  
  18. static bool delfile = false;
  19.  
  20. //----------------------------------------------------------------------------------------
  21. void logit (const char * fmt, ...)
  22. {
  23. va_list va_alist;
  24. char logbuf[256];
  25. FILE * fp;
  26. struct tm current_tm;
  27. time_t current_time;
  28. errno_t err;
  29.  
  30. time(&current_time);
  31. err = localtime_s(&current_tm,&current_time);
  32.  
  33. sprintf_s(logbuf, "%02d:%02d:%02d ",
  34. current_tm.tm_hour, current_tm.tm_min, current_tm.tm_sec);
  35.  
  36. va_start (va_alist, fmt);
  37. _vsnprintf_s(logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), 255, fmt, va_alist);
  38. va_end (va_alist);
  39.  
  40. if ( !(err = fopen_s(&fp, api.getOgcDirFile("log.log").c_str(), "ab")) != NULL )
  41. {
  42. fprintf ( fp, "%s\n", logbuf );
  43. fclose (fp);
  44. }
  45. }
  46.  
  47. //==_api==================================================================================
  48. //----------------------------------------------------------------------------------------
  49. #define GPA_FUNC( func ) \
  50. orig.##func = (##func##_t) GetProcAddress(hModuleHandle, #func); \
  51. /*logit("orig."#func" 0x%08x | "#func " 0x%08x",orig.##func,#func);*/ \
  52. if(!orig.##func) \
  53. logit("ERROR: "#func"'s address was not found"); \
  54.  
  55. //----------------------------------------------------------------------------------------
  56. #define REDIRECT_FUNC( func )\
  57. if(!strcmp(lpProcName,#func))\
  58. {\
  59. char dllName [256]=""; \
  60. GetModuleFileName(HMODULE(hModule),dllName,254); \
  61. logit("%s(\"%s\", \"%s\") ---------> "#func" -> api."#func,__FUNCTION__ ,dllName, lpProcName ); \
  62. return (FARPROC)(api.##func);\
  63. }
  64. //----------------------------------------------------------------------------------------
  65. _api::api_type _api::apiType;
  66. _api::_api()
  67. {
  68. apiType = unknown;
  69. // injectTo.insert(pair< string, AbsoHack::ENGINE >("hl.exe", AbsoHack::hl1));
  70. injectTo.insert(pair< string, string >("hl.exe", "hl1"));
  71. //injectTo.push_back("halo.exe");
  72. //injectTo.push_back("unreal.exe");
  73. //injectTo.push_back("UT2003.exe");
  74. //injectTo.push_back("Quake4.exe");
  75. //injectTo.push_back("cstrike.exe");
  76. //injectTo.push_back("CoDSP.exe");
  77. //injectTo.push_back("CoDMP.exe");
  78. }
  79.  
  80. //----------------------------------------------------------------------------------------
  81. void _api::opengl32_initialize()
  82. {
  83. logit(__FUNCTION__);
  84. HMODULE hModuleHandle = GetModuleHandle("opengl32.dll");
  85. if(!hModuleHandle)
  86. {
  87. logit("Something is wrong, opengl32.dll not found, error: %i",GetLastError());
  88. hModuleHandle = orig.LoadLibrary("opengl32.dll");
  89. }
  90.  
  91. GPA_FUNC(glActiveTextureARB)
  92.  
  93. .....................................................................
  94.  
  95. GPA_FUNC(wglUseFontOutlinesW)
  96.  
  97. apiType = opengl;
  98. draw = new CDrawOGL();
  99.  
  100. logit(__FUNCTION__ " end");
  101. }
  102.  
  103. //----------------------------------------------------------------------------------------
  104. void _api::user32_initialize()
  105. {
  106. logit(__FUNCTION__);
  107. HMODULE hModuleHandle = GetModuleHandle("user32.dll");
  108. if(!hModuleHandle)
  109. logit("Something is wrong, user32.dll not found, error: %i",GetLastError());
  110. GPA_FUNC(GetCursorPos)
  111. GPA_FUNC(GetMessageA)
  112. GPA_FUNC(SetCursorPos)
  113. GPA_FUNC(FindWindowA)
  114. GPA_FUNC(MessageBoxA)
  115. logit(__FUNCTION__ " end");
  116. }
  117.  
  118. //----------------------------------------------------------------------------------------
  119. void _api::kernel32_initialize()
  120. {
  121. BEGINFUNC
  122. HMODULE hModuleHandle = ::GetModuleHandleA("kernel32.dll");
  123. if(!hModuleHandle)
  124. logit("Something is wrong, kernel32.dll not found, error: %i",GetLastError());
  125. GPA_FUNC(GetModuleHandleA)
  126. GPA_FUNC(LoadLibraryA)
  127. GPA_FUNC(FreeLibrary)
  128. GPA_FUNC(CreateThread)
  129.  
  130. //advapi32.dll
  131. hModuleHandle = ::GetModuleHandleA("advapi32.dll");
  132. if(!hModuleHandle)
  133. logit("Something is wrong, advapi32.dll not found, error: %i",GetLastError());
  134. GPA_FUNC(RegQueryValueExA)
  135. ENDFUNC
  136. }
  137.  
  138. //----------------------------------------------------------------------------------------
  139. //credits dom?
  140. bool _api::bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
  141. {
  142. for(;*szMask;++szMask,++pData,++bMask)
  143. if(*szMask=='x' && *pData!=*bMask )
  144. return false;
  145. return (*szMask) == NULL;
  146. }
  147.  
  148. //----------------------------------------------------------------------------------------
  149. DWORD _api::dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
  150. {
  151. for(DWORD i=0; i < dwLen; i++)
  152. if( bDataCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
  153. return (DWORD)(dwAddress+i);
  154.  
  155. return 0;
  156. }
  157.  
  158. //----------------------------------------------------------------------------------------
  159. //void _api::hl2_initialize()
  160. //{
  161. // BEGINFUNC
  162. // ENDFUNC
  163. //}
  164.  
  165. //----------------------------------------------------------------------------------------
  166. void _api::init()
  167. {
  168. static bool done = false;
  169. if(!done)
  170. {
  171. #ifdef _DEBUG
  172. logit("About to hook");
  173. #endif
  174. kernel32_initialize();
  175. user32_initialize();
  176.  
  177. if(!strcmp(api.mEntry.szModule,"Quake4.exe"))
  178. opengl32_initialize();
  179. done = true;
  180. #ifdef _DEBUG
  181. logit("finished initalizing original kernel32.dll & user32.dll functions");
  182. #endif
  183. }
  184. }
  185.  
  186. //----------------------------------------------------------------------------------------
  187. #ifdef NDEBUG
  188. #pragma warning(push)
  189. #pragma warning(disable: 4102)
  190.  
  191. //----------------------------------------------------------------------------------------
  192. string _api::getOgcDirFile(const char* basename)
  193. {
  194. if(strstr(basename,"..")){ return ":*?\\/<>\""; }
  195. string ret = ogcdir;
  196. return (ret+basename);
  197. }
  198.  
  199. //----------------------------------------------------------------------------------------
  200. FARPROC WINAPI _api::newGetProcAddress(__in HMODULE hModule, __in LPCSTR lpProcName )
  201. {
  202. if(HIWORD(lpProcName))
  203. {
  204. api.init();
  205. // REDIRECT_FUNC(glBegin);
  206. // REDIRECT_FUNC(glClear);
  207. REDIRECT_FUNC(glEnable)
  208. REDIRECT_FUNC(glViewport)
  209. REDIRECT_FUNC(wglSwapBuffers)
  210.  
  211. REDIRECT_FUNC(SetCursorPos)
  212. REDIRECT_FUNC(GetCursorPos)
  213. REDIRECT_FUNC(GetMessageA)
  214. REDIRECT_FUNC(GetModuleHandleA)
  215. REDIRECT_FUNC(LoadLibraryA)
  216. REDIRECT_FUNC(FreeLibrary)
  217. REDIRECT_FUNC(RegQueryValueExA)
  218.  
  219. //if(!strcmp(lpProcName,"CreateInterface"))
  220. //{
  221. // origCIF = (CreateInterfaceFn)GetProcAddress(hModule,lpProcName);
  222. // return (FARPROC)lolCreateInterface;
  223. //}
  224. //REDIRECT_FUNC(CreateThread)
  225.  
  226. if(!strcmp(lpProcName,"GetProcAddress"))
  227. {
  228. return (FARPROC)newGetProcAddress;
  229. }
  230. if( (!strcmp(lpProcName,"CreateThread")) && (!strcmp(api.mEntry.szModule,"hl.exe")) )
  231. {
  232. static bool done = false;
  233. if (!done && absoHack)
  234. {
  235. logit(VERSION);
  236. logit("Compiled on " __DATE__ " at " __TIME__);
  237. #ifdef _DEBUG
  238. logit("Found CreateThread->Initalizing Hooks");
  239. #endif
  240. //api.hl1_initialize();
  241. absoHack->FindEngineStructs();
  242. absoHack->InitializeEngineHooks();
  243. done = true;
  244. }
  245. return (FARPROC)(api.CreateThread);
  246. }
  247. #ifdef _DEBUG
  248. if(!strcmp(lpProcName,"IsDebuggerPresent"))
  249. {
  250. return NULL;
  251. }
  252. //char dllName [256]="";
  253. //GetModuleFileName(HMODULE(hModule),dllName,254);
  254. //logit("%s(\"%s\", \"%s\")",__FUNCTION__ ,dllName, lpProcName ); // hModule is first two bytes (MZ)
  255. #endif
  256. }
  257. return GetProcAddress(hModule,lpProcName);
  258. }
  259.  
  260. //----------------------------------------------------------------------------------------
  261. HMODULE _api::GetModuleHandle(__in_opt LPCSTR lpModuleName)
  262. {
  263. //logit("%s(\"%s\")",__FUNCTION__,lpModuleName);
  264. return ::GetModuleHandleA(lpModuleName);
  265. //return orig.GetModuleHandle(lpModuleName);
  266. }
  267.  
  268. //----------------------------------------------------------------------------------------
  269. HMODULE _api::LoadLibraryA(__in LPCSTR lpLibFileName)
  270. {
  271. HMODULE ret = orig.LoadLibrary(lpLibFileName);
  272. HANDLE h = GetModuleHandle(lpLibFileName);
  273.  
  274. char dllName [256]="";
  275. GetModuleFileName(HMODULE(h),dllName,254);
  276.  
  277. //logit("%s(\"%s\")",__FUNCTION__,dllName);
  278. if(!strcmp(lpLibFileName,"opengl32.dll"))
  279. {
  280. logit("OpenGL loaded! - Getting originals");
  281. api.opengl32_initialize();
  282. }
  283.  
  284. return ret;
  285. }
  286.  
  287. //----------------------------------------------------------------------------------------
  288. BOOL _api::FreeLibrary(__in HMODULE hLibModule)
  289. {
  290. //char dllName [256]="";
  291. //GetModuleFileName(HMODULE(hLibModule),dllName,254);
  292. //logit("%s(\"%s\")",__FUNCTION__,dllName);
  293. return orig.FreeLibrary(hLibModule);
  294. }
  295.  
  296. //----------------------------------------------------------------------------------------
  297. HANDLE _api::CreateThread( __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
  298. __in SIZE_T dwStackSize,
  299. __in LPTHREAD_START_ROUTINE lpStartAddress,
  300. __in_opt LPVOID lpParameter,
  301. __in DWORD dwCreationFlags,
  302. __out_opt LPDWORD lpThreadId)
  303. {
  304. HANDLE h = orig.CreateThread(lpThreadAttributes,dwStackSize,lpStartAddress,lpParameter,dwCreationFlags,lpThreadId);
  305. //logit("%s(x,%d,0x%08x,x,0x%08x)",__FUNCTION__,dwStackSize,lpStartAddress,lpThreadId);
  306. return h;
  307. }
  308.  
  309. //----------------------------------------------------------------------------------------
  310. LONG APIENTRY _api::RegQueryValueEx(__in HKEY hKey,
  311. __in_opt LPCSTR lpValueName,
  312. __reserved LPDWORD lpReserved,
  313. __out_opt LPDWORD lpType,
  314. __out_bcount_opt(*lpcbData) LPBYTE lpData,
  315. __inout_opt LPDWORD lpcbData)
  316. {
  317. LONG ret = orig.RegQueryValueEx(hKey,lpValueName,lpReserved,lpType,lpData,lpcbData);
  318. if(!strcmp(lpValueName,"EngineD3D"))
  319. {
  320. logit("You were in direct3d, changing to opengl");
  321. *lpData = 0;
  322. }
  323. //logit("%s(hKey,\"%s\",lpReserved,lpType,lpData,%d)",__FUNCTION__,lpValueName,*lpcbData);
  324. return ret;//orig.RegQueryValueEx(hKey,lpValueName,lpReserved,lpType,lpData,lpcbData);
  325. }
  326.  
  327. //----------------------------------------------------------------------------------------
  328. // IAT fun, credits: lance meh thinks
  329. // TODO: bounds checking on for loops
  330. void _api::ReDirectFunction(char* strDllName, char* strFunctionName, unsigned long funcaddr)
  331. {
  332. DWORD dwBackup,dwIndex,dwOffset;
  333. PDWORD pdwIAT,pdwINT;
  334. HMODULE hmHL; // Stores Half-Life module handle.
  335. PIMAGE_DATA_DIRECTORY pDataDirectory; // Stores Import Function Table address.
  336. PIMAGE_DOS_HEADER pDosHeader; // Holds DOS Header.
  337. PIMAGE_IMPORT_DESCRIPTOR pImportDescriptor; // Holds dll information.
  338. PIMAGE_IMPORT_BY_NAME pImportName; // Holds the function name info.
  339. PIMAGE_OPTIONAL_HEADER pOptionalHeader; // Holds the Optional Header part of PE Header.
  340. PIMAGE_NT_HEADERS pPeHeader; // Holds the PE Header.
  341. PSTR strCurrent; // Buffer used when looking for GetProcAddress.
  342.  
  343. hmHL = ::GetModuleHandle(NULL); // Get the base address of Half-Life’s program.
  344. pDosHeader = PIMAGE_DOS_HEADER(hmHL); // Fill the IMAGE_DOS_HEADER structure.
  345. dwOffset = pDosHeader->e_lfanew; // Get the offset of the PE header.
  346. pPeHeader = PIMAGE_NT_HEADERS(LONG(hmHL) + dwOffset);
  347. pOptionalHeader = &pPeHeader->OptionalHeader; // Fill the IMAGE_OPTION_HEADER structure.
  348. pDataDirectory = pOptionalHeader->DataDirectory; // Fill the IMAGE_DATA_DIRECTORY structure.
  349. dwOffset = pDataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; // Get the offset to the Import Function Table.
  350. pImportDescriptor = PIMAGE_IMPORT_DESCRIPTOR(LONG(hmHL) + dwOffset); // Fill the IMAGE_IMPORT_DESCRIPTOR structure.
  351.  
  352. for(dwIndex = 0; true; dwIndex++){ // Set up a never ending loop.
  353. dwOffset = pImportDescriptor[dwIndex].Name; // Get the offset to the dll name.
  354. strCurrent = PSTR(LONG(hmHL) + dwOffset);
  355. //logit("IMPORT: %s",strCurrent);
  356. if(_stricmp(strCurrent, strDllName) == 0)
  357. break; // If its kernel32.dll break, otherwise loop to
  358. } // the next structure.
  359.  
  360. dwOffset = pImportDescriptor[dwIndex].FirstThunk; // Get the offset to the Import Address Table.
  361. pdwIAT = PDWORD(LONG(hmHL) + dwOffset);
  362. dwOffset = pImportDescriptor[dwIndex].OriginalFirstThunk; // Get the offset to the Import Name Table.
  363. pdwINT = PDWORD(LONG(hmHL) + dwOffset);
  364.  
  365. for(dwIndex = 0; true; dwIndex++){ // Set up a never ending loop.
  366. dwOffset = pdwINT[dwIndex]; // Get the offset to the function name.
  367. pImportName = PIMAGE_IMPORT_BY_NAME(LONG(hmHL) + dwOffset);
  368. strCurrent = PSTR(pImportName->Name); // Get the current function name.
  369. //logit("IMPORT: dll->%s",strCurrent);
  370. if(_stricmp(strCurrent, strFunctionName) == 0)
  371. break; // If the name is strFunctionName break,
  372. } // otherwise loop to the next dword.
  373.  
  374. VirtualProtect(&pdwIAT[dwIndex], sizeof(DWORD), PAGE_READWRITE, &dwBackup); // Make sure we have write access.
  375. pdwIAT[dwIndex] = funcaddr;//PtrToUlong(); // Replace the address of GetProcAddress.
  376. VirtualProtect(&pdwIAT[dwIndex], sizeof(DWORD), dwBackup, &dwOffset); // Instill the original access protection.
  377. }
  378.  
  379. //----------------------------------------------------------------------------------------
  380. void _api::removeFileName(char* path)
  381. {
  382. char* pos = path+strlen(path);
  383. while(pos>=path && *pos!='\\') --pos;
  384. pos[1]=0;
  385. }
  386.  
  387. //----------------------------------------------------------------------------------------
  388. // credits retart =(
  389. BOOL GetModuleEntry( const char * szProcessName, PMODULEENTRY32 pModuleEntry32 )
  390. {
  391. HANDLE hProcess = NULL;
  392. HANDLE hModule = NULL;
  393. BOOL nResult = FALSE;
  394. PROCESSENTRY32 ProcessEntry32 = { 0 };
  395.  
  396. hProcess = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, NULL );
  397.  
  398. if( hProcess == INVALID_HANDLE_VALUE ) { return( FALSE ); }
  399. ProcessEntry32.dwSize = sizeof( PROCESSENTRY32 );
  400.  
  401. if( Process32First( hProcess, &ProcessEntry32 ) )
  402. {
  403. do
  404. {
  405. hModule = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, NULL );
  406.  
  407. if( hModule == INVALID_HANDLE_VALUE ) { return( FALSE ); }
  408. pModuleEntry32->dwSize = sizeof( MODULEENTRY32 );
  409.  
  410. if( Module32First( hModule, pModuleEntry32 ) )
  411. {
  412. do
  413. {
  414. if( strcmp( pModuleEntry32->szModule, szProcessName ) == 0 )
  415. {
  416. nResult = TRUE;
  417. }
  418. if( nResult == TRUE ) { break; }
  419. }
  420. while( Module32Next( hModule, pModuleEntry32 ) );
  421. }
  422. if( nResult == TRUE ) { break; }
  423. }
  424. while( Process32Next( hProcess, &ProcessEntry32 ) );
  425. }
  426.  
  427. CloseHandle( hProcess );
  428. CloseHandle( hModule );
  429.  
  430. return( nResult );
  431. }
  432.  
  433. //----------------------------------------------------------------------------------------
  434. BOOL APIENTRY DllMain( HINSTANCE hModule,
  435. DWORD ul_reason_for_call,
  436. LPVOID lpReserved )
  437. {
  438. switch( ul_reason_for_call )
  439. {
  440. case DLL_PROCESS_ATTACH :
  441. {
  442. // setup ogc path
  443. GetModuleFileName(hModule,api.ogcdir,254);
  444. api.removeFileName(api.ogcdir);
  445.  
  446. // setup hl path
  447. GetModuleFileName(GetModuleHandle(NULL), api.hldir, 254);
  448. api.removeFileName(api.hldir);
  449. if(!delfile)
  450. {
  451. if ( DeleteFile( api.getOgcDirFile("log.log").c_str() ) )
  452. logit("Deleted Old Log File");
  453. else
  454. logit("Failed to Delete Old Log File");
  455. if ( DeleteFile( api.getOgcDirFile("gui.log").c_str() ) )
  456. logit("Deleted Old UILog File");
  457. else
  458. logit("Failed to Delete Old UILog File");
  459. delfile = true;
  460. }
  461.  
  462. //SuspendThread(hModule);
  463.  
  464. char *engine = NULL;
  465.  
  466. typedef map< string, string > mapType;
  467. for(mapType::const_iterator it = api.injectTo.begin(); it != api.injectTo.end(); ++it)
  468. {//GetModuleBaseName, GetModuleInformation
  469. if (GetModuleEntry((*it).first.c_str(), &api.mEntry))
  470. {
  471. engine = new char[(*it).second.length()+1];
  472. strcpy_s( engine, (*it).second.length()+1, (*it).second.c_str());
  473. api.procName = (*it).first.c_str();
  474. logit("ExeName: %s, ModuleName: %s",api.mEntry.szExePath,api.mEntry.szModule);
  475. break;
  476. }
  477. }
  478. if(engine)
  479. {
  480. absoHack = new AbsoHack( engine ); // TODO: Move all this crap into AbsoHack
  481. delete engine;
  482. logit("Started AbsoHack Engine");
  483. }
  484. else
  485. {
  486. //memset(api.mEntry, 0, sizeof(api.mEntry));
  487. logit("couldn't find a valid exe to inject too, wtf m8");
  488. }
  489. //no thread notification
  490. DisableThreadLibraryCalls(hModule);
  491.  
  492. //clear our headers so paladin wont find us
  493. //srand( (unsigned)time( NULL ) );
  494. //PIMAGE_DOS_HEADER pDOSHeader = MakePtr<PIMAGE_DOS_HEADER>(hModule);
  495. //PIMAGE_NT_HEADERS pNTHeader = MakePtr<PIMAGE_NT_HEADERS>(pDOSHeader,pDOSHeader->e_lfanew);
  496. //RandomOverwrite(pDOSHeader);
  497. //RandomOverwrite(pNTHeader);
  498.  
  499. //get main module and create fake code copy
  500. //HMODULE MainModule = GetModuleHandle(NULL);
  501. //pDOSHeader = MakePtr<PIMAGE_DOS_HEADER>(MainModule);
  502. //pNTHeader = MakePtr<PIMAGE_NT_HEADERS>(pDOSHeader,pDOSHeader->e_lfanew);
  503. /*char* hl_fake_code = new char[pNTHeader->OptionalHeader.SizeOfCode];
  504. memcpy(hl_fake_code,(char*)MainModule +pNTHeader->OptionalHeader.BaseOfCode,pNTHeader->OptionalHeader.SizeOfCode);
  505. logit("fake code %s",hl_fake_code); */
  506. api.ReDirectFunction("kernel32.dll","GetProcAddress",(unsigned long)&api.newGetProcAddress);
  507. //api.ReDirectFunction("kernel32.dll","GetModuleHandleA",(unsigned long)&api.GetModuleHandle);
  508. //if(!strcmp(api.mEntry.szModule,"Quake4.exe"))
  509. //{
  510. // api.ReDirectFunction("opengl32.dll","glEnable",(unsigned long)&api.glEnable);
  511. // //api.ReDirectFunction("opengl32.dll","glTexCoord2f",(unsigned long)&api.glTexCoord2f);
  512. // //api.ReDirectFunction("opengl32.dll","glShadeModel",(unsigned long)&api.glShadeModel);
  513. // api.ReDirectFunction("opengl32.dll","glViewport",(unsigned long)&api.glViewport);
  514. // api.ReDirectFunction("GDI32.dll","SwapBuffers",(unsigned long)&api.wglSwapBuffers);
  515. //}
  516. //api.ReDirectFunction("opengl32.dll","wglGetProcAddress",(unsigned long)&api.wglGetProcAddress);
  517. //api.ReDirectFunction("opengl32.dll","wglGetPixelFormat",(unsigned long)&api.wglGetPixelFormat);
  518.  
  519. //api.ReDirectFunction("opengl32.dll","wglSwapLayerBuffers",(unsigned long)&api.wglSwapLayerBuffers);
  520. //api.ReDirectFunction("opengl32.dll","wglSwapBuffers",(unsigned long)&api.wglSwapBuffers);
  521. //api.ReDirectFunction("kernel32.dll","LoadLibraryA",(unsigned long)&test);
  522.  
  523. #ifdef NDEBUG
  524. HideModule( hModule );
  525. #endif
  526. //InterceptDllCall(MainModule, "Kernel32.dll","CreateFileA",(PVOID)&pCreateFile,(PVOID*)&CreateFilePtr,NULL);
  527. break;
  528. }
  529. case DLL_PROCESS_DETACH :
  530. {
  531. logit("Shutting down " VERSION);
  532. if(!api.apiType && orig.MessageBox)
  533. {
  534. orig.MessageBox(0,"You are in software/d3d mode, please change to opengl","Error",MB_ICONWARNING);
  535. logit("ERROR: You are in software/d3d mode, please change to opengl");
  536. }
  537. break;
  538. }
  539. case DLL_THREAD_ATTACH :
  540. {
  541. logit("DLL_THREAD_ATTACH");
  542. break;
  543. }
  544. case DLL_THREAD_DETACH :
  545. {
  546. logit("DLL_THREAD_DETACH");
  547. break;
  548. }
  549. }
  550. //logit("DllMain");
  551. return true;
  552. }
Add Comment
Please, Sign In to add comment