Function at 0x409950
Capabilities:
Encrypt or decrypt via wincrypt
Get file size
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x10
mov eax, dword [ebp + 8]
test eax, eax
push esi
mov dword [ebp - 0x10], ecx
je 0x40996b
cmp dword [ebp + 0xc], 0
je 0x40996b
xor esi, esi
jmp 0x409970
mov esi, 0x80070057
test esi, esi
mov dword [ebp - 8], 0
jl 0x409b66
cmp dword [ecx + 4], 0
jne 0x409991
mov eax, 0x80070005
pop esi
mov esp, ebp
pop ebp
ret 8
push edi
push 0
push 0x80
push 3
push 0
push 1
push SysReAllocStringLen
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
mov dword [ebp - 4], edi
jne 0x4099cb
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x4099c9
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
test esi, esi
jl 0x409b50
push ebx
push 0
push edi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x409a8a
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x4099fc
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
test esi, esi
jl 0x409b4f
push ebx
push 2
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov edi, eax
test edi, edi
mov dword [ebp + 8], edi
jne 0x409a2e
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x409a2c
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
test esi, esi
jl 0x409b17
push edi
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov edi, eax
test edi, edi
jne 0x409a59
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x409a57
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
test esi, esi
jl 0x409aeb
mov ecx, dword [ebp - 4]
push 0
lea eax, [ebp - 0xc]
push eax
push ebx
push edi
push ecx
mov dword [ebp - 0xc], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x409a9c
cmp dword [ebp - 0xc], ebx
je 0x409ab2
mov esi, 0x8000ffff
jmp 0x409aeb
test ebx, ebx
jne 0x4099fe
mov esi, 0x800710d2
jmp 0x409b4f
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x409ab0
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
test esi, esi
jl 0x409aeb
mov eax, dword [ebp - 0x10]
mov ecx, dword [eax + 4]
lea edx, [ebp - 8]
push edx
push edi
push 0
push 1
push 0
push ecx
mov dword [ebp - 8], ebx
call dword [sym.imp.ADVAPI32.dll_CryptDecrypt]
test eax, eax
jne 0x409aeb
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x409ae9
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
test edi, edi
je 0x409af9
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
test esi, esi
jl 0x409b14
mov eax, dword [ebp - 8]
mov ecx, dword [ebp + 8]
push 2
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_GlobalReAlloc]
test eax, eax
je 0x409b26
mov dword [ebp + 8], eax
mov edi, dword [ebp + 8]
test edi, edi
je 0x409b4c
test esi, esi
jl 0x409b45
mov edx, dword [ebp + 0xc]
mov dword [edx], edi
jmp 0x409b4c
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
mov edi, dword [ebp + 8]
jg 0x409b37
mov esi, eax
jmp 0x409b17
and eax, 0xffff
or eax, 0x80070000
mov esi, eax
jmp 0x409b17
push edi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov edi, dword [ebp - 4]
pop ebx
cmp edi, 0xffffffff
je 0x409b5c
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
mov eax, esi
pop esi
mov esp, ebp
pop ebp
ret 8
mov eax, esi
pop esi
mov esp, ebp
pop ebp
ret 8