miniminater

Code i'm stuck on

Aug 5th, 2021 (edited)
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #include <defs.h>
  2. #include <windows.h>
  3. #include <math.h>
  4. #include <stdarg.h>
  5. #include <stddef.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8.  
  9. __int64 __fastcall common_ftell<__int64>(_QWORD); // weak
  10. __int64 __fastcall common_ftell<long>(_QWORD); // weak
  11. void *__cdecl j__malloc_base(size_t Size);
  12. void __cdecl j__free_base(void *Block);
  13.  
  14. void *__fastcall sub_180093880(size_t *a1, const char *a2)
  15. {
  16.   FILE *v3; // rax
  17.   FILE *v4; // rdi
  18.   size_t v5; // rbp
  19.   void *v6; // rsi
  20.   size_t v7; // rbx
  21.   void *result; // rax
  22.  
  23.   if ( !a2 )
  24.     return 0i64;
  25.   v3 = fopen(a2, "rb");
  26.   v4 = v3;
  27.   if ( !v3 )
  28.     return 0i64;
  29.   fseek(v3, 0, 2);
  30.   v5 = (int)common_ftell<long>(v4);
  31.   fseek(v4, 0, 0);
  32.   v6 = j__malloc_base(v5);
  33.   v7 = fread(v6, 1ui64, v5, v4);
  34.   ftell(v4);
  35.   if ( v7 == v5 )
  36.   {
  37.     *a1 = v5;
  38.     result = v6;
  39.   }
  40.   else
  41.   {
  42.     j__free_base(v6);
  43.     result = 0i64;
  44.   }
  45.   return result;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment