Function at 0x401040
Capabilities:
Get file size
Read file on windows

Disassembly:
sub esp, 0x14
push ebx
push ebp
push esi
mov esi, ecx
xor ebp, ebp
push edi
mov eax, dword [esi]
cmp eax, ebp
je 0x40105e
push 0x8000
push ebp
push eax
call dword [sym.imp.KERNEL32.dll_VirtualFree]
lea edi, [esi + 4]
mov dword [esi], ebp
mov dword [esi + 8], ebp
mov dword [esi + 0xc], ebp
mov dword [edi], ebp
mov dword [esi + 0x10], ebp
mov dword [esi + 0x14], ebp
mov dword [esi + 0x18], ebp
call fcn.00402030
test eax, eax
jne 0x401087
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret 8
lea eax, [esp + 0x20]
lea ecx, [esp + 0x18]
push eax
lea edx, [esp + 0x18]
push ecx
lea eax, [esp + 0x18]
push edx
push eax
push edi
call fcn.00402040
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x3c]
cdq
xor eax, edx
add esp, 0x14
sub eax, edx
mov dword [esi + 8], eax
mov eax, dword [esp + 0x14]
cdq
xor eax, edx
push ebp
sub eax, edx
push 0x8000000
mov dword [esi + 0xc], eax
mov eax, dword [esp + 0x20]
cdq
push 3
xor eax, edx
push ebp
push 1
sub eax, edx
push 0x80000000
push ecx
mov dword [esi + 0x10], eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x401103
push str.CEuSynth::Initialize___Failed_CreateFile_on_synth_sample_set._n
call fcn.00401410
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret 8
push ebp
push ebx
mov dword [esp + 0x30], ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
push edi
push str.CEuSynth::Initialize___sample_set_is__ld_bytes_n
call fcn.00401410
add esp, 8
lea ebp, [edi + 0x400]
push 4
push 0x1000
push ebp
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
test eax, eax
mov dword [esi], eax
je 0x40116f
push ebp
push eax
call dword [sym.imp.KERNEL32.dll_VirtualLock]
test eax, eax
je 0x401176
mov eax, dword [esi]
lea edx, [esp + 0x1c]
push 0
push edx
push edi
push eax
push ebx
mov dword [esp + 0x30], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40117d
mov dword [esp + 0x28], 1
jmp 0x40118a
push str.CEuSynth::Initialize___Unable_to_allocate_memory_for_sample_set_n
jmp 0x401182
push str.CEuSynth::Initialize___Unable_to_lock_sample_set_memory_n
jmp 0x401182
push str.CEuSynth::Initialize___Unable_to_read_sample_set_file_n
call fcn.00401410
add esp, 4
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x28]
test eax, eax
jne 0x4011bf
mov eax, dword [esi]
test eax, eax
je 0x4011b3
push 0x8000
push 0
push eax
call dword [sym.imp.KERNEL32.dll_VirtualFree]
mov dword [esi], 0
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret 8
push 0
push 0
push 0x3e8
push 0
push 0
call fcn.00402120
add esp, 0x14
push 0
push 0
push 0
push 0
push 1
call fcn.004021a0
add esp, 0x14
push 0
push 1
call fcn.004021e0
mov ecx, dword [esi]
mov edi, dword [esp + 0x34]
mov edx, dword [esi + 0x10]
mov eax, dword [esi + 0xc]
add esp, 8
push 0
push ecx
mov ecx, dword [esi + 8]
push edi
push edx
push eax
push ecx
call fcn.00402070
mov edx, dword [esi + 0xc]
mov eax, 0x10624dd3
shr edx, 3
imul edx, dword [esi + 8]
mul edx
add esp, 0x18
mov dword [esi + 0x18], edi
shr edx, 6
mov dword [esi + 0x14], edx
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x14
ret 8