Function at 0x404007
Capabilities:
Check for time delay via gettickcount
Encode data using xor
Generate random numbers using the delphi lcg
Get file size
Get system information on windows
Read file via mapping
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x91c
push ebx
push esi
push edi
call fcn.00403bd5
mov esi, dword [sym.imp.KERNEL32.dll_GetTickCount]
call esi
and eax, 0x11
cmp eax, 0x111
je 0x404453
call esi
mov ebx, dword [esp + 0x14]
mov dword [0x40500c], eax
call fcn.00403cca
mov ecx, eax
sub ecx, dword [0x40500c]
push 3
xor edx, edx
mov eax, ecx
pop esi
div esi
test ecx, 0xffff8000
jne 0x4042ec
xor eax, eax
xor edi, edi
mov dword [esp + 0x924], edi
mov word [esp + 0x510], ax
mov dword [esp + 0x50c], edi
mov word [esp + 0xf8], ax
call fcn.00403cca
mov ecx, eax
sub ecx, dword [0x40500c]
xor edx, edx
mov eax, ecx
div esi
test ecx, 0xffff8000
jne 0x4041cf
lea eax, [esp + 0xd4]
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemInfo]
xor esi, esi
mov dword [esp + 0x30], esi
mov dword [esp + 0x34], edi
mov dword [esp + 0x14], edi
push 0x1c
lea eax, [esp + 0x50]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_VirtualQuery]
test eax, eax
je 0x404503
mov eax, dword [esp + 0x4c]
xor edx, edx
div dword [esp + 0xf0]
test edx, edx
jne 0x404115
mov eax, 0x1000
cmp dword [esp + 0x58], eax
jne 0x404115
cmp dword [esp + 0x5c], eax
jne 0x404115
cmp dword [esp + 0x64], 0x20000
jne 0x404115
cmp dword [esp + 0x60], 4
jne 0x404115
cmp dword [esi], 0x696d7678
jne 0x404115
cmp dword [esi + 4], 0x74636a6e
je 0x404135
add esi, dword [esp + 0x58]
adc dword [esp + 0x34], edi
mov dword [esp + 0x30], esi
cmp dword [esp + 0x34], edi
ja 0x404131
jb 0x4040bb
cmp esi, 0x7fff0000
jb 0x4040bb
mov esi, dword [esp + 0x14]
mov dword [esp + 0x14], edi
mov dword [esp + 0x3c], edi
cmp esi, edi
je 0x40418a
push edi
push edi
push edi
push 6
push dword [esi + 0x18]
mov esi, dword [sym.imp.KERNEL32.dll_MapViewOfFile]
call esi
mov dword [esp + 0x14], eax
cmp eax, edi
je 0x404542
push edi
push edi
push edi
push 6
push dword [eax + 0x1c]
call esi
mov dword [esp + 0x3c], eax
cmp eax, edi
je 0x404552
mov ecx, dword [eax + 0x4c]
add ecx, eax
mov eax, dword [eax + 0x48]
push ecx
lea esi, [esp + 0x514]
call fcn.004047b7
jmp 0x4041b1
push 0x104
lea eax, [esp + 0x514]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea ecx, [esp + 0x510]
call fcn.0040473d
mov dword [esp + 0x924], eax
call fcn.00403cca
mov ecx, eax
sub ecx, dword [0x40500c]
push 3
xor edx, edx
mov eax, ecx
pop esi
div esi
test ecx, 0xffff8000
je 0x4041d6
cmp edx, edi
jmp 0x4042ee
lea eax, [esp + 0x510]
push eax
or eax, 0xffffffff
lea esi, [esp + 0xfc]
call fcn.004047b7
push 0x4010c4
or eax, 0xffffffff
call fcn.004047b7
push edi
push edi
push 3
push edi
push 7
push 0x80000000
lea eax, [esp + 0x528]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
je 0x404562
call fcn.00403c0e
test eax, eax
jne 0x40403c
xor edi, edi
push edi
push edi
push edi
push 2
push edi
push dword [esp + 0x24]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [esp + 0x1c], eax
cmp eax, edi
je 0x404572
mov esi, dword [sym.imp.KERNEL32.dll_MapViewOfFile]
push 0x1000
push edi
push edi
push 4
push eax
call esi
mov dword [esp + 0x18], eax
cmp eax, edi
je 0x404582
mov edi, eax
call fcn.00403c47
push dword [esp + 0x18]
mov edi, eax
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
lea eax, [esp + 0xa0]
push eax
push dword [esp + 0x14]
call dword [sym.imp.KERNEL32.dll_GetFileInformationByHandle]
test eax, eax
je 0x404592
xor eax, eax
cmp dword [esp + 0xc0], eax
jne 0x4042af
cmp dword [esp + 0xc4], edi
jbe 0x404736
add edi, 0x1000
push edi
push eax
push eax
push 4
push dword [esp + 0x2c]
call esi
mov edi, eax
mov dword [esp + 0x18], edi
test edi, edi
je 0x4045a2
call fcn.00403cca
mov ecx, eax
sub ecx, dword [0x40500c]
push 3
xor edx, edx
mov eax, ecx
pop esi
div esi
test ecx, 0xffff8000
je 0x404302
test edx, edx
je 0x40466d
cmp edx, 1
je 0x40403c
jmp 0x404457
call fcn.00403c47
add eax, edi
mov ecx, dword [eax]
push 4
pop esi
add eax, esi
cmp ecx, 0x6d7678
jne 0x4045b2
mov ecx, dword [eax]
add eax, esi
cmp ecx, 3
jne 0x4045c1
mov ecx, dword [eax]
mov edx, ecx
imul edx, edx, 0x8088405
add eax, esi
mov edi, dword [eax]
inc edx
mov ebx, edx
xor ebx, ecx
add eax, esi
mov dword [esp + 0x28], edx
cmp ebx, edi
jne 0x4045d0
mov edi, dword [eax]
mov ecx, edx
imul ecx, ecx, 0x8088405
inc ecx
mov ebx, ecx
xor ebx, edx
add eax, esi
cmp ebx, edi
jne 0x4045df
mov edx, dword [eax]
imul ecx, ecx, 0x8088405
inc ecx
xor edx, ecx
imul ecx, ecx, 0x8088405
push dword [esp + 0x18]
add eax, esi
mov esi, dword [eax]
inc ecx
xor esi, ecx
imul ecx, ecx, 0x2b9ad7e7
add eax, 8
mov edi, eax
sub edi, dword [esp + 0x1c]
mov ebx, 0x8088406
sub ebx, ecx
xor ebx, dword [eax]
add edi, 4
add ebx, edi
mov dword [esp + 0x30], edx
mov dword [esp + 0x28], esi
add ebx, esi
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
push eax
push eax
push eax
push 8
push eax
push dword [esp + 0x24]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [esp + 0x1c], eax
test eax, eax
je 0x4045ee
lea ecx, [edi + esi]
push ecx
push 0
push 0
push 1
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
xor ecx, ecx
mov dword [esp + 0x18], eax
cmp eax, ecx
je 0x4045fe
add eax, edi
mov dword [esp + 0x20], eax
cmp esi, ecx
jbe 0x40441a
mov edx, dword [esp + 0x28]
imul edx, edx, 0x343fd
add edx, 0x269ec3
mov dword [esp + 0x28], edx
shr edx, 0x10
xor byte [eax], dl
inc eax
dec esi
jne 0x4043fd
lea esi, [esp + 0x68]
mov dword [esp + 0x88], ecx
mov dword [esp + 0x8c], ecx
mov dword [esp + 0x90], ecx
mov dword [esp + 0x6c], ecx
mov dword [esp + 0x68], ecx
call fcn.00403b60
test eax, eax
je 0x404457
call fcn.004047fa
push 0x40128c
jmp 0x4046be
mov ebx, dword [esp + 0x14]
push 4
push 0x1000
push dword [esp + 0x34]
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov esi, eax
call fcn.00403cca
mov ecx, eax
sub ecx, dword [0x40500c]
push 3
xor edx, edx
mov eax, ecx
pop edi
div edi
test ecx, 0xffff8000
jne 0x4044ed
mov eax, dword [esp + 0x24]
mov dword [esp + 0x6c], eax
mov eax, dword [esp + 0x20]
mov dword [esp + 0x68], eax
mov eax, dword [esp + 0x2c]
mov dword [esp + 0x78], eax
lea eax, [esp + 0x68]
push eax
mov dword [esp + 0x78], esi
call fcn.00402cb0
pop ecx
cmp eax, 1
jne 0x40460e
push dword [esp + 0x18]
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
call fcn.00403cca
mov ecx, eax
sub ecx, dword [0x40500c]
xor edx, edx
mov eax, ecx
div edi
test ecx, 0xffff8000
je 0x40461d
test edx, edx
je 0x40466d
cmp edx, 1
jne 0x404457
jmp 0x40403c
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push 0x4010b0
or eax, 0xffffffff
lea esi, [esp + 0xfc]
call fcn.004047b7
push 0xa
mov eax, edi
mov ecx, esi
call fcn.0040474e
push 0x4010c4
or eax, 0xffffffff
call fcn.004047b7
mov eax, dword [esp + 0x30]
push 0x10
jmp 0x4046a5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401160
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401174
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401188
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4011d4
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4011e8
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4011fc
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401210
jmp 0x404690
call fcn.004047fa
push 0x401224
jmp 0x4046be
call fcn.004047fa
push 0x401234
jmp 0x4046be
call fcn.004047fa
push 0x401244
jmp 0x4046be
call fcn.004047fa
push 0x401254
jmp 0x4046be
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401264
jmp 0x404690
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401278
jmp 0x404690
call fcn.004047fa
push 0x40129c
jmp 0x4046be
push esi
call fcn.00403d8f
mov dword [esp], 0x8000
push dword [esp + 0x30]
mov edi, eax
push esi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
test edi, edi
je 0x4046cb
push edi
call fcn.00403c94
pop ecx
push edi
call fcn.00403cf7
pop ecx
mov dword [esp + 0x24], eax
test eax, eax
jne 0x404661
call fcn.004047fa
push 0x4012b4
jmp 0x4046be
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
mov dword [esp + 0x20], eax
xor edi, edi
push edi
push edi
push edi
push 2
push edi
push dword [esp + 0x24]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov esi, eax
cmp esi, edi
jne 0x4046f4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4012c4
mov edi, eax
or eax, 0xffffffff
lea esi, [esp + 0xfc]
call fcn.004047b7
mov eax, edi
push 0xa
lea ecx, [esp + 0xfc]
call fcn.0040474e
call fcn.004047fa
lea eax, [esp + 0xf8]
push eax
or eax, 0xffffffff
mov esi, 0x405010
call fcn.004047b7
push 0x4012d8
push 0x4012e4
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
push 0x10
push 0x401300
push 0x405010
push 0
call eax
jmp 0x404736
lea eax, [esp + 0x40]
push eax
push dword [esp + 0x14]
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
push dword [esp + 0x10]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [esp + 0x3c]
add ebx, 0xffff
push dword [esp + 0x18]
shr ebx, 0x10
shl ebx, 0x10
push ebx
push dword [esp + 0x50]
push dword [esp + 0x50]
push esi
push dword [esp + 0x38]
call dword [esp + 0x40]
add esp, 0x1c
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret