Function at 0x40a540
Capabilities:
Read file on windows
Unmount volume via ioctl
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x15d4
call fcn.0041a500
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x103
lea eax, [ebp - 0x10f]
mov dword [ebp - 0x159c], 0
mov esi, edx
mov dword [ebp - 0x15bc], 0
push 0
push eax
mov dword [ebp - 0x15a8], esi
mov ebx, ecx
mov dword [ebp - 0x15b8], 0
mov dword [ebp - 0x15b0], 0x5c3a3f
mov byte [ebp - 0x110], 0
call fcn.004198c0
add esp, 0xc
xor edi, edi
mov dword [ebp - 0x15b4], edi
push dword [ebx + 0x14]
push dword [ebx + 0x10]
call fcn.0040dd80
cmp dword [ebx + 8], edi
mov ecx, 0x429f3c
push eax
lea eax, [ebx + 0xa0]
push eax
lea eax, [ebx + 0x20]
push eax
push dword [ebx + 4]
mov eax, 0x429f38
cmove eax, ecx
push eax
push esi
push str.UpdateVentoy2PhyDrive_try_d__s_PhyDrive_d____s__s__dGB__
call fcn.0040c4e0
add esp, 0x24
push edi
push 8
push 0x402
push dword [0x432910]
call dword [sym.imp.USER32.dll_SendMessageW]
movsd xmm0, qword [0x42c3d8]
lea eax, [ebp - 0x1150]
sub esp, 8
movsd qword [esp], xmm0
push str.Status____.0lf__
push 0x40
push eax
call fcn.004136cf
add esp, 0x14
lea eax, [ebp - 0x1150]
push eax
push dword [0x43297c]
call dword [sym.imp.USER32.dll_SetWindowTextA]
push str.Lock_disk_for_umount_............................
call fcn.0040c4e0
mov ecx, dword [ebx + 4]
mov dl, 1
push edi
call fcn.00406e50
mov edi, eax
add esp, 8
mov dword [ebp - 0x1598], edi
cmp edi, 0xffffffff
jne 0x40a67f
push str.Failed_to_open_physical_disk
call fcn.0040c4e0
add esp, 4
mov eax, 1
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004136c0
mov esp, ebp
pop ebp
ret
cmp dword [ebx + 8], 0
je 0x40a744
push 0x4400
call fcn.00413be0
mov esi, eax
add esp, 4
mov dword [ebp - 0x15b4], esi
test esi, esi
je 0x40a669
push 0x4400
push 0
push esi
call fcn.004198c0
add esp, 0xc
push 0
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x1594]
push eax
push 0x4400
push esi
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, 0x80
lea edi, [ebp - 0x1390]
rep movsd dword es:[edi], dword [esi]
mov edi, dword [ebp - 0x15b4]
mov esi, dword [edi + 0x4a0]
mov edi, dword [edi + 0x4a4]
push edi
push esi
push str.GPT_StartSector_in_PartTbl:_llu
mov dword [ebp - 0x15a0], esi
mov dword [ebp - 0x15a4], edi
call fcn.0040c4e0
mov ecx, dword [ebx + 0x10]
add esp, 0xc
mov eax, dword [ebx + 0x14]
shrd ecx, eax, 9
shr eax, 9
sub ecx, esi
sbb eax, edi
add ecx, 0xfffeffdf
adc eax, 0xffffffff
shrd ecx, eax, 0xb
shr eax, 0xb
push eax
push ecx
push str.GPT_Reserved_Disk_Space:_llu_MB
call fcn.0040c4e0
mov edi, dword [ebp - 0x1598]
jmp 0x40a7be
push 0
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x1594]
push eax
push 0x200
lea eax, [ebp - 0x1390]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov esi, dword [ebp - 0x11ba]
xor eax, eax
push eax
push esi
push str.MBR_StartSector_in_PartTbl:_llu
mov dword [ebp - 0x15a0], esi
mov dword [ebp - 0x15a4], eax
call fcn.0040c4e0
mov ecx, dword [ebx + 0x10]
add esp, 0xc
mov eax, dword [ebx + 0x14]
shrd ecx, eax, 9
shr eax, 9
sub ecx, esi
sbb eax, 0
add ecx, 0xffff0000
adc eax, 0xffffffff
shrd ecx, eax, 0xb
shr eax, 0xb
push eax
push ecx
push str.MBR_Reserved_Disk_Space:_llu_MB
call fcn.0040c4e0
add esp, 0xc
push 0
push 0
push 0xff000
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x1594]
push eax
push 0x1000
lea eax, [ebp - 0x1110]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push ecx
mov ecx, dword [ebx + 4]
lea edx, [ebp - 0x110]
call fcn.00406c70
add esp, 4
cmp byte [ebp - 0x110], 0
jne 0x40a81a
push str.No_drive_letter_was_assigned...
call fcn.0040c4e0
add esp, 4
jmp 0x40a8a0
lea esi, [ebp - 0x110]
lea ecx, [esi + 1]
mov al, byte [esi]
inc esi
test al, al
jne 0x40a823
sub esi, ecx
test esi, esi
jle 0x40a8a0
lea edi, [ebp - 0x110]
jmp 0x40a840
mov cl, byte [edi + esi - 1]
mov byte [ebp - 0x15b0], cl
call fcn.0040d340
test eax, eax
jne 0x40a85a
dec esi
test esi, esi
jg 0x40a840
jmp 0x40a89a
lea eax, [ebp - 0x15b0]
push eax
push str._s_is_ventoy_logical_drive
call fcn.0040c4e0
add esp, 8
lea eax, [ebp - 0x15b0]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteVolumeMountPointA]
mov esi, eax
mov eax, dword [sym.imp.KERNEL32.dll_GetLastError]
call eax
push eax
push esi
lea eax, [ebp - 0x15b0]
push eax
push str.Delete_mountpoint__s_ret:_u_code:_u
call fcn.0040c4e0
add esp, 0x10
mov edi, dword [ebp - 0x1598]
push 0
lea eax, [ebp - 0x1594]
push eax
push 0
push 0
push 0
push 0
push 0x9001c
push edi
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebx + 8], 1
jne 0x40a900
push dword [ebx + 0x48c]
mov esi, dword [ebp - 0x15a8]
push dword [ebx + 0x488]
push esi
push str.TryId_d_EFI_GPT_partition_type_is_0x_llx
call fcn.0040c4e0
add esp, 0x10
cmp esi, 1
jne 0x40a98b
cmp byte [ebx + 0x48f], 0xc0
je 0x40a994
mov esi, dword [sym.imp.USER32.dll_SendMessageW]
mov edi, dword [sym.imp.USER32.dll_SetWindowTextA]
push 0
push 0xa
push 0x402
push dword [0x432910]
call esi
movsd xmm0, qword [0x42c3e8]
lea eax, [ebp - 0x1150]
sub esp, 8
movsd qword [esp], xmm0
push str.Status____.0lf__
push 0x40
push eax
call fcn.004136cf
add esp, 0x14
lea eax, [ebp - 0x1150]
push eax
push dword [0x43297c]
call edi
push str.Lock_disk_for_update_............................
call fcn.0040c4e0
mov ecx, dword [ebx + 4]
mov dl, 1
push 1
call fcn.00406e50
mov edi, eax
add esp, 8
mov dword [ebp - 0x1598], edi
cmp edi, 0xffffffff
jne 0x40aa35
push str.Failed_to_GetPhysicalHandle_for_write.
call fcn.0040c4e0
jmp 0x40afea
cmp esi, 2
jne 0x40a900
mov esi, dword [sym.imp.USER32.dll_SendMessageW]
push 0
push 9
push 0x402
push dword [0x432910]
call esi
movsd xmm0, qword [0x42c3e0]
lea eax, [ebp - 0x1150]
sub esp, 8
movsd qword [esp], xmm0
push str.Status____.0lf__
push 0x40
push eax
call fcn.004136cf
mov edi, dword [sym.imp.USER32.dll_SetWindowTextA]
lea eax, [ebp - 0x1150]
add esp, 0x14
push eax
push dword [0x43297c]
call edi
push str.Change_GPT_partition_type_to_ESP
call fcn.0040c4e0
mov ecx, dword [ebp - 0x15a0]
add esp, 4
mov eax, dword [ebp - 0x15a4]
shld eax, ecx, 9
shl ecx, 9
push eax
push ecx
mov ecx, dword [ebx + 4]
call fcn.00401a80
add esp, 8
test eax, eax
je 0x40a90c
push 0x3e8
mov dword [ebp - 0x15b8], 1
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x40a90c
push 0
push 0xb
push 0x402
push dword [0x432910]
call esi
movsd xmm0, qword [0x42c3f0]
lea eax, [ebp - 0x1150]
sub esp, 8
movsd qword [esp], xmm0
push str.Status____.0lf__
push 0x40
push eax
call fcn.004136cf
add esp, 0x14
lea eax, [ebp - 0x1150]
push eax
push dword [0x43297c]
call dword [sym.imp.USER32.dll_SetWindowTextA]
push str.Lock_volume_for_update_..........................
call fcn.0040c4e0
add esp, 4
mov dword [ebp - 0x15a8], 0xffffffff
cmp dword [ebp - 0x15b8], 0
jne 0x40aafb
xor esi, esi
push 1
push ecx
push dword [ebp - 0x15a4]
mov ecx, dword [ebx + 4]
lea edx, [ebp - 0x110]
push dword [ebp - 0x15a0]
call fcn.00406a10
add esp, 0x10
mov dword [ebp - 0x15ac], eax
test eax, eax
je 0x40ac2b
push esi
push str._Volume_not_found__wait_and_retry__d..._
call fcn.0040c4e0
add esp, 8
push 2
call dword [sym.imp.KERNEL32.dll_Sleep]
inc esi
cmp esi, 3
jl 0x40aaa1
cmp dword [ebp - 0x15ac], 0x490
jne 0x40afed
push str.Volume_not_found__maybe_not_supported
call fcn.0040c4e0
add esp, 4
mov ecx, dword [ebp - 0x15a0]
lea edx, [ebp - 0x15c8]
mov eax, dword [ebp - 0x15a4]
push 0
shld eax, ecx, 9
push edx
shl ecx, 9
push eax
push ecx
push edi
mov dword [ebp - 0x15c8], ecx
mov dword [ebp - 0x15c4], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
push 0x4000
call fcn.00413be0
add esp, 4
mov esi, eax
lea eax, [ebp - 0x15ac]
push 0
push eax
push 0x4000
push esi
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
mov edi, eax
call fcn.00413ba8
add esp, 4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push dword [ebp - 0x15ac]
push edi
push str.Try_write_part2_bRet:_u_dwSize:_u_code:_u
call fcn.0040c4e0
add esp, 0x10
test edi, edi
je 0x40ab98
cmp dword [ebp - 0x15ac], 0x4000
je 0x40ad23
cmp dword [ebx + 8], 0
jne 0x40afda
push str.Try_write_failed__now_delete_partition_2_for_MBR...
mov dword [ebp - 0x15bc], 1
call fcn.0040c4e0
add esp, 4
push dword [ebp - 0x1598]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push str.Now_delete_partition_2...
call fcn.0040c4e0
mov esi, dword [ebx + 4]
add esp, 4
mov edx, esi
mov ecx, 1
push 0
push 2
push 0x4018d0
call fcn.00401310
add esp, 0xc
push eax
push esi
push str.VDS_DeleteVtoyEFIPartition__d_ret:_d
call fcn.0040c4e0
mov ecx, dword [ebx + 4]
add esp, 8
mov dl, 1
push 1
call fcn.00406e50
mov edi, eax
mov dword [ebp - 0x1598], eax
add esp, 8
cmp edi, 0xffffffff
jne 0x40ad29
push str.Failed_to_GetPhysicalHandle_for_write.
call fcn.0040c4e0
jmp 0x40afea
lea eax, [ebp - 0x110]
push eax
push str.Now_lock_and_dismount_volume___s_
call fcn.0040c4e0
add esp, 8
xor esi, esi
push 0
push 0xa0000080
push 3
push 0
push 1
push 0xc0000000
lea eax, [ebp - 0x110]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov edi, eax
mov dword [ebp - 0x15a8], edi
cmp edi, 0xffffffff
jne 0x40acaf
mov edi, dword [sym.imp.KERNEL32.dll_GetLastError]
call edi
push eax
push str.Failed_to_create_file_volume__errcode:_u__wait_and_retry_...
call fcn.0040c4e0
add esp, 8
push 0x7d0
call dword [sym.imp.KERNEL32.dll_Sleep]
inc esi
cmp esi, 3
jl 0x40ac41
call edi
push eax
push str.Failed_to_create_file_volume__errcode:_u
call fcn.0040c4e0
mov edi, dword [ebp - 0x1598]
add esp, 8
jmp 0x40ab08
push 0
lea eax, [ebp - 0x1594]
push eax
push 0
push 0
push 0
push 0
push 0x90018
push edi
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
mov esi, eax
mov eax, dword [sym.imp.KERNEL32.dll_GetLastError]
call eax
push eax
push esi
push str.FSCTL_LOCK_VOLUME_bRet:_u_code:_u
call fcn.0040c4e0
add esp, 0xc
lea eax, [ebp - 0x1594]
push 0
push eax
push 0
push 0
push 0
push 0
push 0x90020
push edi
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.FSCTL_DISMOUNT_VOLUME_bRet:_u_code:_u
call fcn.0040c4e0
mov edi, dword [ebp - 0x1598]
add esp, 0xc
jmp 0x40ab08
mov edi, dword [ebp - 0x1598]
push 0
push 0xc
push 0x402
push dword [0x432910]
call dword [sym.imp.USER32.dll_SendMessageW]
movsd xmm0, qword [0x42c3f8]
lea eax, [ebp - 0x1150]
sub esp, 8
movsd qword [esp], xmm0
push str.Status____.0lf__
push 0x40
push eax
call fcn.004136cf
add esp, 0x14
lea eax, [ebp - 0x1150]
push eax
push dword [0x43297c]
call dword [sym.imp.USER32.dll_SetWindowTextA]
push str.Write_Ventoy_to_disk_............................
call fcn.0040c4e0
add esp, 4
mov ecx, edi
push dword [ebp - 0x15a4]
push dword [ebp - 0x15a0]
call fcn.00407f60
add esp, 8
test eax, eax
jne 0x40afed
mov edi, dword [ebp - 0x15a8]
cmp edi, 0xffffffff
je 0x40ade7
push eax
lea eax, [ebp - 0x1594]
push eax
push 0
push 0
push 0
push 0
push 0x9001c
push edi
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.FSCTL_UNLOCK_VOLUME_bRet:_u_code:_u
call fcn.0040c4e0
add esp, 0xc
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push str.Updating_Boot_Image_.............................
call fcn.0040c4e0
mov edi, dword [ebp - 0x1598]
add esp, 4
mov edx, dword [ebx + 8]
mov ecx, edi
call fcn.00408570
test eax, eax
jne 0x40afed
push eax
push eax
push 0xff000
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x1594]
push eax
push 0x1000
lea eax, [ebp - 0x1110]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push dword [ebp - 0x1594]
push esi
push str.Write_resv_data_ret:_u_dwSize:_u_Error:_u
call fcn.0040c4e0
add esp, 0x10
lea ecx, [ebp - 0x1590]
call fcn.0040dcc0
cmp dword [ebx + 8], 0
mov ecx, 0x22
movzx eax, byte [ebp - 0x1534]
movdqu xmm0, xmmword [ebp - 0x1210]
cmovne eax, ecx
mov byte [ebp - 0x1534], al
mov eax, dword [ebp - 0x15bc]
movdqu xmmword [ebp - 0x1410], xmm0
test eax, eax
jne 0x40aec8
lea ecx, [ebp - 0x1590]
mov esi, 0x1b4
lea edx, [ebp - 0x1390]
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x40aec2
add ecx, 4
add edx, 4
sub esi, 4
jae 0x40aea2
push str.Boot_image_has_no_difference__no_need_to_write.
call fcn.0040c4e0
add esp, 4
jmp 0x40af35
mov eax, dword [ebp - 0x15bc]
push eax
push str.Boot_image_need_to_write__u.
call fcn.0040c4e0
add esp, 8
push 0
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x1594]
mov ecx, 0x6e
push eax
push 0x200
lea esi, [ebp - 0x1590]
lea edi, [ebp - 0x1390]
lea eax, [ebp - 0x1390]
rep movsd dword es:[edi], dword [esi]
mov edi, dword [ebp - 0x1598]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push dword [ebp - 0x1594]
push esi
push str.Write_Boot_Image_ret:_u_dwSize:_u_Error:_u
call fcn.0040c4e0
add esp, 0x10
cmp dword [ebx + 8], 0
jne 0x40afae
cmp byte [ebp - 0x11d2], 0
jne 0x40afae
cmp byte [ebp - 0x11c2], 0x80
jne 0x40afae
push str.Need_to_chage_1st_partition_active_and_2nd_partition_inactive.
call fcn.0040c4e0
add esp, 4
mov byte [ebp - 0x11d2], 0x80
mov byte [ebp - 0x11c2], 0
push 0
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 0x1594]
push eax
push 0x200
lea eax, [ebp - 0x1390]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push dword [ebp - 0x1594]
push esi
push str.Write_NEW_MBR_ret:_u_dwSize:_u_Error:_u
call fcn.0040c4e0
add esp, 0x10
push 0
lea eax, [ebp - 0x1594]
push eax
push 0
push 0
push 0
push 0
push 0x70140
push edi
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
push 0x42a8f8
call fcn.0040c4e0
add esp, 4
jmp 0x40affe
push str.TryWritePart2_failed_....
call fcn.0040c4e0
mov edi, dword [ebp - 0x1598]
add esp, 4
mov edx, ebx
mov dword [ebp - 0x159c], 1
call fcn.0040bd20
cmp edi, 0xffffffff
je 0x40b00a
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x15b8], 0
je 0x40b0aa
push str.Recover_GPT_partition_type_to_basic
call fcn.0040c4e0
mov eax, dword [ebp - 0x15a0]
add esp, 4
mov ecx, dword [ebp - 0x15a4]
mov esi, dword [ebx + 4]
mov edx, esi
shld ecx, eax, 9
push 0
shl eax, 9
mov dword [ebp - 0x1118], eax
lea eax, [ebp - 0x1190]
mov dword [ebp - 0x15d0], 0xebd0a0a2
mov dword [ebp - 0x15cc], 0x4433b9e5
mov dword [ebp - 0x15c8], 0xb668c087
mov dword [ebp - 0x15c4], 0xc79926b7
movdqu xmm0, xmmword [ebp - 0x15d0]
push eax
mov dword [ebp - 0x1114], ecx
mov ecx, 2
push 0x401a20
movdqu xmmword [ebp - 0x1188], xmm0
call fcn.00401310
add esp, 0xc
push eax
push esi
push str.VDS_ChangeVtoyEFI2ESP__d_ret:_d
call fcn.0040c4e0
add esp, 0xc
mov eax, dword [ebp - 0x15b4]
test eax, eax
je 0x40b0bd
push eax
call fcn.00413ba8
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0x159c]
xor ecx, ebp
pop edi
pop esi
pop ebx
call fcn.004136c0
mov esp, ebp
pop ebp
ret