hatstand

Untitled

Nov 10th, 2023 (edited)
1,678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.58 KB | None | 0 0
  1. uint __thiscall CFile::DecryptFile(CFile *this,int buffer,undefined4 length)
  2. {
  3.   uint data;
  4.   uint character;
  5.   int x;
  6.   int y;
  7.  
  8.   CheckFileHeader((cFile *)this);
  9.   data = Read((CFile *)this,buffer,length);
  10.   if ((this[0x20] != (CFile)0x0) && (character = 0, data != 0)) {
  11.     do {
  12.       y = *(int *)(this + 0x1c);
  13.       x = *(int *)(this + 0x18);
  14.       *(byte *)(character + buffer) =
  15.            *(byte *)(character + buffer) ^ "theocracy sux"[x] ^ "mutant technology"[y];
  16.       *(uint *)(this + 0x18) = (x + 1U) % 0xd;
  17.       character = character + 1;
  18.       *(uint *)(this + 0x1c) = (y + 1U) % 0x11;
  19.     } while (character < data);
  20.   }
  21.   Close(this);
  22.   return data;
  23. }
  24.  
  25. undefined4 __fastcall CFile::CheckFileHeader(cFile *path)
  26. {
  27.   undefined4 file;
  28.   uint index;
  29.   int address;
  30.   char file_header [8];
  31.   char error_message [1024];
  32.  
  33.   file = OpenR(path);
  34.   if ((char)file == '\0') {
  35.     return file;
  36.   }
  37.   Read((CFile *)path,file_header,7);
  38.   index = 0;
  39.   do {
  40.     if (file_header[index] != "RSA4096"[index]) {
  41.       path[0x20] = (cFile)0x0;
  42.       sprintf(error_message,s_Unknown_textfile_format!_%s_005e01d0,*(undefined4 *)(path + 0x14));
  43.       die(error_message);
  44.       file = SeekB((CFile *)path,0);
  45.       return CONCAT31((int3)((uint)file >> 8),1);
  46.     }
  47.     index = index + 1;
  48.   } while (index < 7);
  49.   path[0x20] = (cFile)0x1;
  50.   address = SeekIgnoreHeader((CFile *)path,0); //Always uses 0 for "index"
  51.   return CONCAT31((int3)((uint)address >> 8),1);
  52. }
  53.  
  54. int __thiscall CFile::SeekIgnoreHeader(CFile *this,uint start)
  55. {
  56.   int index;
  57.  
  58.   if (this[0x20] != (CFile)0x0) {
  59.     index = SeekB((CFile *)this,start + 7);
  60.     *(uint *)(this + 0x18) = start % 0xd;
  61.     *(uint *)(this + 0x1c) = start % 0x11;
  62.     return index + -7;
  63.   }
  64.   index = SeekB((CFile *)this,start);
  65.   return index;
  66. }
  67.  
  68. void __thiscall CFile::SeekB(CFile *this,undefined4 param_1)
  69. {
  70.   bool bVar1;
  71.  
  72.   bVar1 = isOpen(this);
  73.   if (!bVar1) {
  74.     die(s_cFile::SeekB_file_is_not_open_005e0130);
  75.   }
  76.   (**(code **)(**(int **)(this + 0xc) + 0x10))(param_1,0);
  77.   return;
  78. }
  79.  
  80. void __thiscall CFile::Read(CFile *this,undefined4 buffer,undefined4 length)
  81. {
  82.   int iVar1;
  83.   bool isOpen;
  84.   undefined4 uStack_10;
  85.  
  86.   isOpen = CFile::isOpen(this);
  87.   if (!isOpen) {
  88.     uStack_10 = 0x54a567;
  89.     die(s_cFile::Read_file_is_not_open_005e0190);
  90.   }
  91.   iVar1 = **(int **)(this + 0xc);
  92.   uStack_10 = length;
  93.   FUN_005674e0(&uStack_10,buffer);
  94.   (**(code **)(iVar1 + 0x14))();
  95.   return;
  96. }
  97.  
  98. void __thiscall FUN_005674e0(void *this,undefined4 param_1)
  99. {
  100.   *(undefined4 *)this = param_1;
  101.   return;
  102. }
Advertisement