Function at 0x40d015
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.0040655f
xor edi, edi
test eax, eax
pop ecx
jne 0x40d06e
push 1
push dword [ebp + 0x10]
push str._lpSaveName
push dword [ebp + 0xc]
push str._XmpSetup_SaveResAs_lpType
push edi
push esi
call fcn.0040a727
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c98b
mov ecx, eax
call fcn.0040133c
mov ecx, eax
call fcn.0040c98b
mov ecx, eax
call fcn.0040133c
mov ecx, eax
call fcn.0040b202
cmp dword [ebp + 8], edi
je 0x40d28e
cmp dword [ebp + 0xc], edi
je 0x40d28e
cmp dword [ebp + 0x10], edi
je 0x40d28e
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 0x40d0b9
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d2b7
push 1
push str._XmpSetup_can_not_find_the_resource
jmp 0x40d2a0
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_SizeofResource]
cmp eax, edi
mov dword [ebp + 8], eax
jne 0x40d0e5
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d2b7
push 1
push str._XmpSetup_can_not_get_the_resources_size
jmp 0x40d2a0
push ebx
push dword [ebp + 0x14]
call dword [sym.imp.KERNEL32.dll_LoadResource]
cmp eax, edi
mov dword [ebp - 4], eax
jne 0x40d111
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d2b7
push 1
push str._XmpSetup_can_not_load_the_resource
jmp 0x40d2a0
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
cmp eax, edi
mov dword [ebp - 0x14], eax
jne 0x40d13a
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d2b7
push 1
push str._XmpSetup_can_not_lock_the_resource
jmp 0x40d2a0
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 0x40d17a
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d1bf
push ebx
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_create_file_failed_last_error_
jmp 0x40d1a1
push edi
push edi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x40d1cd
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d1bf
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.0040a727
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c98b
mov ecx, eax
call fcn.0040123d
mov ecx, eax
call fcn.0040b202
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_FreeResource]
jmp 0x40d2b7
xor ebx, ebx
cmp dword [ebp + 8], edi
jbe 0x40d244
mov ecx, dword [ebp + 8]
sub ecx, ebx
mov eax, 0xfa000
cmp ecx, eax
ja 0x40d1e4
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 0x40d20a
add ebx, dword [ebp - 0xc]
cmp ebx, dword [ebp + 8]
jb 0x40d1d4
jmp 0x40d244
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d241
push 1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._XmpSetup_save_resource_failed_lasterror
push edi
push esi
call fcn.0040a727
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c98b
mov ecx, eax
call fcn.0040123d
mov ecx, eax
call fcn.0040b202
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.0040655f
test eax, eax
pop ecx
jne 0x40d289
push 1
push dword [ebp - 8]
push str._XmpSetup_save_resource_result
push edi
push esi
call fcn.0040a727
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c98b
mov ecx, eax
call fcn.004010c6
mov ecx, eax
call fcn.0040b202
mov eax, dword [ebp - 8]
jmp 0x40d2b9
push esi
call fcn.0040655f
test eax, eax
pop ecx
jne 0x40d2b7
push 1
push str._XmpSetup_bad_param
push edi
push esi
call fcn.0040a727
pop ecx
pop ecx
mov ecx, eax
call fcn.0040c98b
mov ecx, eax
call fcn.0040b202
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret