Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. void __fastcall TForm1::Button1Click(TObject *Sender)
  2. {
  3.     OpenDialog1->Execute();
  4.     int hFile= FileOpen(OpenDialog1->FileName.c_str(),fmOpenRead);
  5.     unsigned int valor;
  6.     unsigned int checksum=0;
  7.  
  8.     //Coloco el puntero en el primer byte a modificar
  9.     FileSeek (hFile,0x10,0);
  10.  
  11.     for(int i=0;i<0x4BB0;i+=4){
  12.         FileRead(hFile, &valor, 4);
  13.         checksum += valor;
  14.     }
  15.      while(checksum > 0x100000000)
  16.             checksum -= 0x100000000;
  17.     AnsiString salida;
  18.     salida=salida.IntToHex(checksum,8);
  19.     while(salida.Length() < 8)
  20.         salida = "0" + salida;
  21.     FileClose(hFile);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement