Function at 0x40d590
Capabilities:
Check if file exists
Delete file
Get file size
Read file on windows
Set registry value
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x437db5
mov eax, dword fs:[0]
push eax
sub esp, 0x390
mov eax, dword [0x4450e4]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x360], ecx
mov eax, dword [ebp + 8]
mov ebx, dword [ebp + 0xc]
push 0x230
mov dword [ebp - 0x374], eax
lea eax, [ebp - 0x344]
push 0
push eax
mov dword [ebp - 0x378], 0
mov dword [ebp - 0x37c], 0
call fcn.00417900
add esp, 0xc
call fcn.00402f7e
mov ecx, eax
test ecx, ecx
je 0x40e0ec
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x350], eax
mov dword [ebp - 4], 0
call fcn.00402f7e
mov ecx, eax
test ecx, ecx
je 0x40e0f6
mov eax, dword [ecx]
call dword [eax + 0xc]
lea edi, [eax + 0x10]
mov dword [ebp - 0x35c], edi
mov byte [ebp - 4], 1
call fcn.00402f7e
mov ecx, eax
test ecx, ecx
je 0x40e100
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x380], eax
mov byte [ebp - 4], 2
call fcn.00402f7e
mov ecx, eax
test ecx, ecx
je 0x40e10a
mov eax, dword [ecx]
call dword [eax + 0xc]
lea esi, [eax + 0x10]
mov dword [ebp - 0x34c], esi
mov eax, dword [ebp - 0x360]
mov byte [ebp - 4], 3
cmp dword [eax], 0
je 0x40d696
mov ebx, 1
jmp 0x40e04f
test ebx, ebx
jne 0x40d69e
xor ecx, ecx
jmp 0x40d6b2
mov ecx, ebx
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d6a3
sub ecx, edx
sar ecx, 1
push ecx
push ebx
lea ecx, [ebp - 0x35c]
call fcn.00402ac0
push 1
push dword [ebp - 0x374]
lea eax, [ebp - 0x354]
push eax
call fcn.0040c630
add esp, 0xc
push eax
lea ecx, [ebp - 0x350]
mov byte [ebp - 4], 4
call fcn.00402b84
mov edx, dword [ebp - 0x354]
or eax, 0xffffffff
mov byte [ebp - 4], 3
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40d708
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov edi, dword [ebp - 0x35c]
mov ebx, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
cmp dword [edi - 0xc], 0
jne 0x40d74d
push dword [ebp - 0x350]
call ebx
test eax, eax
jne 0x40d743
call fcn.0040d420
test eax, eax
je 0x40d73c
push str.not_dll
call fcn.0040eab0
add esp, 4
xor ebx, ebx
jmp 0x40e04f
cmp dword [edi - 0xc], 0
je 0x40dcf1
call fcn.00404f5d
push 0
push edi
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 8]
test eax, eax
jne 0x40d77c
call fcn.0040d420
test eax, eax
je 0x40e042
push str.DownLoadBuffer_fail
call fcn.0040eab0
jmp 0x40e03f
call fcn.00404f5d
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 0xc]
test eax, eax
jne 0x40d7a8
call fcn.0040d420
test eax, eax
je 0x40e042
push str.GetBufferSize_zero
call fcn.0040eab0
jmp 0x40e03f
call fcn.00404f5d
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 0xc]
mov ebx, eax
lea eax, [ebx + 1]
push eax
call fcn.004197a8
add esp, 4
mov dword [ebp - 0x348], eax
test eax, eax
jne 0x40d7e8
call fcn.0040d420
test eax, eax
je 0x40e042
push str.malloc_buffer1_fail
call fcn.0040eab0
jmp 0x40e03f
lea ecx, [ebx + 1]
push ecx
push 0
push eax
call fcn.00417900
add esp, 0xc
call fcn.00404f5d
push ebx
push dword [ebp - 0x348]
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 0x10]
cmp ebx, eax
je 0x40d838
push dword [ebp - 0x348]
call fcn.004197a3
add esp, 4
call fcn.0040d420
test eax, eax
je 0x40e042
push str.ReadBuffer_fail
call fcn.0040eab0
jmp 0x40e03f
xor eax, eax
mov dword [ebp - 0x370], eax
mov dword [ebp - 0x36c], eax
push dword [ebp - 0x350]
mov byte [ebp - 4], 5
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push dword [ebp - 0x350]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
jne 0x40d8ee
call fcn.004064b8
test eax, eax
jns 0x40d8f6
call fcn.0040d420
test eax, eax
je 0x40d8da
push 3
push dword [ebp - 0x350]
lea eax, [ebp - 0x90]
lea ecx, [ebp - 0x94]
mov dword [ebp - 0x94], eax
call fcn.0040545a
push dword [ebp - 0x94]
mov byte [ebp - 4], 6
push str.create_file_fail_:__s
call fcn.0040eab0
mov eax, dword [ebp - 0x94]
lea ecx, [ebp - 0x90]
add esp, 8
cmp eax, ecx
je 0x40d8da
push eax
call fcn.004197a3
add esp, 4
lea ecx, [ebp - 0x370]
mov byte [ebp - 4], 3
call fcn.00406485
jmp 0x40def7
mov dword [ebp - 0x370], eax
jmp 0x40d8f8
xor eax, eax
push 0
lea ecx, [ebp - 0x358]
push ecx
push ebx
push dword [ebp - 0x348]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40d918
call fcn.004064b8
cmp dword [ebp - 0x374], 0xe
jne 0x40d9fc
call fcn.00402f7e
mov ecx, eax
test ecx, ecx
je 0x40e114
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x354], eax
mov byte [ebp - 4], 7
call fcn.0040d420
lea ecx, [ebp - 0x354]
test eax, eax
je 0x40d95e
push 7
push str.http:__
jmp 0x40d965
push 8
push str.https:__
call fcn.00402ac0
mov ecx, dword [ebp - 0x360]
lea eax, [ebp - 0x384]
push ebx
push dword [ebp - 0x348]
push eax
call fcn.0040ca70
mov ecx, eax
mov byte [ebp - 4], 8
call fcn.0040ec90
mov edi, dword [ebp - 0x354]
push dword [eax]
lea eax, [ebp - 0x380]
push 0x4383e0
push str.xsfaya
push str.down
push edi
push str._s_s._s._s_m__s
push eax
call fcn.004024ee
mov edx, dword [ebp - 0x384]
add esp, 0x1c
mov byte [ebp - 4], 7
add edx, 0xfffffff0
or eax, 0xffffffff
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40d9dc
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 5
add edi, 0xfffffff0
or eax, 0xffffffff
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x40db08
mov ecx, dword [edi]
push edi
jmp 0x40db03
mov ecx, dword [ebp - 0x360]
lea eax, [ebp - 0x358]
push ebx
push dword [ebp - 0x348]
push eax
call fcn.0040ca70
mov dword [ebp - 0x364], eax
cmp dword [edi - 0xc], 0xa
mov byte [ebp - 4], 9
jg 0x40da2a
or eax, 0xffffffff
jmp 0x40da45
lea eax, [edi + 0x14]
push 0x2f
push eax
call fcn.00416cc9
add esp, 8
test eax, eax
jne 0x40da41
or eax, 0xffffffff
jmp 0x40da45
sub eax, edi
sar eax, 1
xor ecx, ecx
add eax, 1
cmovns ecx, eax
mov dword [ebp - 0x384], ecx
cmp ecx, dword [edi - 0xc]
jl 0x40da6f
add edi, 0xfffffff0
push edi
call fcn.0040329a
add esp, 4
lea edi, [eax + 0x10]
mov dword [ebp - 0x354], edi
jmp 0x40daa4
mov ecx, dword [edi - 0x10]
test ecx, ecx
je 0x40da7f
mov eax, dword [ecx]
call dword [eax + 0x10]
test eax, eax
jne 0x40da8b
call fcn.00402f7e
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 0x10]
push eax
push dword [ebp - 0x384]
lea ecx, [ebp - 0x354]
push edi
call fcn.00401f4b
mov edi, dword [ebp - 0x354]
mov ecx, dword [ebp - 0x364]
mov byte [ebp - 4], 0xa
call fcn.0040ec90
push dword [eax]
lea eax, [ebp - 0x380]
push edi
push str._sm__s
push eax
call fcn.004024ee
add esp, 0x10
mov byte [ebp - 4], 9
add edi, 0xfffffff0
or eax, 0xffffffff
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x40dae6
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov edx, dword [ebp - 0x358]
or eax, 0xffffffff
mov byte [ebp - 4], 5
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40db08
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
call fcn.00404f5d
push 0
push dword [ebp - 0x380]
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 8]
test eax, eax
je 0x40dee2
call fcn.00404f5d
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 0xc]
mov edi, eax
call fcn.00404f5d
mov edx, eax
mov dword [ebp - 0x358], edx
test edi, edi
js 0x40e11e
mov eax, dword [esi - 8]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, edi
or eax, ecx
jge 0x40db70
push edi
lea ecx, [ebp - 0x34c]
call fcn.00405bf9
mov esi, dword [ebp - 0x34c]
mov edx, dword [ebp - 0x358]
mov eax, dword [edx]
mov ecx, edx
push edi
push esi
call dword [eax + 0x10]
cmp edi, eax
jne 0x40dee2
cmp edi, 0xffffffff
jne 0x40db94
push dword [esi - 8]
push esi
call fcn.004194c5
add esp, 8
mov edi, eax
test edi, edi
js 0x40e11e
cmp edi, dword [esi - 8]
jg 0x40e11e
mov dword [esi - 0xc], edi
lea ecx, [ebp - 0x34c]
mov byte [edi + esi], 0
call fcn.0040ed70
mov esi, dword [ebp - 0x34c]
cmp dword [esi - 0xc], 0x20
jne 0x40dee2
push 3
lea eax, [ebp - 0x110]
push esi
lea ecx, [ebp - 0x114]
mov dword [ebp - 0x114], eax
call fcn.00405392
mov eax, dword [ebp - 0x374]
mov edi, dword [ebp - 0x114]
mov byte [ebp - 4], 0xb
sub eax, 2
je 0x40dc84
sub eax, 1
je 0x40dc63
sub eax, 0xb
jne 0x40dcba
push str.HaoKanWallPaper
push 0x438ab4
lea ecx, [ebp - 0x39c]
call fcn.00403662
mov dword [ebp - 0x39c], 0x438ab0
test edi, edi
je 0x40dcaf
mov ecx, edi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40dc34
sub ecx, edx
sar ecx, 1
lea eax, [ecx*2 + 2]
push eax
push edi
push 1
push 0
push 0x438a9c
push dword [ebp - 0x398]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
jmp 0x40dcaf
push str.HaoKanWallPaper
push str.HaoKanMini
lea ecx, [ebp - 0x39c]
call fcn.00403662
mov dword [ebp - method.CCfgOPBaseT_int_.virtual_0], vtable.CCfgPopMgr.0
jmp 0x40dca3
push str.HaoKanWallPaper
push 0x438ab4
lea ecx, [ebp - 0x39c]
call fcn.00403662
mov dword [ebp - 0x39c], 0x438ab0
push edi
lea ecx, [ebp - 0x39c]
call fcn.0040ecf0
lea ecx, [ebp - 0x39c]
call fcn.004023fc
mov eax, dword [ebp - 0x114]
lea ecx, [ebp - 0x110]
cmp eax, ecx
je 0x40dcd3
push eax
call fcn.004197a3
add esp, 4
mov eax, dword [ebp - 0x370]
mov byte [ebp - 4], 3
test eax, eax
je 0x40def1
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40def1
push dword [ebp - 0x350]
call ebx
test eax, eax
je 0x40e042
mov dword [ebp - 0x368], 0
mov dword [ebp - 0x364], 0
push 0
push 0
push 0x80
push 3
push 0
push 0x80000000
push dword [ebp - 0x350]
lea ecx, [ebp - 0x368]
mov byte [ebp - 4], 0xc
call fcn.00406511
test eax, eax
jns 0x40dd50
lea ecx, [ebp - 0x368]
call fcn.00406485
jmp 0x40e042
lea eax, [ebp - 0x36c]
push eax
push dword [ebp - 0x368]
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebx, eax
mov dword [ebp - 0x370], ebx
cmp ebx, 0xffffffff
jne 0x40dd7f
call fcn.004064b8
test eax, eax
js 0x40dd89
mov ebx, dword [ebp - 0x370]
mov eax, ebx
or eax, dword [ebp - 0x36c]
jne 0x40dd99
lea ecx, [ebp - 0x368]
call fcn.00406485
jmp 0x40e042
lea eax, [ebx + 1]
push eax
call fcn.004197a8
add esp, 4
mov dword [ebp - 0x348], eax
test eax, eax
jne 0x40ddbf
lea ecx, [ebp - 0x368]
call fcn.00406485
jmp 0x40e042
lea ecx, [ebx + 1]
push ecx
push 0
push eax
call fcn.00417900
add esp, 0xc
mov dword [ebp - 0x358], 0
lea eax, [ebp - 0x358]
push 0
push eax
push ebx
push dword [ebp - 0x348]
push dword [ebp - 0x368]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40ddfd
call fcn.004064b8
push dword [ebp - 0x374]
mov ecx, dword [ebp - 0x360]
lea eax, [ebp - 0x358]
push eax
call fcn.0040c860
mov eax, dword [eax]
lea ecx, [ebp - 0x90]
push 3
mov dword [ebp - 0x94], ecx
lea ecx, [ebp - 0x94]
push eax
mov byte [ebp - 4], 0xd
call fcn.0040545a
push dword [ebp - 0x94]
lea ecx, [ebp - 0x34c]
mov byte [ebp - 4], 0xe
call fcn.0040bfe0
mov eax, dword [ebp - 0x94]
lea ecx, [ebp - 0x90]
cmp eax, ecx
je 0x40de63
push eax
call fcn.004197a3
add esp, 4
mov edx, dword [ebp - 0x358]
or eax, 0xffffffff
mov byte [ebp - 4], 0xc
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40de85
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
lea ecx, [ebp - 0x34c]
call fcn.0040ed70
mov esi, dword [ebp - 0x34c]
cmp dword [esi - 0xc], 0x20
je 0x40decb
lea ecx, [ebp - 0x34c]
call fcn.00404969
push dword [ebp - 0x348]
call fcn.004197a3
add esp, 4
lea ecx, [ebp - 0x368]
call fcn.00406485
mov esi, dword [ebp - 0x34c]
jmp 0x40e042
mov eax, dword [ebp - 0x368]
mov byte [ebp - 4], 3
test eax, eax
je 0x40def7
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40def7
lea ecx, [ebp - 0x370]
mov byte [ebp - 4], 3
call fcn.00406485
mov edi, dword [ebp - 0x35c]
test ebx, ebx
je 0x40dfff
lea eax, [ebx + 1]
push eax
call fcn.004197a8
mov ecx, eax
lea eax, [ebx + 1]
push eax
push 0
push ecx
mov dword [ebp - 0x378], ecx
call fcn.00417900
mov ecx, dword [ebp - 0x360]
add esp, 0x10
push dword [esi - 0xc]
push esi
push ebx
push dword [ebp - 0x378]
push dword [ebp - 0x348]
call fcn.0040c2f0
push 3
push ebx
push dword [ebp - 0x378]
call fcn.00411260
mov ebx, eax
add esp, 0xc
mov dword [ebp - 0x364], ebx
test ebx, ebx
je 0x40e001
lea eax, [ebp - 0x344]
push eax
push 0
push ebx
call fcn.00411120
add esp, 0xc
test eax, eax
jne 0x40e001
mov eax, dword [ebp - 0x118]
inc eax
push eax
call fcn.004197a8
mov ecx, dword [ebp - 0x118]
inc ecx
mov dword [ebp - 0x37c], eax
push ecx
push 0
push eax
call fcn.00417900
push 3
push dword [ebp - 0x118]
push dword [ebp - 0x37c]
push 0
push ebx
call fcn.00411880
add esp, 0x24
test eax, eax
je 0x40dfbd
cmp eax, 0x600
jne 0x40e001
push dword [ebp - 0x118]
push dword [ebp - 0x37c]
call fcn.0040f3f0
mov ebx, dword [ebp - 0x360]
add esp, 8
mov dword [ebx], eax
call fcn.0040d420
test eax, eax
je 0x40dff7
xor eax, eax
cmp dword [ebx], eax
setne al
push eax
push str.md__d
call fcn.0040eab0
add esp, 8
mov ebx, dword [ebp - 0x364]
jmp 0x40e001
xor ebx, ebx
push dword [ebp - 0x348]
call fcn.004197a3
mov eax, dword [ebp - 0x378]
add esp, 4
test eax, eax
je 0x40e022
push eax
call fcn.004197a3
add esp, 4
mov eax, dword [ebp - 0x37c]
test eax, eax
je 0x40e035
push eax
call fcn.004197a3
add esp, 4
test ebx, ebx
je 0x40e042
push ebx
call fcn.004109e0
add esp, 4
mov eax, dword [ebp - 0x360]
xor ebx, ebx
cmp dword [eax], ebx
setne bl
mov byte [ebp - 4], 2
add esi, 0xfffffff0
or eax, 0xffffffff
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x40e06b
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
mov edx, dword [ebp - 0x380]
or esi, 0xffffffff
mov byte [ebp - 4], 1
add edx, 0xfffffff0
mov eax, esi
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40e08f
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 0
add edi, 0xfffffff0
mov eax, esi
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x40e0aa
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, dword [ebp - 0x350]
mov dword [ebp - 4], 0xffffffff
add eax, 0xfffffff0
lock xadd dword [eax + 0xc], esi
dec esi
test esi, esi
jg 0x40e0cc
mov ecx, dword [eax]
push eax
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, ebx
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00415247
mov esp, ebp
pop ebp
ret 8
push 0x80004005
call fcn.004031f8
push 0x80004005
call fcn.004031f8
push 0x80004005
call fcn.004031f8
push 0x80004005
call fcn.004031f8
push 0x80004005
call fcn.004031f8
push 0x80070057
call fcn.004031f8
int3