Function at 0x40d5c1
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 0x40d61a
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.0040cf68
mov ecx, eax
call fcn.004014c7
mov ecx, eax
call fcn.0040cf68
mov ecx, eax
call fcn.004014c7
mov ecx, eax
call fcn.0040ba50
cmp dword [ebp + 8], edi
je 0x40d83a
cmp dword [ebp + 0xc], edi
je 0x40d83a
cmp dword [ebp + 0x10], edi
je 0x40d83a
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 0x40d665
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d863
push 1
push str._XmpSetup_can_not_find_the_resource
jmp 0x40d84c
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_SizeofResource]
mov dword [ebp + 8], eax
cmp eax, edi
jne 0x40d691
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d863
push 1
push str._XmpSetup_can_not_get_the_resources_size
jmp 0x40d84c
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_LoadResource]
mov dword [ebp - 4], eax
cmp eax, edi
jne 0x40d6bd
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d863
push 1
push str._XmpSetup_can_not_load_the_resource
jmp 0x40d84c
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov dword [ebp - 0x14], eax
cmp eax, edi
jne 0x40d6e6
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d863
push 1
push str._XmpSetup_can_not_lock_the_resource
jmp 0x40d84c
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 0x40d750
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d742
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.0040cf68
mov ecx, eax
call fcn.004013c8
mov ecx, eax
call fcn.0040ba50
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_FreeResource]
jmp 0x40d863
push edi
push edi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40d779
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d742
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_move_pointer_failed_last_error_
jmp 0x40d724
xor ebx, ebx
cmp dword [ebp + 8], edi
jbe 0x40d7f0
mov ecx, dword [ebp + 8]
sub ecx, ebx
mov eax, 0xfa000
cmp ecx, eax
ja 0x40d790
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 0x40d7b6
add ebx, dword [ebp - 0xc]
cmp ebx, dword [ebp + 8]
jb 0x40d780
jmp 0x40d7f0
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d7ed
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.0040cf68
mov ecx, eax
call fcn.004013c8
mov ecx, eax
call fcn.0040ba50
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 0x40d835
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.0040cf68
mov ecx, eax
call fcn.00401251
mov ecx, eax
call fcn.0040ba50
mov eax, dword [ebp - 8]
jmp 0x40d865
push esi
call fcn.004069f6
pop ecx
test eax, eax
jne 0x40d863
push 1
push str._XmpSetup_bad_param
push edi
push esi
call fcn.0040afdf
pop ecx
pop ecx
mov ecx, eax
call fcn.0040cf68
mov ecx, eax
call fcn.0040ba50
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret