#include "rosecrypt.hpp" int buildChecksum(char* csum, char* path) { char buf[0x200]; int bytesread=0; HANDLE fh; if (path==0) path = "TRose.exe"; fh = CreateFileA( path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 80, NULL ); if ( fh == INVALID_HANDLE_VALUE ) return -1; SetFilePointer(fh, -512, NULL, FILE_END); ReadFile(fh, buf, 0x200, (LPDWORD)&bytesread, NULL); CloseHandle(fh); if (bytesread!=0x200) return -2; short keylen = buf[0x0f]; char* key = new char[keylen+1]; unsigned short key_ct[] = {0x94, 0x20, 0x5F, 0x53, 0x14, 0xF2, 0x61, 0x11, 0x54, 0xFF, 0x72, 0x99, 0x44, 0xF4, 0xA1, 0xAA, 0xBA, 0xC2, 0x54, 0x52, 0x6F, 0x73, 0x65, 0x2E, 0x65, 0x78, 0x65}; for(int i=0; i0; i--) { int tmp = (key[i-1]-0x30)*multiplier; multiplier *= 0x0a; csumlen += tmp; } delete [] key; unsigned short csumtable[] = {0x34, 0x5C, 0x3D, 0x52, 0xCE, 0xF3, 0x12, 0xD4, 0x05, 0x91, 0xEE, 0xFF, 0x49, 0xC2, 0xD2}; int tmp=0; for(int i=0; i