Function at 0x40d0f4
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.0040663e
xor edi, edi
test eax, eax
pop ecx
jne 0x40d14d
push 1
push dword [ebp + 0x10]
push str._lpSaveName
push dword [ebp + 0xc]
push str._XmpSetup_SaveResAs_lpType
push edi
push esi
call fcn.0040a806
pop ecx
pop ecx
mov ecx, eax
call fcn.0040ca6a
mov ecx, eax
call fcn.0040133c
mov ecx, eax
call fcn.0040ca6a
mov ecx, eax
call fcn.0040133c
mov ecx, eax
call fcn.0040b2e1
cmp dword [ebp + 8], edi
je 0x40d36d
cmp dword [ebp + 0xc], edi
je 0x40d36d
cmp dword [ebp + 0x10], edi
je 0x40d36d
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 0x40d198
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d396
push 1
push str._XmpSetup_can_not_find_the_resource
jmp 0x40d37f
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_SizeofResource]
cmp eax, edi
mov dword [ebp + 8], eax
jne 0x40d1c4
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d396
push 1
push str._XmpSetup_can_not_get_the_resources_size
jmp 0x40d37f
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_LoadResource]
cmp eax, edi
mov dword [ebp - 4], eax
jne 0x40d1f0
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d396
push 1
push str._XmpSetup_can_not_load_the_resource
jmp 0x40d37f
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
cmp eax, edi
mov dword [ebp - 0x14], eax
jne 0x40d219
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d396
push 1
push str._XmpSetup_can_not_lock_the_resource
jmp 0x40d37f
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]
cmp eax, 0xffffffff
mov dword [ebp - 0x10], eax
jne 0x40d259
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d29e
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_create_file_failed_last_error_
jmp 0x40d280
push edi
push edi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40d2ac
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d29e
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_move_pointer_failed_last_error_
push edi
push esi
call fcn.0040a806
pop ecx
pop ecx
mov ecx, eax
call fcn.0040ca6a
mov ecx, eax
call fcn.0040123d
mov ecx, eax
call fcn.0040b2e1
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_FreeResource]
jmp 0x40d396
xor ebx, ebx
cmp dword [ebp + 8], edi
jbe 0x40d323
mov ecx, dword [ebp + 8]
sub ecx, ebx
mov eax, 0xfa000
cmp ecx, eax
ja 0x40d2c3
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 0x40d2e9
add ebx, dword [ebp - 0xc]
cmp ebx, dword [ebp + 8]
jb 0x40d2b3
jmp 0x40d323
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d320
push 1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_save_resource_failed_lasterror
push edi
push esi
call fcn.0040a806
pop ecx
pop ecx
mov ecx, eax
call fcn.0040ca6a
mov ecx, eax
call fcn.0040123d
mov ecx, eax
call fcn.0040b2e1
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.0040663e
test eax, eax
pop ecx
jne 0x40d368
push 1
push dword [ebp - 8]
push str._XmpSetup_save_resource_result
push edi
push esi
call fcn.0040a806
pop ecx
pop ecx
mov ecx, eax
call fcn.0040ca6a
mov ecx, eax
call fcn.004010c6
mov ecx, eax
call fcn.0040b2e1
mov eax, dword [ebp - 8]
jmp 0x40d398
push esi
call fcn.0040663e
test eax, eax
pop ecx
jne 0x40d396
push 1
push str._XmpSetup_bad_param
push edi
push esi
call fcn.0040a806
pop ecx
pop ecx
mov ecx, eax
call fcn.0040ca6a
mov ecx, eax
call fcn.0040b2e1
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret