Advertisement
pushrbx

Untitled

Jul 23rd, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. int _tmain(int argc, _TCHAR* argv[])
  2. {
  3.     GFXDllCreateObject = NULL;
  4.     GFXDllReleaseObject = NULL;
  5.     dwEax_setup = 0;
  6.     dwEbx_setup = 0;
  7.     dwEcx_setup = 0;
  8.     dwEdx_setup = 0;
  9.     bInit = false;
  10.     bLoaded = false;
  11.     pGFXAccess = NULL;
  12.     hDLL = NULL;
  13.  
  14.     memset(loadPk2Filename, 0, MAX_PATH + 1);
  15.  
  16.     if(Initialize() == 0)
  17.     {
  18.         bool bOpened = Open("d:\\Documents\\seeroad\\SilkRoad_TestIn\\Media.pk2", "169841", 6);
  19.         if(bOpened)
  20.         {
  21.             // test the gefilesize function with index -1
  22.             __asm pushad
  23.  
  24.             // first we need a dword pointer
  25.             DWORD dwHigh = 0;
  26.             LPDWORD pdwHigh = &dwHigh;
  27.             // next we need the index
  28.             DWORD index = 1;
  29.             DWORD fsize = 0;
  30.             FARPROC gfxgetfilesize = pGFXAccess->vtable->functions[35];
  31.             LPVOID ptr1 = pGFXAccess;
  32.  
  33.             __asm
  34.             {
  35.                 push pdwHigh
  36.                 push index
  37.                 push ptr1
  38.                 call gfxgetfilesize
  39.  
  40.                 mov fsize, eax
  41.             }
  42.  
  43.             cout << "GfxGetFileSize returned " << fsize << "." << endl;
  44.             cout << "GfxGetFileSize high order" << dwHigh << "." << endl;
  45.  
  46.             __asm popad
  47.         }
  48.     }
  49.  
  50.     Deinitialize();
  51.  
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement