Function at 0x474760
Capabilities:
Check if file exists
Delete file
Get common file path
Get file attributes
Read file on windows
Write file on windows

Disassembly:
push edi
lea edi, [esp + 8]
and esp, 0xfffffff8
push dword [edi - 4]
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x660
mov edx, dword [0x76d164]
test edx, edx
je 0x474ec9
mov eax, dword [0x76d160]
test eax, eax
je 0x474ec9
lea ebx, [ebp - 0x420]
mov dword [esp], 0x104
mov dword [esp + 4], ebx
call dword [sym.imp.kernel32.dll_GetTempPathA]
sub esp, 8
mov edi, eax
call fcn.0057d110
mov esi, dword fs:[0x18]
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11ad
mov eax, dword [esi + 0x34]
mov dword [esp], edi
mov dword [esp + 8], eax
mov dword [esp + 4], str.OpenFileById:_GetTempPath_failed__got_error__lu._n
call fcn.0045bef0
lea eax, [ebp - 0x31c]
mov dword [esp], ebx
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0
mov dword [esp + 4], 0x597f3c
call dword [sym.imp.kernel32.dll_GetTempFileNameA]
sub esp, 0x10
mov edi, eax
mov eax, 0x11b1
call fcn.0045b740
mov eax, dword [esi + 0x34]
mov dword [esp], edi
mov dword [esp + 4], str.OpenFileById:_GetTempFileNameA_failed__got_error__lu._n
mov dword [esp + 8], eax
call fcn.0045bef0
lea eax, [ebp - 0x31c]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_GetFileAttributesA]
sub esp, 4
mov edi, eax
mov eax, 0x11b3
call fcn.0045b740
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.OpenFileById:_GetFileAttributesA_failed_to_find_the_temp_file__got_error__lu_n
mov dword [esp + 8], eax
xor eax, eax
cmp edi, 0xffffffff
setne al
mov dword [esp], eax
call fcn.0045bef0
mov dword [esp], ebx
call dword [sym.imp.msvcrt.dll_strlen]
lea ecx, [ebp - 0x218]
mov dword [esp + 0x14], 0x104
mov dword [esp + 0x10], ecx
lea ecx, [ebp - 0x31c]
add eax, ecx
mov dword [esp + 0xc], 0xffffffff
mov dword [esp + 8], eax
mov dword [esp + 4], 0
mov dword [esp], 0
call dword [sym.imp.kernel32.dll_MultiByteToWideChar]
sub esp, 0x18
mov edi, eax
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11b7
mov eax, dword [esi + 0x34]
mov dword [esp], edi
sub edi, 1
mov dword [esp + 8], eax
mov dword [esp + 4], str.OpenFileById:_MultiByteToWideChar_failed_to_convert_tempFileName__got_error__lu._n
call fcn.0045bef0
mov ecx, dword [sym.imp.kernel32.dll_CreateFileA]
lea eax, [ebp - 0x31c]
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 3
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0x40000000
mov dword [esp], eax
mov dword [ebp - 0x648], ecx
call ecx
sub esp, 0x1c
mov dword [ebp - 0x640], eax
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11bb
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.OpenFileById:_failed_to_create_a_temp_file__got_error__lu._n
mov dword [esp + 8], eax
xor eax, eax
cmp dword [ebp - 0x640], 0xffffffff
setne al
mov dword [esp], eax
call fcn.0045bef0
call dword [sym.imp.kernel32.dll_GetTickCount]
lea ecx, [ebp - 0x520]
mov dword [esp + 4], 0x59c334
mov dword [esp], ecx
mov dword [esp + 8], eax
call fcn.0045b160
lea ecx, [ebp - 0x63c]
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], ecx
lea ecx, [ebp - 0x520]
mov dword [esp + 4], ecx
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x640]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_WriteFile]
sub esp, 0x14
mov dword [ebp - 0x644], eax
mov eax, 0x11bf
call fcn.0045b740
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.OpenFileById:_WriteFile_failed__got_error__lu._n
mov dword [esp + 8], eax
mov edx, dword [ebp - 0x644]
mov dword [esp], edx
call fcn.0045bef0
mov eax, dword [ebp - 0x640]
mov dword [esp], eax
mov eax, dword [sym.imp.kernel32.dll_CloseHandle]
mov dword [ebp - 0x64c], eax
call eax
sub esp, 4
mov dword [esp], ebx
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], 0x2000000
mov dword [esp + 0x10], 3
mov dword [esp + 0xc], 0
mov dword [esp + 8], 7
mov dword [esp + 4], 0x80000000
mov ecx, dword [ebp - 0x648]
call ecx
sub esp, 0x1c
mov ebx, eax
mov dword [ebp - 0x640], eax
mov eax, 0x11c4
call fcn.0045b740
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.OpenFileById:_failed_to_open_the_temp_folder__got_error__lu._n
mov dword [esp + 8], eax
xor eax, eax
cmp ebx, 0xffffffff
setne al
mov dword [esp], eax
call fcn.0045bef0
lea eax, [ebp - 0x620]
mov dword [esp], ebx
mov dword [esp + 0xc], 0x100
mov dword [esp + 8], eax
mov dword [esp + 4], 0xa
call dword [0x76d164]
sub esp, 0x10
mov ebx, eax
mov eax, 0x11ca
call fcn.0045b740
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str.OpenFileById:_failed_to_query_for_FileIdBothDirectoryInfo__got_error__lu._n
mov dword [esp], ebx
mov dword [esp + 8], eax
call fcn.0045bef0
mov eax, 0x11cb
call fcn.0045b740
xor eax, eax
cmp dword [ebp - 0x5e4], 2
mov edx, dword [esi + 0x34]
je 0x474eb7
mov dword [esp + 8], edx
mov dword [esp], eax
mov dword [esp + 4], str.OpenFileById:_failed_to_return_the_temp_folder_at_the_first_entry__got_error__lu._n
call fcn.0045bef0
mov eax, dword [ebp - 0x5c0]
mov edx, dword [ebp - 0x5bc]
mov dword [ebp - 0x638], 0x18
mov dword [ebp - 0x634], 0
mov dword [ebp - 0x630], eax
lea eax, [ebp - 0x638]
mov dword [ebp - 0x62c], edx
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 7
mov dword [esp + 8], 0x80000000
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x640]
mov dword [esp], eax
call dword [0x76d160]
mov ebx, dword [0x8f0770]
sub esp, 0x18
mov esi, eax
call fcn.0057d110
mov ecx, dword [eax + 0x10]
mov dword [eax + 0x14], 1
lea edx, [ecx + ecx]
xor ecx, ecx
test ebx, ebx
setne cl
or edx, ecx
mov dword [eax + 0x10], edx
mov ebx, dword fs:[0x18]
jmp 0x474bb1
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11d4
mov eax, dword [ebx + 0x34]
mov dword [esp + 4], str.OpenFileById:_failed_to_open_the_temp_folder_itself__got_error__lu._n
mov dword [esp + 8], eax
xor eax, eax
cmp esi, 0xffffffff
setne al
mov dword [esp], eax
call fcn.0045bef0
call fcn.0057d110
shr dword [eax + 0x10], 1
call fcn.0057d110
mov edx, dword [eax + 0x14]
mov dword [eax + 0x14], 0
test edx, edx
jne 0x474b78
mov dword [ebp - 0x648], edx
lea ebx, [ebp - 0x620]
mov dword [esp], esi
mov eax, dword [ebp - 0x64c]
call eax
mov eax, dword fs:[0x18]
mov dword [ebp - 0x644], eax
sub esp, 4
lea esi, [esi]
lea eax, [ebp - 0x620]
mov dword [esp + 0xc], 0x100
mov dword [esp + 8], eax
mov dword [esp + 4], 0xa
mov eax, dword [ebp - 0x640]
mov dword [esp], eax
call dword [0x76d164]
sub esp, 0x10
mov esi, eax
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11dc
mov eax, dword [ebp - 0x644]
mov eax, dword [eax + 0x34]
mov dword [esp + 4], str.OpenFileById:_failed_to_query_for_FileIdBothDirectoryInfo__got_error__lu._n
mov dword [esp], esi
mov dword [esp + 8], eax
call fcn.0045bef0
test esi, esi
je 0x474eeb
lea ebx, [ebp - 0x620]
jmp 0x474c68
mov eax, dword [ebx]
test eax, eax
je 0x474bf0
add ebx, eax
mov eax, dword [ebx + 0x3c]
mov edx, eax
shr edx, 1
cmp edx, edi
jne 0x474c60
mov dword [esp + 8], eax
lea eax, [ebx + 0x68]
mov dword [esp + 4], eax
lea eax, [ebp - 0x218]
mov dword [esp], eax
call sub.msvcrt.dll_memcmp
test eax, eax
jne 0x474c60
mov edx, dword [ebp - 0x648]
mov esi, 1
mov dword [ebp - 0x644], edx
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11ed
mov dword [esp], esi
mov dword [esp + 4], str.OpenFileById:_failed_to_find_the_temp_file_in_the_temp_folder._n
mov edi, dword fs:[0x18]
call fcn.0045bef0
mov dword [edi + 0x34], 0xdeadbeef
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 7
mov dword [esp + 8], 0x80000000
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x640]
mov dword [esp], eax
call dword [0x76d160]
sub esp, 0x18
mov esi, eax
mov eax, 0x11f1
call fcn.0045b740
cmp esi, 0xffffffff
mov eax, dword [edi + 0x34]
mov edx, dword [ebp - 0x644]
je 0x474ef6
mov dword [esp + 8], eax
mov dword [esp], edx
mov dword [esp + 4], str.OpenFileById:_expected_ERROR_INVALID_PARAMETER__got_error__lu._n
mov edi, dword fs:[0x18]
call fcn.0045bef0
mov eax, dword [ebx + 0x60]
mov edx, dword [ebx + 0x64]
mov dword [ebp - 0x638], 0x18
mov dword [ebp - 0x634], 0
mov dword [ebp - 0x630], eax
lea eax, [ebp - 0x638]
mov dword [ebp - 0x62c], edx
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 7
mov dword [esp + 8], 0x80000000
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x640]
mov dword [esp], eax
call dword [0x76d160]
sub esp, 0x18
mov ebx, eax
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11f8
mov eax, dword [edi + 0x34]
mov dword [esp + 4], str.OpenFileById:_failed_to_open_the_file__got_error__lu._n
mov dword [esp + 8], eax
xor eax, eax
cmp ebx, 0xffffffff
setne al
mov dword [esp], eax
call fcn.0045bef0
lea ecx, [ebp - 0x63c]
mov dword [esp], ebx
mov dword [esp + 0xc], ecx
lea ecx, [ebp - 0x620]
mov dword [esp + 4], ecx
mov dword [esp + 0x10], 0
mov dword [esp + 8], 0x100
call dword [sym.imp.kernel32.dll_ReadFile]
mov esi, eax
mov eax, dword [ebp - 0x63c]
sub esp, 0x14
mov byte [ebp + eax - 0x620], 0
call fcn.0057d110
mov dword [eax], 0x597dfd
mov dword [eax + 4], 0x11fc
mov eax, dword [edi + 0x34]
mov dword [esp], esi
mov dword [esp + 8], eax
mov dword [esp + 4], str.OpenFileById:_ReadFile_failed__got_error__lu._n
call fcn.0045bef0
mov eax, 0x11fd
call fcn.0045b740
lea ecx, [ebp - 0x620]
mov dword [esp + 4], ecx
lea ecx, [ebp - 0x520]
mov dword [esp], ecx
call dword [sym.imp.msvcrt.dll_strcmp]
mov dword [esp + 4], str.OpenFileById:_invalid_contents_of_the_temp_file._n
test eax, eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.0045bef0
mov dword [esp], ebx
mov esi, dword [ebp - 0x64c]
call esi
mov eax, dword [ebp - 0x640]
sub esp, 4
mov dword [esp], eax
call esi
lea eax, [ebp - 0x31c]
sub esp, 4
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_DeleteFileA]
sub esp, 4
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
lea esp, [edi - 8]
pop edi
ret
xor eax, eax
cmp word [ebp - 0x5b8], 0x2e
sete al
jmp 0x474aca
mov eax, 0x11a8
call fcn.0045b740
mov dword [esp], str.GetFileInformationByHandleEx_or_OpenFileById_is_missing._n
call fcn.0045bec0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
lea esp, [edi - 8]
pop edi
ret
mov edx, dword [ebp - 0x648]
jmp 0x474c9b
xor edx, edx
cmp eax, 0x57
sete dl
jmp 0x474d29