hlsdk

VAC packet dumper

Jul 17th, 2010
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. /*
  2. ** Quick VAC replayer. This will give a key and a command to a function, and VAC
  3. ** will reply with a result.
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <Windows.h>
  8.  
  9. int main( int argc, char** argv ) {
  10.  
  11.  
  12. UINT8 key[8] = { 0xea, 0xbe, 0xdf, 0x61, 0x62, 0xb2, 0x77, 0x11 };
  13. UINT8 outKey[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  14. UINT8 outBuf[6000];
  15. UINT32 outSize;
  16.  
  17. HMODULE hVac = LoadLibraryA("SourceInit.dat");
  18.  
  19. if (!hVac) {
  20. printf("Cannot replay - VAC module is missing.\n");
  21. return 1;
  22. }
  23.  
  24. void (*TestFcn)( UINT8* something, UINT8* key, UINT32 mysteryarg, UINT8* response, UINT32* responseSize );
  25.  
  26. UINT8* fcnPtr = (UINT8*)hVac + 0x3535;
  27. TestFcn = (void(*)(UINT8*,UINT8*,UINT32,UINT8*,UINT32*))fcnPtr;
  28.  
  29. printf("test function pointer %p\n", TestFcn);
  30.  
  31. // I don't actually know the correct parameters for this.
  32. // Just making this up as I go along.
  33. // In this test scenario the function always seems to return a 256-byte packet.
  34. TestFcn(key, outKey, 4, outBuf, &outSize);
  35.  
  36.  
  37. printf("Function finished with a buffer size of %p\n", outSize);
  38.  
  39. FILE*f = fopen("VacSamplePacket.bin","wb");
  40. if (f) {
  41. fwrite( outBuf, outSize, 1, f );
  42. fclose( f );
  43. }
  44.  
  45. return 0;
  46. }
Add Comment
Please, Sign In to add comment