Function at 0x40f977
Capabilities:
Extract resource via kernel32 functions
Get common file path
Get disk size
Write file on windows

Disassembly:
mov eax, 0x42f5d9
call fcn.00414ad0
sub esp, 0x470
mov eax, dword [0x43dde0]
push ebx
push esi
mov dword [ebp - 0x10], eax
push edi
mov eax, dword [ebp + 0xc]
xor ebx, ebx
cmp dword [ebp + 0x20], 8
mov dword [ebp - 4], ebx
mov byte [ebp - 0x43d], bl
jae 0x40f9a9
lea eax, [ebp + 0xc]
push dword [ebp + 0x28]
movzx ecx, word [ebp + 0x24]
push ecx
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_FindResourceExW]
mov esi, eax
cmp esi, ebx
je 0x40fc23
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_SizeofResource]
push esi
push ebx
mov dword [ebp + 0x24], eax
call dword [sym.imp.KERNEL32.dll_LoadResource]
cmp dword [ebp + 0x24], ebx
je 0x40fc23
cmp eax, ebx
je 0x40fc23
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
cmp eax, ebx
mov dword [ebp - 0x44c], eax
je 0x40fc23
lea eax, [ebp - 0x43c]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
test eax, eax
je 0x40fc11
lea eax, [ebp - 0x234]
push eax
push ebx
push 0x431360
lea eax, [ebp - 0x43c]
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
test eax, eax
je 0x40fc11
push ebx
push 0x80
push 2
push ebx
push ebx
push 0x40000000
lea eax, [ebp - 0x234]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [ebp - 0x444], eax
je 0x40fbff
mov esi, dword [ebp + 0x30]
xor edi, edi
cmp dword [ebp + 0x24], ebx
mov byte [ebp + 0x2b], 1
mov dword [ebp - 0x454], 0x800
mov dword [ebp - 0x448], ebx
jbe 0x40fb74
cmp byte [ebp + 0x2b], bl
je 0x40fb74
mov eax, dword [ebp - 0x454]
lea ecx, [edi + eax]
mov eax, dword [ebp + 0x24]
cmp ecx, eax
jb 0x40faa6
sub eax, edi
mov dword [ebp - 0x454], eax
mov eax, dword [ebp - 0x44c]
push ebx
lea ecx, [ebp - 0x448]
push ecx
push dword [ebp - 0x454]
add eax, edi
push eax
push dword [ebp - 0x444]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40fb16
add edi, dword [ebp - 0x448]
cmp esi, ebx
je 0x40fb0b
mov edx, dword [esi]
push ebx
lea ecx, [ebp - 0x234]
push ecx
xor eax, eax
push eax
push dword [ebp + 0x24]
mov ecx, esi
push eax
push edi
call dword [edx]
cmp al, bl
mov byte [ebp + 0x2b], al
jne 0x40fb0b
mov edx, dword [esi]
push 6
lea eax, [ebp - 0x234]
push eax
xor eax, eax
push eax
push dword [ebp + 0x24]
mov ecx, esi
push eax
push edi
call dword [edx]
cmp edi, dword [ebp + 0x24]
jb 0x40fa85
jmp 0x40fb74
lea eax, [ebp - 0x458]
push eax
lea eax, [ebp - 0x460]
push eax
lea eax, [ebp - 0x450]
push eax
lea eax, [ebp - 0x234]
push eax
call dword [sym.imp.KERNEL32.dll_GetDiskFreeSpaceExW]
test eax, eax
je 0x40fb5b
mov eax, dword [ebp + 0x24]
mov ecx, dword [ebp - 0x44c]
sub eax, edi
cmp ecx, ebx
ja 0x40fb5b
jb 0x40fb57
mov ecx, dword [ebp - 0x450]
cmp ecx, eax
jae 0x40fb5b
push 3
jmp 0x40fb61
cmp esi, ebx
je 0x40fb74
push 2
mov eax, dword [esi]
lea ecx, [ebp - 0x234]
push ecx
push ebx
push dword [ebp + 0x24]
mov ecx, esi
push ebx
push edi
call dword [eax]
push dword [ebp - 0x444]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp edi, dword [ebp + 0x24]
sete byte [ebp - 0x43d]
cmp byte [ebp - 0x43d], bl
je 0x40fc23
lea eax, [ebp - 0x234]
push eax
lea ecx, [ebp - 0x47c]
call fcn.00404849
lea eax, [ebp - 0x47c]
push eax
lea ecx, [ebp - 0x2c]
mov byte [ebp - 4], 1
call fcn.00401506
push ebx
push 1
lea ecx, [ebp - 0x47c]
mov byte [ebp - 4], 3
call fcn.0040111c
mov ecx, dword [ebp + 0x2c]
lea eax, [ebp - 0x2c]
push eax
call fcn.0040f94c
cmp esi, ebx
je 0x40fbf2
mov eax, dword [esi]
push 1
lea ecx, [ebp - 0x234]
push ecx
push ebx
push dword [ebp + 0x24]
mov ecx, esi
push ebx
push edi
call dword [eax]
lea ecx, [ebp - 0x2c]
mov byte [ebp - 4], bl
call fcn.0040f8e8
jmp 0x40fc23
mov ecx, dword [ebp + 0x30]
cmp ecx, ebx
je 0x40fc23
push 2
lea edx, [ebp - 0x234]
push edx
jmp 0x40fc1b
mov ecx, dword [ebp + 0x30]
cmp ecx, ebx
je 0x40fc23
push 4
push ebx
mov eax, dword [ecx]
push ebx
push ebx
push ebx
push ebx
call dword [eax]
push ebx
push 1
lea ecx, [ebp + 8]
call fcn.0040111c
mov ecx, dword [ebp - 0xc]
mov al, byte [ebp - 0x43d]
pop edi
pop esi
mov dword fs:[0], ecx
mov ecx, dword [ebp - 0x10]
pop ebx
call fcn.004145de
leave
ret