Function at 0x40c140
Capabilities:
Initialize winsock library
Read .ini file
Set registry value

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x42c57a
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x9d4
push ebx
push ebp
push esi
push edi
mov ebp, ecx
mov eax, dword [0x443c60]
xor edi, edi
cmp eax, edi
jne 0x40c5ef
mov eax, dword [ebp + 0xc0a4]
push 0xffffffffffffffff
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push str._CMediaServer__InitMediaServer
call fcn.0040f6a0
push 0x20
call fcn.0042abe2
add esp, 8
mov dword [esp + 0x1c], eax
cmp eax, edi
mov dword [esp + 0x9ec], edi
je 0x40c1b3
mov ecx, eax
call fcn.0040e480
mov esi, eax
jmp 0x40c1b5
xor esi, esi
xor ecx, ecx
mov dword [esp + 0x20], ecx
lea edx, [esp + 0x20]
mov dword [esp + 0x24], ecx
push edx
mov dword [esp + 0x9f0], 0xffffffff
mov dword [esp + 0x18], edi
mov dword [esp + 0x2c], ecx
call sub.KERNEL32.dll_GetSystemPowerStatus
test eax, eax
mov ebx, 1
je 0x40c205
mov al, byte [esp + 0x20]
test al, al
jne 0x40c205
push str._CMediaServer__Using_DC
call fcn.0040f6a0
add esp, 4
push 2
push 4
lea eax, [esp + 0x1c]
push eax
jmp 0x40c21a
push str._CMediaServer__Using_AC
call fcn.0040f6a0
add esp, 4
push ebx
push 4
lea ecx, [esp + 0x1c]
push ecx
mov ecx, esi
call fcn.0040ee80
push str.SystemCurrentControlSetControlSession_ManagerPower
lea ecx, [esp + 0x30]
mov dword [esp + 0x1c], edi
mov dword [esp + 0x14], ebx
call dword [sym.imp.MSVCP71.dll_public:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::constructor_char_const__]
cmp dword [esp + 0x44], 0x10
mov eax, dword [esp + 0x30]
mov dword [esp + 0x9ec], ebx
jae 0x40c24e
lea eax, [esp + 0x30]
lea edx, [esp + 0x18]
push edx
push 0xf003f
push edi
push eax
push reloc.WS2_32.dll_bind
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
cmp eax, edi
jne 0x40c2c2
cmp dword [esp + 0x14], 2
jne 0x40c297
push str._CMediaServer__RegKey__AwayMode__set_away_mode__1
mov dword [esp + 0x14], ebx
call fcn.0040f6a0
mov ecx, dword [esp + 0x1c]
add esp, 4
push 4
lea eax, [esp + 0x14]
push eax
push 4
push edi
push str.AwayModeEnabled
push ecx
jmp 0x40c2bc
push str._CMediaServer__RegKey__SleepMode__set_away_mode__0
mov dword [esp + 0x14], edi
call fcn.0040f6a0
mov eax, dword [esp + 0x1c]
add esp, 4
push 4
lea edx, [esp + 0x14]
push edx
push 4
push edi
push str.AwayModeEnabled
push eax
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
cmp esi, edi
je 0x40c2d6
mov ecx, esi
call fcn.0040e4d0
push esi
call sub.MSVCR71.dll_void___cdecl_operator_delete_void__
add esp, 4
lea ecx, [esp + 0x850]
push ecx
push 0x202
call sub.WS2_32.dll_WSAStartup
test eax, eax
je 0x40c329
push str._CMediaServer__WSAStartup_failed
call fcn.0040f6a0
add esp, 4
lea ecx, [esp + 0x2c]
mov dword [esp + 0x9ec], 0xffffffff
call dword [sym.imp.MSVCP71.dll_public:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::destructor_void_]
mov eax, 8
mov ecx, dword [esp + 0x9e4]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebp
pop ebx
mov esp, ebp
pop ebp
ret
xor eax, eax
mov ecx, 0x200
lea edi, [esp + 0x49]
mov byte [esp + 0x48], 0
rep stosd dword es:[edi], eax
mov eax, dword [ebp + 0xc278]
mov edi, 0x10
cmp eax, edi
jb 0x40c352
mov eax, dword [ebp + 0xc264]
jmp 0x40c358
lea eax, [ebp + 0xc264]
mov esi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringA]
push eax
push 0x401
lea edx, [esp + 0x50]
push edx
push 0x4348c8
push str.RegenUDN
push str.Settings
call esi
lea eax, [esp + 0x48]
push eax
push 0x42f6d4
call dword [sym.imp.MSVCR71.dll__stricmp]
add esp, 8
test eax, eax
jne 0x40c3a6
mov byte [0x43e2a9], al
cmp dword [ebp + 0xc278], edi
jb 0x40c3be
mov eax, dword [ebp + 0xc264]
jmp 0x40c3c4
push 0x443c64
mov byte [0x43e2a9], bl
call fcn.00409330
add esp, 4
jmp 0x40c44b
lea eax, [ebp + 0xc264]
push eax
push 0x401
lea ecx, [esp + 0x50]
push ecx
push 0x42e658
push 0x4348b8
push str.Settings
call esi
lea eax, [esp + 0x48]
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x40c3e7
sub eax, edx
mov dword [esp + 0x1c], eax
je 0x40c410
lea edx, [esp + 0x48]
push edx
push 0x42f800
push 0x443c64
call dword [sym.imp.MSVCR71.dll_sprintf]
add esp, 0xc
jmp 0x40c44b
push 0x443c64
call fcn.00409330
mov eax, dword [ebp + 0xc278]
add esp, 4
cmp eax, edi
jb 0x40c42f
mov eax, dword [ebp + 0xc264]
jmp 0x40c435
lea eax, [ebp + 0xc264]
push eax
push 0x443c64
push 0x4348b8
push str.Settings
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringA]
mov eax, 0x443c64
xor esi, esi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x40c455
sub eax, edx
mov dword [esp + 0x1c], eax
je 0x40c498
mov edi, dword [sym.imp.MSVCR71.dll_tolower]
lea ebx, [ebx]
movsx eax, byte [esi + 0x443c64]
push eax
call edi
mov eax, 0x443c64
add esp, 4
inc esi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x40c486
sub eax, edx
cmp esi, eax
jb 0x40c470
mov edi, 0x10
mov eax, dword [0x443c60]
test eax, eax
jne 0x40c5c6
push 0x443c60
push 0x42f850
push 0x42f860
push str.CLMediaServer.dll
push 0
mov ecx, 0x443d14
call fcn.0040bf30
test eax, eax
jl 0x40c5b7
mov eax, dword [0x443c60]
test eax, eax
je 0x40c5b7
push str._CMediaServer__Load_CLMediaServer.dll_succeeded
call fcn.0040f6a0
mov ecx, dword [0x443c58]
xor eax, eax
add esp, 4
test ecx, ecx
mov dword [0x443c98], eax
je 0x40c502
mov edx, dword [ecx]
call dword [edx + 0x4c]
mov dword [0x443c98], eax
cmp dword [0x443d38], edi
mov edx, dword [0x443d24]
jae 0x40c515
mov edx, 0x443d24
movzx edi, byte [0x43e2a8]
mov ecx, dword [0x443c60]
mov esi, dword [ecx]
push edi
push edx
mov edx, dword [0x443c9c]
push 0x443c64
push edx
push eax
push ecx
call dword [esi + 0x1c]
test eax, eax
jge 0x40c54d
push str._CMediaServer__Create_CLMediaServer_failed_1
call fcn.0040f6a0
add esp, 4
jmp 0x40c5da
push str._CMediaServer__Create_CLMediaServer_succeeded
call fcn.0040f6a0
mov ecx, dword [0x443c58]
add esp, 4
test ecx, ecx
je 0x40c570
mov edx, dword [0x443c60]
mov eax, dword [ecx]
push edx
call dword [eax + 0x54]
mov eax, dword [ebp + 0xc0a4]
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push str._CMediaServer__InitMediaServer_Success.
call fcn.0040f6a0
add esp, 4
lea ecx, [esp + 0x2c]
mov dword [esp + 0x9ec], 0xffffffff
call dword [sym.imp.MSVCP71.dll_public:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::destructor_void_]
xor eax, eax
mov ecx, dword [esp + 0x9e4]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebp
pop ebx
mov esp, ebp
pop ebp
ret
push str._CMediaServer__Create_CLMediaServer_failed_2
call fcn.0040f6a0
add esp, 4
jmp 0x40c5da
push str._CMediaServer__CLMediaServer_has_been_created
call fcn.0040f6a0
add esp, 4
mov ecx, ebp
call fcn.00408f60
lea ecx, [esp + 0x2c]
mov dword [esp + 0x9ec], 0xffffffff
call dword [sym.imp.MSVCP71.dll_public:_void___thiscall_std::basic_string_char__struct_std::char_traits_char___class_std::allocator_char__::destructor_void_]
mov ecx, dword [esp + 0x9e4]
pop edi
mov eax, 0xd
mov dword fs:[0], ecx
pop esi
pop ebp
pop ebx
mov esp, ebp
pop ebp
ret