Function at 0x40d5d0
Capabilities:
Extract resource via kernel32 functions
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push ebx
push esi
push edi
mov esi, str.ToolBox_XmpSetup::SaveResAs
push esi
call fcn.004069f6
xor edi, edi
pop ecx
test eax, eax
jne 0x40d629
push 1
push dword [ebp + 0x10]
push str._lpSaveName
push dword [ebp + 0xc]
push str._XmpSetup_SaveResAs_lpType
push edi
push esi
call fcn.0040afdf
pop ecx
pop ecx
mov ecx, eax
call fcn.0040cf77
mov ecx, eax
call fcn.004014c7
mov ecx, eax
call fcn.0040cf77
mov ecx, eax
call fcn.004014c7
mov ecx, eax
call fcn.0040ba5f
cmp dword [ebp + 8], edi
je 0x40d849
cmp dword [ebp + 0xc], edi
je 0x40d849
cmp dword [ebp + 0x10], edi
je 0x40d849
push dword [ebp + 0xc]
push dword [ebp + 8]
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_FindResourceW]
mov ebx, eax
cmp ebx, edi
jne 0x40d674
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d872
push 1
push str._XmpSetup_can_not_find_the_resource
jmp 0x40d85b
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_SizeofResource]
mov dword [ebp + 8], eax
cmp eax, edi
jne 0x40d6a0
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d872
push 1
push str._XmpSetup_can_not_get_the_resources_size
jmp 0x40d85b
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_LoadResource]
mov dword [ebp - 4], eax
cmp eax, edi
jne 0x40d6cc
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d872
push 1
push str._XmpSetup_can_not_load_the_resource
jmp 0x40d85b
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov dword [ebp - 0x14], eax
cmp eax, edi
jne 0x40d6f5
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d872
push 1
push str._XmpSetup_can_not_lock_the_resource
jmp 0x40d85b
push edi
push 0x80
push 2
push edi
xor ebx, ebx
inc ebx
push ebx
push 0x40000000
push dword [ebp + 0x10]
mov dword [ebp - 8], ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x10], eax
cmp eax, 0xffffffff
jne 0x40d75f
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d751
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_create_file_failed_last_error_
push edi
push esi
call fcn.0040afdf
pop ecx
pop ecx
mov ecx, eax
call fcn.0040cf77
mov ecx, eax
call fcn.004013c8
mov ecx, eax
call fcn.0040ba5f
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_FreeResource]
jmp 0x40d872
push edi
push edi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40d788
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d751
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_move_pointer_failed_last_error_
jmp 0x40d733
xor ebx, ebx
cmp dword [ebp + 8], edi
jbe 0x40d7ff
mov ecx, dword [ebp + 8]
sub ecx, ebx
mov eax, 0xfa000
cmp ecx, eax
ja 0x40d79f
mov eax, ecx
push edi
lea ecx, [ebp - 0xc]
push ecx
push eax
mov eax, dword [ebp - 0x14]
add eax, ebx
push eax
push dword [ebp - 0x10]
mov dword [ebp - 0xc], edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40d7c5
add ebx, dword [ebp - 0xc]
cmp ebx, dword [ebp + 8]
jb 0x40d78f
jmp 0x40d7ff
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d7fc
push 1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_save_resource_failed_lasterror
push edi
push esi
call fcn.0040afdf
pop ecx
pop ecx
mov ecx, eax
call fcn.0040cf77
mov ecx, eax
call fcn.004013c8
mov ecx, eax
call fcn.0040ba5f
mov dword [ebp - 8], edi
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_FreeResource]
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d844
push 1
push dword [ebp - 8]
push str._XmpSetup_save_resource_result
push edi
push esi
call fcn.0040afdf
pop ecx
pop ecx
mov ecx, eax
call fcn.0040cf77
mov ecx, eax
call fcn.00401251
mov ecx, eax
call fcn.0040ba5f
mov eax, dword [ebp - 8]
jmp 0x40d874
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d872
push 1
push str._XmpSetup_bad_param
push edi
push esi
call fcn.0040afdf
pop ecx
pop ecx
mov ecx, eax
call fcn.0040cf77
mov ecx, eax
call fcn.0040ba5f
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret