Function at 0x40a8e0
Capabilities:
Copy file
Create directory

Disassembly:
push 0xffffffffffffffff
push 0x470f10
mov eax, dword fs:[0]
push eax
sub esp, 0x2c
push ebx
push ebp
push edi
mov eax, dword [0x48b670]
xor eax, esp
push eax
lea eax, [esp + 0x3c]
mov dword fs:[0], eax
mov dword [esp + 0x44], 2
call fcn.004194d8
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x40a928
push 0x80004005
call fcn.00401f50
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x14], eax
push 1
push ecx
mov byte [esp + 0x4c], 3
mov dword [esp + 0x2c], esp
mov edi, esp
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.INFO_COPY_FIRMWARE
call fcn.00404890
push edi
push esi
call fcn.00407610
mov ecx, esi
call fcn.0040b140
push str.:_sdupdate.img
lea ecx, [esp + 0x50]
push ecx
lea edx, [esp + 0x20]
push edx
call fcn.0040c5e0
add esp, 0xc
push eax
lea ecx, [esp + 0x18]
mov byte [esp + 0x48], 4
call fcn.004037c0
mov byte [esp + 0x44], 3
mov eax, dword [esp + 0x18]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40a9b0
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov edi, dword [esp + 0x14]
mov ecx, dword [esp + 0x50]
push 0
push edi
push ecx
call dword [sym.imp.KERNEL32.dll_CopyFileW]
test eax, eax
jne 0x40aaeb
cmp dword [0x4a120c], eax
je 0x40a9ed
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [0x4a120c]
push eax
push str._Error:CopyFirmwareAndDemo___copy_firmware_failed_err_d
push edx
call fcn.00451cb0
add esp, 0xc
push 0x10
push 0
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.ERROR_COPY_FIRMWARE_FAIL
call fcn.00404890
lea eax, [esp + 0x24]
push eax
push esi
call fcn.00407610
mov byte [esp + 0x4c], 5
mov eax, dword [eax]
push eax
mov ecx, esi
call fcn.00412dbf
mov byte [esp + 0x44], 3
mov eax, dword [esp + 0x18]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40aa41
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea eax, [edi - 0x10]
mov byte [esp + 0x44], 2
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40aa62
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x44], 1
mov eax, dword [esp + 0x4c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40aa87
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x44], 0
mov eax, dword [esp + 0x50]
add eax, 0xfffffff0
or edx, 0xffffffff
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40aaac
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov dword [esp + 0x44], 0xffffffff
mov eax, dword [esp + 0x54]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40aad4
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor eax, eax
mov ecx, dword [esp + 0x3c]
mov dword fs:[0], ecx
pop ecx
pop edi
pop ebp
pop ebx
add esp, 0x38
ret 0xc
lea ecx, [esp + 0x28]
call fcn.0041a82f
mov byte [esp + 0x44], 6
call fcn.004194d8
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x40ab13
push 0x80004005
call fcn.00401f50
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x18], eax
push str.:_rksdfw.tag
lea ecx, [esp + 0x50]
push ecx
lea edx, [esp + 0x18]
mov bl, 7
push edx
mov byte [esp + 0x50], bl
call fcn.0040c5e0
add esp, 0xc
push eax
lea ecx, [esp + 0x1c]
mov byte [esp + 0x48], 8
call fcn.004037c0
mov byte [esp + 0x44], bl
mov eax, dword [esp + 0x10]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ab73
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov ebp, dword [esp + 0x18]
push 0
push 0x9002
push ebp
lea ecx, [esp + 0x34]
call fcn.0041aca7
test eax, eax
jne 0x40ac3a
cmp dword [0x4a120c], eax
je 0x40abb3
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [0x4a120c]
push eax
push str._Error:CopyFirmwareAndDemo___create_tag_file_failed_err_d
push ecx
call fcn.00451cb0
add esp, 0xc
push 0x10
push 0
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.ERROR_COPY_FIRMWARE_FAIL
call fcn.00404890
lea edx, [esp + 0x1c]
push edx
push esi
call fcn.00407610
mov byte [esp + 0x4c], 9
mov eax, dword [eax]
push eax
mov ecx, esi
call fcn.00412dbf
mov byte [esp + 0x44], bl
mov eax, dword [esp + 0x10]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ac06
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea eax, [ebp - 0x10]
mov byte [esp + 0x44], 6
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ac27
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [esp + 0x28]
mov byte [esp + 0x44], 3
call fcn.0041a937
jmp 0x40aa41
lea ecx, [esp + 0x28]
call fcn.0041a7c9
mov eax, dword [esp + 0x4c]
push ecx
add eax, 0xfffffff0
mov dword [esp + 0x28], esp
mov edi, esp
push eax
call fcn.00403750
add eax, 0x10
mov dword [edi], eax
mov byte [esp + 0x4c], 0xa
mov eax, dword [esp + 0x5c]
add eax, 0xfffffff0
mov dword [esp + 0x28], esp
mov edi, esp
push eax
call fcn.00403750
add eax, 0x10
mov dword [edi], eax
mov ecx, esp
mov byte [esp + 0x50], 0xb
mov dword [esp + 0x28], esp
push str.sd_boot_config.config
lea edx, [esi + 0x24c]
push edx
push ecx
call fcn.0040c5e0
add esp, 0xc
mov ecx, esi
mov byte [esp + 0x50], bl
call fcn.0040bc70
test eax, eax
jne 0x40ad56
mov eax, dword [0x4a120c]
test eax, eax
je 0x40acc3
push str._Error:CopyFirmwareAndDemo___CreateBootConfigFile_failed_
push eax
call fcn.00451cb0
add esp, 8
push 0x10
push 0
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.ERROR_COPY_FIRMWARE_FAIL
call fcn.00404890
lea eax, [esp + 0x1c]
push eax
push esi
call fcn.00407610
mov byte [esp + 0x4c], 0xc
mov eax, dword [eax]
push eax
mov ecx, esi
call fcn.00412dbf
mov byte [esp + 0x44], bl
mov eax, dword [esp + 0x10]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ad16
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea eax, [ebp - 0x10]
mov byte [esp + 0x44], 6
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ad37
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [esp + 0x28]
mov byte [esp + 0x44], 3
call fcn.0041a937
mov byte [esp + 0x44], 2
mov eax, dword [esp + 0x14]
add eax, 0xfffffff0
jmp 0x40aa49
mov ecx, dword [esp + 0x54]
cmp dword [ecx - 0xc], 0
jne 0x40ae33
lea eax, [ebp - 0x10]
mov byte [esp + 0x44], 6
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x40ad85
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [esp + 0x28]
mov byte [esp + 0x44], 3
call fcn.0041a937
mov byte [esp + 0x44], 2
mov eax, dword [esp + 0x14]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40adb8
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x44], 1
mov eax, dword [esp + 0x4c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40addd
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x44], 0
mov eax, dword [esp + 0x50]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40ae02
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov dword [esp + 0x44], 0xffffffff
mov eax, dword [esp + 0x54]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40b120
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
jmp 0x40b120
push 1
push ecx
mov dword [esp + 0x2c], esp
mov edi, esp
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.INFO_COPY_DEMO
call fcn.00404890
push edi
push esi
call fcn.00407610
mov ecx, esi
call fcn.0040b140
lea ecx, [esp + 0x10]
call fcn.00401d90
push str.:Demo
lea ecx, [esp + 0x50]
push ecx
lea edx, [esp + 0x24]
mov bl, 0xd
push edx
mov byte [esp + 0x50], bl
call fcn.0040c5e0
add esp, 0xc
push eax
lea ecx, [esp + 0x14]
mov byte [esp + 0x48], 0xe
call fcn.004037c0
mov byte [esp + 0x44], bl
mov eax, dword [esp + 0x1c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40aeb4
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov ecx, dword [esp + 0x10]
push 0
push ecx
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
mov eax, dword [esp + 0x54]
push ecx
add eax, 0xfffffff0
mov dword [esp + 0x28], esp
mov edi, esp
push eax
call fcn.00403750
add eax, 0x10
add esp, 4
mov dword [edi], eax
call fcn.00450740
add esp, 4
cmp eax, 1
jne 0x40b026
push ecx
lea edx, [esp + 0x58]
mov ecx, esp
mov dword [esp + 0x28], esp
push edx
call fcn.004035b0
lea eax, [esp + 0x28]
push eax
call fcn.00450400
mov edi, eax
push str.:Demo_
lea ecx, [esp + 0x58]
push ecx
lea edx, [esp + 0x30]
push edx
mov byte [esp + 0x58], 0xf
call fcn.0040c5e0
add esp, 0x14
push edi
push eax
lea eax, [esp + 0x24]
push eax
mov byte [esp + 0x50], 0x10
call fcn.0040c520
add esp, 0xc
push eax
lea ecx, [esp + 0x14]
mov byte [esp + 0x48], 0x11
call fcn.004037c0
lea ecx, [esp + 0x1c]
call fcn.00401dc0
lea ecx, [esp + 0x20]
call fcn.00401dc0
lea ecx, [esp + 0x24]
mov byte [esp + 0x44], bl
call fcn.00401dc0
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x54]
push 0
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_CopyFileW]
test eax, eax
jne 0x40b0dc
cmp dword [0x4a120c], eax
je 0x40afa5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov eax, dword [0x4a120c]
push str._Error:CopyFirmwareAndDemo___copy_demo_file_failed_err_d
push eax
call fcn.00451cb0
add esp, 0xc
push 0x10
push 0
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.ERROR_COPY_DEMO_FAIL
call fcn.00404890
lea ecx, [esp + 0x30]
push ecx
push esi
call fcn.00407610
mov byte [esp + 0x4c], 0x12
mov eax, dword [eax]
push eax
mov ecx, esi
call fcn.00412dbf
lea ecx, [esp + 0x24]
call fcn.00401dc0
lea ecx, [esp + 0x10]
call fcn.00401dc0
lea ecx, [esp + 0x18]
call fcn.00401dc0
lea ecx, [esp + 0x28]
mov byte [esp + 0x44], 3
call fcn.0041a937
lea ecx, [esp + 0x14]
call fcn.00401dc0
lea ecx, [esp + 0x4c]
call fcn.00401dc0
lea ecx, [esp + 0x50]
call fcn.00401dc0
lea ecx, [esp + 0x54]
call fcn.00401dc0
jmp 0x40aad4
push str.:Demo_
lea edx, [esp + 0x50]
push edx
lea eax, [esp + 0x2c]
push eax
call fcn.0040c5e0
add esp, 0xc
push eax
lea ecx, [esp + 0x14]
mov byte [esp + 0x48], 0x13
call fcn.004037c0
lea ecx, [esp + 0x24]
mov byte [esp + 0x44], bl
call fcn.00401dc0
push ecx
lea edx, [esp + 0x14]
mov ecx, esp
mov dword [esp + 0x28], esp
push edx
call fcn.004035b0
push ecx
mov byte [esp + 0x4c], 0x14
lea eax, [esp + 0x5c]
mov ecx, esp
mov dword [esp + 0x28], esp
push eax
call fcn.004035b0
mov byte [esp + 0x4c], bl
call fcn.00451020
add esp, 8
test eax, eax
jne 0x40b0dc
cmp dword [0x4a120c], eax
je 0x40b0b2
call fcn.00450730
mov ecx, dword [0x4a120c]
push eax
push str._Error:CopyFirmwareAndDemo___copy_demo_dir_failed_err_d
push ecx
call fcn.00451cb0
add esp, 0xc
push 0x10
push 0
push ecx
mov ecx, esp
mov dword [esp + 0x30], esp
push str.ERROR_COPY_DEMO_FAIL
call fcn.00404890
lea edx, [esp + 0x30]
push edx
push esi
call fcn.00407610
mov byte [esp + 0x4c], 0x15
jmp 0x40afca
lea ecx, [esp + 0x10]
call fcn.00401dc0
lea ecx, [esp + 0x18]
call fcn.00401dc0
lea ecx, [esp + 0x28]
mov byte [esp + 0x44], 3
call fcn.0041a937
lea ecx, [esp + 0x14]
call fcn.00401dc0
lea ecx, [esp + 0x4c]
call fcn.00401dc0
lea ecx, [esp + 0x50]
call fcn.00401dc0
lea ecx, [esp + 0x54]
call fcn.00401dc0
mov eax, 1
mov ecx, dword [esp + 0x3c]
mov dword fs:[0], ecx
pop ecx
pop edi
pop ebp
pop ebx
add esp, 0x38
ret 0xc