Function at 0x40af2c
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4c
push ebx
push esi
push edi
mov esi, edx
mov dword [ebp - 0xc], ecx
or ebx, 0xffffffff
xor edi, edi
mov dword [ebp - 0x34], ebx
test esi, esi
je 0x40af5d
mov ecx, dword [0x522920]
mov edx, dword [0x522924]
mov dword [ebp - 4], ecx
mov ecx, dword [ebp - 0xc]
mov dword [ebp - 8], edx
jmp 0x40af6d
mov eax, dword [0x522880]
mov dword [ebp - 4], eax
mov eax, dword [0x522884]
mov dword [ebp - 8], eax
or dword [ebp - 0x20], 0xffffffff
or dword [ebp - 0x24], 0xffffffff
mov eax, dword [0x522930]
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x2c], edi
mov dword [ebp - 0x28], edi
mov dword [ebp - 0x30], edi
cmp eax, 0x200
jae 0x40afa0
push eax
push str.Unexpected_sector_size___d____Aborting
call fcn.0042ed57
pop ecx
xor eax, eax
jmp 0x40b84f
push edi
push edi
xorps xmm0, xmm0
movlpd qword [ebp - 0x48], xmm0
push dword [ebp - 0x44]
push dword [ebp - 0x48]
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
jne 0x40afc6
push str.Warning:_Unable_to_rewind_image_position___wrong_data_might_be_copied_
call fcn.0042ed57
pop ecx
push edi
push edi
push edi
push edi
xor edx, edx
or ecx, 0xffffffff
call fcn.0043c21c
add esp, 0x10
test esi, esi
je 0x40b392
cmp dword [0x4dca24], edi
mov ecx, str.Zeroing_drive:
mov eax, str.Fast_zeroing_drive:
cmove eax, ecx
push eax
call fcn.0042ed57
pop ecx
mov ecx, dword [0x522930]
xor edx, edx
push ecx
lea eax, [ecx + 0x1ffffff]
div ecx
mov esi, eax
imul esi, ecx
push esi
call fcn.0047b39c
mov dword [ebp - 0x10], eax
pop ecx
pop ecx
test eax, eax
jne 0x40b037
push str.Could_not_allocate_disk_zeroing_buffer
mov dword [0x4dc5d0], 0xc0030008
call fcn.0042ed57
jmp 0x40b801
xor edx, edx
div dword [0x522930]
test edx, edx
je 0x40b05a
push 0x5f5
push str.C:UsersGauravDownloads_formatusb_master_1__formatusb_master_src_format.c
push str._uintptr_t_buffer___SelectedDrive.SectorSize__0
call fcn.00486ba7
add esp, 0xc
mov eax, dword [0x4dca24]
neg eax
push esi
sbb eax, eax
and eax, 0xff
push eax
push dword [ebp - 0x10]
call fcn.00478bc0
add esp, 0xc
cmp dword [0x4dca24], edi
je 0x40b0bc
push dword [0x522930]
push esi
call fcn.0047b39c
mov dword [ebp - 0x2c], eax
pop ecx
pop ecx
test eax, eax
jne 0x40b099
push str.Could_not_allocate_disk_comparison_buffer
jmp 0x40b023
xor edx, edx
div dword [0x522930]
test edx, edx
je 0x40b0bc
push 0x601
push str.C:UsersGauravDownloads_formatusb_master_1__formatusb_master_src_format.c
push str._uintptr_t_cmp_buffer___SelectedDrive.SectorSize__0
call fcn.00486ba7
add esp, 0xc
mov edx, dword [ebp - 8]
xorps xmm0, xmm0
mov dword [ebp - 0x48], esi
movlpd qword [ebp - 0x40], xmm0
mov dword [ebp - 0x18], edi
cmp edx, edi
jb 0x40b7ca
mov ecx, dword [ebp - 4]
ja 0x40b0e2
cmp ecx, edi
jbe 0x40b7ca
mov eax, dword [ebp - 0x3c]
mov esi, dword [ebp - 0x40]
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x1c], esi
cmp dword [0x4dca24], edi
push edx
push ecx
push eax
mov edx, 0xcd6
push esi
push 4
pop ecx
lea eax, [edx + 0x14]
cmovne edx, eax
call fcn.0043c21c
mov ecx, dword [ebp - 8]
add esp, 0x10
cmp ecx, edi
jb 0x40b126
ja 0x40b11f
mov eax, dword [ebp - 4]
cmp eax, 0x50
jbe 0x40b129
push 0x50
pop eax
mov ecx, edi
jmp 0x40b129
mov eax, dword [ebp - 4]
push dword [ebp - 0x14]
push esi
push ecx
push eax
call fcn.00476210
push dword [ebp - 8]
push dword [ebp - 4]
push edx
push eax
call fcn.00476100
cmp eax, dword [ebp - 0x20]
jne 0x40b14b
cmp edx, dword [ebp - 0x24]
je 0x40b15b
mov ecx, 0x4b771c
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x24], edx
call fcn.0042ee19
mov ecx, dword [ebp - 0x48]
xor eax, eax
mov edx, ecx
add edx, esi
adc eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 8]
jb 0x40b17c
mov eax, dword [ebp - 4]
ja 0x40b175
cmp edx, eax
jbe 0x40b17c
mov ecx, eax
sub ecx, esi
mov dword [ebp - 0x48], ecx
mov esi, dword [0x522930]
xor edx, edx
mov eax, ecx
div esi
test edx, edx
je 0x40b19d
lea eax, [esi - 1]
xor edx, edx
add eax, ecx
div esi
mov ecx, eax
imul ecx, esi
mov dword [ebp - 0x48], ecx
mov eax, dword [ebp - 0x28]
test eax, eax
je 0x40b1fa
dec eax
mov dword [ebp - 0x28], eax
xor esi, esi
inc esi
mov eax, dword [0x4dc5d0]
test eax, eax
jns 0x40b1be
cmp ax, 0x4c7
je 0x40b802
push edi
lea eax, [ebp - 0x18]
push eax
push ecx
push dword [ebp - 0x10]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40b2af
mov eax, dword [ebp - 0x18]
cmp eax, dword [ebp - 0x48]
je 0x40b329
push dword [ebp - 0x48]
push eax
push str.Write_error:_Wrote__d_bytes__expected__d_bytes
call fcn.0042ed57
add esp, 0xc
jmp 0x40b2d6
cmp dword [0x4dca24], edi
je 0x40b1a8
push 0x61c
push str.C:UsersGauravDownloads_formatusb_master_1__formatusb_master_src_format.c
push str.hSourceImage__NULL
call fcn.00486ba7
mov eax, dword [0x4dc5d0]
add esp, 0xc
test eax, eax
jns 0x40b22c
cmp ax, 0x4c7
je 0x40b802
mov esi, dword [ebp - 0x2c]
lea eax, [ebp - 0x38]
push edi
push eax
push dword [ebp - 0x48]
push esi
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40b378
mov eax, dword [ebp - 0x48]
cmp dword [ebp - 0x38], eax
jne 0x40b378
mov esi, dword [esi]
test esi, esi
je 0x40b260
cmp esi, 0xffffffff
jne 0x40b280
xor ecx, ecx
mov edx, eax
inc ecx
shr edx, 2
cmp edx, ecx
jbe 0x40b2a7
mov ebx, dword [ebp - 0x2c]
cmp dword [ebx + ecx*4], esi
jne 0x40b279
inc ecx
cmp ecx, edx
jb 0x40b26f
mov ebx, dword [ebp - 0x34]
cmp ecx, edx
jae 0x40b2a7
push edi
push edi
push dword [ebp - 0x14]
push dword [ebp - 0x1c]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x40b363
mov ecx, dword [ebp - 0x48]
push 0xf
pop eax
mov dword [ebp - 0x28], eax
jmp 0x40b1a8
mov dword [ebp - 0x18], eax
jmp 0x40b332
call fcn.0042fc51
push eax
push edi
push dword [0x522930]
push dword [ebp - 0x14]
push dword [ebp - 0x1c]
call fcn.00476100
push edx
push eax
push str.Write_error_at_sector__lld:__s
call fcn.0042ed57
add esp, 0x10
cmp esi, 4
jae 0x40b4f5
push 5
push str.Retrying_in__d_seconds...
call fcn.0042ed57
pop ecx
pop ecx
push 0x1388
call dword [sym.imp.KERNEL32.dll_Sleep]
push edi
push edi
push dword [ebp - 0x14]
push dword [ebp - 0x1c]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x40b385
push 0xc8
call dword [sym.imp.KERNEL32.dll_Sleep]
inc esi
cmp esi, 4
ja 0x40b326
mov ecx, dword [ebp - 0x48]
jmp 0x40b1ab
mov eax, dword [ebp - 0x18]
cmp esi, 4
ja 0x40b802
mov esi, dword [ebp - 0x1c]
mov edx, dword [ebp - 8]
add esi, eax
mov eax, dword [ebp - 0x14]
adc eax, edi
mov dword [ebp - 0x1c], esi
mov dword [ebp - 0x14], eax
cmp eax, edx
ja 0x40b7ca
mov ecx, dword [ebp - 4]
jb 0x40b0ee
cmp esi, ecx
jae 0x40b7ca
jmp 0x40b0ee
call fcn.0042fc51
push eax
push str.Error:_Could_not_reset_position____s
call fcn.0042ed57
jmp 0x40b800
call fcn.0042fc51
push eax
push str.Read_error:_Could_not_read_data_for_fast_zeroing_comparison____s
jmp 0x40b36e
call fcn.0042fc51
push eax
push str.Write_error:_Could_not_reset_position____s
jmp 0x40b36e
cmp byte [0x5228c1], 0
je 0x40b504
push str.Writing_compressed_image:
call fcn.0042ed57
push 0x8000000
push 3
push ecx
mov ecx, dword [0x4dca18]
mov edx, SHChangeNotifyRegister
push 1
call fcn.00407cfb
mov ebx, eax
add esp, 0x14
cmp ebx, 0xffffffff
jne 0x40b3f5
call fcn.0042fc51
push eax
push dword [0x4dca18]
push str.Could_not_open_image__s:__s
call fcn.0042ed57
add esp, 0xc
mov dword [0x4dc5d0], 0xc003006e
jmp 0x40b802
mov eax, dword [0x522930]
push eax
push eax
call fcn.0047b39c
mov dword [0x4dc5d4], eax
pop ecx
pop ecx
test eax, eax
jne 0x40b416
push str.Could_not_allocate_disk_write_buffer
jmp 0x40b023
xor edx, edx
div dword [0x522930]
test edx, edx
je 0x40b439
push 0x666
push str.C:UsersGauravDownloads_formatusb_master_1__formatusb_master_src_format.c
push str._uintptr_t_sec_buf___SelectedDrive.SectorSize__0
call fcn.00486ba7
add esp, 0xc
push 0x4dc5d0
push edi
push 0x40ad87
push 0x40ae11
push edi
push fcn.0042ed57
mov dword [0x50d048], edi
call fcn.00452690
movzx eax, byte [0x5228c1]
push eax
push dword [ebp - 0xc]
push ebx
call fcn.00452af0
add esp, 0x24
mov dword [ebp - 0x30], edx
mov esi, eax
call fcn.00452640
cmp dword [ebp - 0x30], edi
jl 0x40b4b0
jg 0x40b483
cmp esi, edi
jb 0x40b4b0
cmp dword [0x50d048], edi
je 0x40b4b0
push str.Notice:_Compressed_image_data_didnt_end_on_block_boundary.
call fcn.0042ed57
pop ecx
push edi
lea eax, [ebp - 0x18]
push eax
push dword [0x522930]
push dword [0x4dc5d4]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [0x4dc5d4]
call fcn.0047b382
pop ecx
mov ecx, dword [ebp - 0x30]
mov dword [0x4dc5d4], edi
cmp ecx, edi
jg 0x40b7ca
jl 0x40b4d7
cmp esi, edi
jae 0x40b7ca
cmp word [0x4dc5d0], 0x4c7
je 0x40b7ca
push ecx
push esi
push str.Could_not_write_compressed_image:__lld
call fcn.0042ed57
add esp, 0xc
mov dword [0x4dc5d0], 0xc003001d
jmp 0x40b802
sub esp, 0xc
call fcn.00408023
mov ebx, eax
add esp, 0xc
test ebx, ebx
je 0x40b3cd
mov ecx, dword [0x522930]
xor edx, edx
push ecx
lea eax, [ecx + 0x1ffffff]
div ecx
mov esi, eax
imul esi, ecx
mov dword [ebp - 0x34], esi
lea eax, [esi + esi]
push eax
call fcn.0047b39c
mov dword [ebp - 0x10], eax
pop ecx
pop ecx
test eax, eax
je 0x40b40c
xor edx, edx
div dword [0x522930]
test edx, edx
je 0x40b56b
push 0x68b
push str.C:UsersGauravDownloads_formatusb_master_1__formatusb_master_src_format.c
push str._uintptr_t_buffer___SelectedDrive.SectorSize__0
call fcn.00486ba7
add esp, 0xc
mov edx, dword [ebp - 0x10]
mov ecx, ebx
push esi
call fcn.00408095
xorps xmm0, xmm0
mov dword [ebp - 0x44], 1
movlpd qword [ebp - 0x40], xmm0
mov eax, dword [ebp - 0x40]
pop ecx
mov ecx, dword [ebp - 0x3c]
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0x14], eax
push dword [ebp - 8]
mov esi, dword [ebp - 4]
mov edx, 0xcbd
push esi
push ecx
push eax
push 4
pop ecx
call fcn.0043c21c
mov ecx, dword [ebp - 8]
add esp, 0x10
cmp ecx, edi
jb 0x40b5c0
ja 0x40b5b9
cmp esi, 0x50
jbe 0x40b5c0
push 0x50
pop eax
mov ecx, edi
jmp 0x40b5c2
mov eax, esi
push dword [ebp - 0x1c]
push dword [ebp - 0x14]
push ecx
push eax
call fcn.00476210
push dword [ebp - 8]
push esi
push edx
push eax
call fcn.00476100
cmp eax, dword [ebp - 0x20]
jne 0x40b5e4
cmp edx, dword [ebp - 0x24]
je 0x40b5f4
mov ecx, 0x4b771c
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x24], edx
call fcn.0042ee19
cmp dword [ebx + 4], edi
jg 0x40b60f
push 0x3a98
push dword [ebx + 0x18]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x40b7e6
mov eax, dword [ebp - 0x30]
lea esi, [ebp - 0x48]
lea esi, [esi + eax*4]
mov eax, dword [ebx + 4]
mov dword [ebp - 0x28], esi
test eax, eax
je 0x40b7e4
cmp dword [ebx + 0x1c], edi
jne 0x40b7d7
shr eax, 0x1f
push eax
push esi
lea eax, [ebx + 8]
push eax
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
jne 0x40b655
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x26
jne 0x40b7e6
jmp 0x40b664
mov eax, dword [esi]
add dword [ebx + 0x10], eax
mov dword [ebx + 0x1c], 1
adc dword [ebx + 0x14], edi
mov ecx, dword [esi]
xor eax, eax
mov edx, ecx
add edx, dword [ebp - 0x14]
adc eax, dword [ebp - 0x1c]
cmp eax, dword [ebp - 8]
jb 0x40b685
mov eax, dword [ebp - 4]
ja 0x40b67e
cmp edx, eax
jbe 0x40b685
mov ecx, eax
sub ecx, dword [ebp - 0x14]
mov dword [esi], ecx
mov esi, dword [0x522930]
xor edx, edx
mov eax, ecx
div esi
test edx, edx
je 0x40b6a8
lea eax, [esi - 1]
xor edx, edx
add eax, ecx
div esi
imul eax, esi
mov esi, dword [ebp - 0x28]
mov dword [esi], eax
jmp 0x40b6ab
mov esi, dword [ebp - 0x28]
mov ecx, dword [ebp - 0x30]
mov dword [ebp - 0x3c], ecx
inc ecx
and ecx, 0x80000001
jns 0x40b6bf
dec ecx
or ecx, 0xfffffffe
inc ecx
mov eax, dword [ebp - 0x34]
mov edx, eax
imul edx, ecx
mov dword [ebp - 0x30], ecx
mov ecx, ebx
push eax
add edx, dword [ebp - 0x10]
call fcn.00408095
pop ecx
mov dword [ebp - 0x28], 1
mov eax, dword [0x4dc5d0]
test eax, eax
jns 0x40b6f0
cmp ax, 0x4c7
je 0x40b802
push edi
lea eax, [ebp - 0x18]
push eax
mov eax, dword [ebp - 0x34]
imul eax, dword [ebp - 0x3c]
push dword [esi]
add eax, dword [ebp - 0x10]
push eax
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40b72c
mov eax, dword [ebp - 0x18]
cmp eax, dword [esi]
je 0x40b7ac
push dword [esi]
push eax
push str.Write_error:_Wrote__d_bytes__expected__d_bytes
call fcn.0042ed57
add esp, 0xc
jmp 0x40b753
call fcn.0042fc51
push eax
push edi
push dword [0x522930]
push dword [ebp - 0x1c]
push dword [ebp - 0x14]
call fcn.00476100
push edx
push eax
push str.Write_error_at_sector__lld:__s
call fcn.0042ed57
add esp, 0x10
cmp dword [ebp - 0x28], 4
jae 0x40b4f5
push 5
push str.Retrying_in__d_seconds...
call fcn.0042ed57
pop ecx
pop ecx
push 0x1388
call dword [sym.imp.KERNEL32.dll_Sleep]
push edi
push edi
push dword [ebp - 0x1c]
push dword [ebp - 0x14]
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
je 0x40b385
push 0xc8
call dword [sym.imp.KERNEL32.dll_Sleep]
mov ecx, dword [ebp - 0x28]
inc ecx
mov dword [ebp - 0x28], ecx
cmp ecx, 4
jbe 0x40b6dd
jmp 0x40b802
cmp dword [ebp - 0x28], 4
ja 0x40b802
mov eax, dword [ebp - 0x14]
add eax, dword [esi]
mov ecx, dword [ebp - 0x1c]
adc ecx, edi
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x1c], ecx
cmp dword [esi], edi
jne 0x40b592
mov ecx, dword [ebp - 0xc]
call fcn.004077dc
xor edi, edi
inc edi
jmp 0x40b802
push 0x103
call dword [sym.imp.KERNEL32.dll_SetLastError]
jmp 0x40b7e6
mov dword [esi], edi
call fcn.0042fc51
push eax
push str.Read_error:__s
call fcn.0042ed57
mov dword [0x4dc5d0], 0xc003001e
pop ecx
pop ecx
cmp byte [0x5228c1], 0
je 0x40b81d
cmp ebx, 0xffffffff
je 0x40b83c
test ebx, ebx
je 0x40b83c
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40b83c
test ebx, ebx
je 0x40b83c
cmp ebx, 0xffffffff
je 0x40b83c
push dword [ebx]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [ebx + 0x18]
call esi
push ebx
call fcn.004812c6
pop ecx
push dword [ebp - 0x10]
call fcn.0047b382
pop ecx
push dword [ebp - 0x2c]
call fcn.0047b382
mov eax, edi
pop ecx
pop edi
pop esi
pop ebx
leave
ret