Function at 0x402140
Capabilities:
Copy file
Delete file
Get common file path
Move file
Persist via run registry key
Query or enumerate registry value
Set registry value

Disassembly:
sub esp, 0xd20
mov dl, byte [0x409338]
push ebx
push ebp
push esi
push edi
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x729]
mov byte [esp + 0x728], dl
mov byte [esp + 0x1c], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x1d]
mov byte [esp + 0x224], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x225]
mov byte [esp + 0x82c], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x82d]
mov byte [esp + 0x120], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x40
xor eax, eax
lea edi, [esp + 0x121]
mov byte [esp + 0x930], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0xff
xor eax, eax
lea edi, [esp + 0x931]
xor ebx, ebx
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov al, byte [0x408ad4]
mov dword [esp + 0x14], 0x400
cmp al, 0x31
jne 0x40283c
mov ecx, dword [esp + 0xd34]
mov edi, dword [sym.imp.KERNEL32.dll_GetShortPathNameA]
lea eax, [esp + 0x728]
push 0x104
push eax
push ecx
call edi
test eax, eax
je 0x4027f1
cmp eax, 0x104
ja 0x4027f1
mov esi, dword [esp + 0xd38]
test esi, esi
jne 0x402263
mov edi, 0x408538
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x1c]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
jmp 0x402479
lea ecx, [esp + 0x1c]
push 0x104
push ecx
push esi
call edi
test eax, eax
je 0x4027f1
cmp eax, 0x104
ja 0x4027f1
lea edx, [esp + 0x1c]
push edx
push esi
call dword [sym.imp.MSVCRT.dll__stricmp]
add esp, 8
test eax, eax
je 0x402479
mov edi, 0x40912c
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
jne 0x402439
mov ebp, dword [sym.imp.MSVCRT.dll_sprintf]
push str.WDRenSrv.exe
push 0x409958
lea eax, [esp + 0x834]
push 0x40838c
push eax
call ebp
lea ecx, [esp + 0x83c]
push 0
push ecx
call dword [sym.imp.MSVCRT.dll__access]
add esp, 0x18
test eax, eax
jne 0x4027f1
push str.WDRenSrv.exe
push 0x409854
lea edx, [esp + 0x128]
push 0x40838c
push edx
call ebp
add esp, 0x10
lea eax, [esp + 0x120]
lea ecx, [esp + 0x82c]
push 0
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_CopyFileA]
test eax, eax
je 0x4027f1
push 0x40912c
push 0
push 0x408454
push 0x409854
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
test eax, eax
jne 0x402354
push 0x409854
push str._sWDSFFFF.tmp
push 0x40912c
call ebp
add esp, 0xc
push 0x408524
push 0x40912c
call dword [sym.imp.MSVCRT.dll_fopen]
mov esi, eax
add esp, 8
test esi, esi
je 0x4027f1
lea edx, [esp + 0x10]
push edx
push 0xf003f
push 0
push str.SoftwareMicrosoftWindowsCurrentVersionRunServicesOnce
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
jne 0x4027f1
lea eax, [esp + 0x14]
lea ecx, [esp + 0x930]
push eax
mov eax, dword [esp + 0x14]
lea edx, [esp + 0x1c]
push ecx
push edx
push 0
push str.WDRenameService
push eax
mov dword [esp + 0x2c], 0x400
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
test eax, eax
je 0x4023d5
mov ecx, 0x100
xor eax, eax
lea edi, [esp + 0x930]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x120]
push 0x40912c
push ecx
lea edx, [esp + 0x330]
push str._s__s
push edx
call ebp
lea edi, [esp + 0x338]
or ecx, 0xffffffff
xor eax, eax
add esp, 0x10
repne scasb al, byte es:[edi]
not ecx
dec ecx
lea eax, [esp + 0x328]
push ecx
mov ecx, dword [esp + 0x14]
push eax
push 1
push 0
push str.WDRenameService
push ecx
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
mov edx, dword [esp + 0x10]
mov edi, eax
push edx
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
test edi, edi
jne 0x4027f1
jmp 0x402456
push 0x408518
push 0x40912c
call dword [sym.imp.MSVCRT.dll_fopen]
mov esi, eax
add esp, 8
test esi, esi
je 0x4027f1
mov eax, dword [esp + 0xd38]
lea ecx, [esp + 0x1c]
push eax
push ecx
push str._s_s_n
push esi
call dword [sym.imp.MSVCRT.dll_fprintf]
push esi
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 0x14
push 0
push str.WININIT.INI
call dword [sym.imp.MSVCRT.dll__access]
add esp, 8
test eax, eax
je 0x4024de
push 0x408524
push str.WININIT.INI
call dword [sym.imp.MSVCRT.dll_fopen]
mov esi, eax
add esp, 8
test esi, esi
je 0x4027f1
lea edx, [esp + 0x728]
lea eax, [esp + 0x1c]
push edx
push eax
push str._rename_
push str._n_n_s_n_s_s_n
push esi
call dword [sym.imp.MSVCRT.dll_fprintf]
push esi
call dword [sym.imp.MSVCRT.dll_fflush]
push esi
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 0x1c
jmp 0x402727
mov edi, dword [sym.imp.MSVCRT.dll_fopen]
push 0x408388
push str.WININIT.INI
call edi
mov esi, eax
add esp, 8
test esi, esi
je 0x4027f1
lea ecx, [esp + 0x224]
push ecx
push 0
push 0x408454
push 0x408c08
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
test eax, eax
je 0x4027cd
lea edx, [esp + 0x224]
push 0x408524
push edx
call edi
mov ebx, eax
add esp, 8
test ebx, ebx
je 0x4027cd
mov ebp, dword [sym.imp.MSVCRT.dll_fgets]
mov ecx, 0x100
xor eax, eax
lea edi, [esp + 0x328]
rep stosd dword es:[edi], eax
test byte [esi + 0xc], 0x10
jne 0x4025c2
mov edi, str._rename_
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
lea eax, [esp + 0x328]
push ecx
push str._rename_
push eax
call dword [sym.imp.MSVCRT.dll__strnicmp]
add esp, 0xc
test eax, eax
je 0x4025c2
mov ecx, 0x100
xor eax, eax
lea edi, [esp + 0x328]
push esi
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x32c]
push 0x400
push ecx
call ebp
add esp, 0xc
lea edx, [esp + 0x328]
push edx
push 0x408500
push ebx
call dword [sym.imp.MSVCRT.dll_fprintf]
mov al, byte [esi + 0xc]
add esp, 0xc
test al, 0x10
je 0x402557
test byte [esi + 0xc], 0x10
jne 0x4027cd
mov ecx, 0x100
xor eax, eax
lea edi, [esp + 0x328]
push esi
rep stosd dword es:[edi], eax
lea eax, [esp + 0x32c]
push 0x400
push eax
call ebp
mov al, byte [esi + 0xc]
add esp, 0xc
test al, 0x10
jne 0x40266a
mov dl, byte [esp + 0x328]
cmp dl, 0xa
je 0x40266a
lea edi, [esp + 0x328]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
cmp dl, 0x5b
jne 0x40262c
cmp byte [esp + ecx + 0x326], 0x5d
jne 0x40262c
cmp byte [esp + ecx + 0x327], 0xa
je 0x40266a
lea ecx, [esp + 0x328]
push ecx
push 0x408500
push ebx
call dword [sym.imp.MSVCRT.dll_fprintf]
mov ecx, 0x100
xor eax, eax
lea edi, [esp + 0x334]
push esi
lea edx, [esp + 0x338]
push 0x400
rep stosd dword es:[edi], eax
push edx
call ebp
mov al, byte [esi + 0xc]
add esp, 0x18
test al, 0x10
je 0x4025f6
mov edi, dword [sym.imp.MSVCRT.dll_fprintf]
lea eax, [esp + 0x728]
lea ecx, [esp + 0x1c]
push eax
push ecx
push str._s_s_n
push ebx
call edi
add esp, 0x10
lea edx, [esp + 0x328]
push edx
push 0x408500
push ebx
call edi
mov al, byte [esi + 0xc]
add esp, 0xc
test al, 0x10
jne 0x4026e3
mov ecx, 0x100
xor eax, eax
lea edi, [esp + 0x328]
push esi
rep stosd dword es:[edi], eax
lea eax, [esp + 0x32c]
push 0x400
push eax
call ebp
add esp, 0xc
lea ecx, [esp + 0x328]
push ecx
push 0x408500
push ebx
call dword [sym.imp.MSVCRT.dll_fprintf]
mov al, byte [esi + 0xc]
add esp, 0xc
test al, 0x10
je 0x4026a2
push ebx
call dword [sym.imp.MSVCRT.dll_fflush]
mov edi, dword [sym.imp.MSVCRT.dll_fclose]
push ebx
call edi
push esi
call edi
add esp, 0xc
push str.WININIT.INI
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
test eax, eax
je 0x4027f1
lea edx, [esp + 0x224]
push str.WININIT.INI
push edx
call dword [sym.imp.KERNEL32.dll_MoveFileA]
test eax, eax
je 0x4027f1
lea edi, [esp + 0x930]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
je 0x402772
lea eax, [esp + 0x930]
push 0x20
push eax
call dword [sym.imp.MSVCRT.dll_strchr]
mov esi, eax
push 0
inc esi
push esi
call dword [sym.imp.MSVCRT.dll__access]
add esp, 0x10
test eax, eax
jne 0x402772
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
test eax, eax
jne 0x402772
push eax
push esi
call fcn.00402140
add esp, 8
mov edi, 0x40912c
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
jne 0x402798
call fcn.00402850
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0xd20
ret
lea edi, [esp + 0x120]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
je 0x4027bd
lea ecx, [esp + 0x120]
push 1
push ecx
call fcn.00404470
add esp, 8
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0xd20
ret
push esi
mov esi, dword [sym.imp.MSVCRT.dll_fclose]
call esi
add esp, 4
test ebx, ebx
je 0x4027f1
push ebx
call esi
add esp, 4
lea edx, [esp + 0x224]
push edx
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
lea edi, [esp + 0x930]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
je 0x40283c
lea eax, [esp + 0x930]
push 0x20
push eax
call dword [sym.imp.MSVCRT.dll_strchr]
mov esi, eax
push 0
inc esi
push esi
call dword [sym.imp.MSVCRT.dll__access]
add esp, 0x10
test eax, eax
jne 0x40283c
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
test eax, eax
jne 0x40283c
push eax
push esi
call fcn.00402140
add esp, 8
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0xd20
ret