Function at 0x401040
Capabilities:
Query or enumerate registry value
Read .ini file

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x65c
mov eax, dword [0x40d018]
xor eax, esp
mov dword [esp + 0x658], eax
mov ecx, dword [0x40d54c]
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
xor edi, edi
cmp ecx, edi
jne 0x401094
push 0x1c
call sub.MSVCR90.dll_void____cdecl_operator_new_unsigned_int_
mov esi, eax
add esp, 4
cmp esi, edi
je 0x40108c
lea eax, [esi + 4]
push eax
mov dword [esi], edi
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov ecx, esi
jmp 0x40108e
xor ecx, ecx
mov dword [0x40d54c], ecx
mov eax, dword [0x40d550]
mov dword [0x40d544], ecx
cmp eax, edi
jne 0x4010ca
push 0xe60
call sub.MSVCR90.dll_void____cdecl_operator_new_unsigned_int_
add esp, 4
cmp eax, edi
je 0x4010bd
mov esi, eax
call fcn.00403000
jmp 0x4010bf
xor eax, eax
mov ecx, dword [0x40d544]
mov dword [0x40d550], eax
push ecx
mov dword [0x40d548], eax
xor eax, eax
push 0x409370
xor edx, edx
push 0x80000002
mov dword [esp + 0x24], str.NpBkpSrv
mov dword [esp + 0x28], 0x401850
mov dword [esp + 0x2c], edi
mov dword [esp + 0x30], edi
mov word [esp + 0x34], dx
mov dword [esp + 0x36], eax
mov dword [esp + 0x3a], eax
mov dword [esp + 0x3e], eax
mov dword [esp + 0x42], eax
mov dword [esp + 0x46], eax
mov dword [esp + 0x4a], eax
mov dword [esp + 0x4e], eax
mov esi, ecx
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyW]
cmp eax, edi
jne 0x4011b1
add esi, 4
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov edx, dword [0x40d544]
lea eax, [esp + 0x10]
push eax
mov eax, dword [edx]
lea ecx, [esp + 0x2c]
push ecx
push edi
push edi
push str.Avstat
push eax
mov dword [esp + 0x28], 0xf
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
mov eax, dword [0x40d544]
mov ecx, dword [eax]
push ecx
mov esi, eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
add esi, 4
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push 0x4093d8
lea edx, [esp + 0x2c]
push edx
call dword [sym.imp.SHLWAPI.dll_StrStrW]
test eax, eax
je 0x4011b1
mov ecx, dword [0x40d548]
push 0x4093dc
call fcn.00403540
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x658]
xor ecx, esp
call fcn.00407c9c
mov esp, ebp
pop ebp
ret
push 0x40d4d8
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
cmp dword [ebp + 8], 1
jle 0x4013f3
mov eax, dword [ebx + 4]
movzx ecx, word [eax]
cmp cx, 0x2d
je 0x4011dc
cmp cx, 0x2f
jne 0x4013f3
mov esi, dword [sym.imp.MSVCR90.dll__wcsicmp]
add eax, 2
push eax
push str.install
call esi
add esp, 8
test eax, eax
jne 0x401211
mov ecx, dword [0x40d548]
push str.Install_Service_command_received..._
call fcn.00403540
add esp, 4
call fcn.00401ad0
jmp 0x4013fe
mov eax, dword [ebx + 4]
add eax, 2
push eax
push str.remove
call esi
add esp, 8
test eax, eax
je 0x40123f
mov ecx, dword [ebx + 4]
add ecx, 2
push ecx
push str.uninstall
call esi
add esp, 8
test eax, eax
jne 0x4013fe
mov ecx, dword [0x40d548]
push str.Uninstall_Command_Received..._
call fcn.00403540
add esp, 4
push 0x206
lea eax, [esp + 0x4e]
xor edx, edx
push edi
push eax
mov word [esp + 0x54], dx
call sub.MSVCR90.dll_memset
add esp, 0xc
push 0x206
lea edx, [esp + 0x256]
xor ecx, ecx
push edi
push edx
mov word [esp + 0x25c], cx
call sub.MSVCR90.dll_memset
mov edx, dword [0x40d548]
add esp, 0xc
call fcn.004032a0
push eax
lea eax, [esp + 0x254]
push 0x104
push eax
call dword [sym.imp.MSVCR90.dll_wcscpy_s]
add esp, 0xc
push 0x4093d8
push str.PROTECTION
push str.DATABKP
call fcn.00401000
lea edi, [esp + 0x25c]
lea ebx, [esp + 0x54]
call fcn.004037f0
mov esi, dword [sym.imp.MSVCR90.dll__wtoi]
mov ecx, ebx
push ecx
call esi
add esp, 4
push 0x4093d8
push str.FOL_PROT
push str.DIRLOCK
mov dword [esp + 0x20], eax
call fcn.00401000
call fcn.004037f0
mov edx, ebx
push edx
call esi
add esp, 4
push 0x4093d8
push str.NPTB
push str.DIRLOCK
mov dword [esp + 0x1c], eax
call fcn.00401000
call fcn.004037f0
mov eax, ebx
push eax
call esi
add esp, 4
xor ecx, ecx
push 0x206
push ecx
lea edx, [esp + 0x462]
push edx
mov esi, eax
mov word [esp + 0x464], cx
call sub.MSVCR90.dll_memset
mov edx, dword [0x40d548]
add esp, 0xc
call fcn.00403340
push eax
lea eax, [esp + 0x45c]
push 0x104
push eax
call dword [sym.imp.MSVCR90.dll_wcscpy_s]
add esp, 0xc
lea ecx, [esp + 0x458]
push ecx
push 0
push str.Task
push str.BKP_SERVICE
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntW]
mov ecx, dword [esp + 0x14]
cmp ecx, 1
je 0x4013a9
cmp dword [esp + 0x10], 1
je 0x4013a9
cmp esi, 1
je 0x4013a9
cmp eax, 1
je 0x4013a9
call fcn.00401d00
jmp 0x4013fe
test ecx, ecx
je 0x4013c0
mov ecx, dword [0x40d548]
push str.DATABKP_Protection_required_protection_so_skip
call fcn.00403540
add esp, 4
cmp dword [esp + 0x10], 0
je 0x4013da
mov ecx, dword [0x40d548]
push str.Folder_Protection_required_protection_so_skip
call fcn.00403540
add esp, 4
test esi, esi
je 0x4013fe
mov ecx, dword [0x40d548]
push str.Tally_Backup_Protection_required_protection_so_skip
call fcn.00403540
add esp, 4
jmp 0x4013fe
lea edx, [esp + 0x18]
push edx
call dword [sym.imp.ADVAPI32.dll_StartServiceCtrlDispatcherW]
push 0x40d4d8
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
mov ecx, dword [esp + 0x664]
pop edi
pop esi
pop ebx
xor ecx, esp
xor eax, eax
call fcn.00407c9c
mov esp, ebp
pop ebp
ret