Function at 0x501488
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffb28
push esi
push edi
xor edx, edx
mov dword [ebp - 0x4c4], edx
mov dword [ebp - 0xec], eax
xor eax, eax
push ebp
push 0x501b88
push dword fs:[eax]
mov dword fs:[eax], esp
xor edx, edx
mov eax, dword [ebp - 0xec]
call sub.Vcl40.bpl__Comctrls_TProgressBar_SetPosition_qqri
mov eax, 0x52e
call sub.Vcl40.bpl__System__GetMem_qqrv
mov edx, dword [0x52dafc]
mov dword [edx], eax
mov eax, 0x52e
call sub.Vcl40.bpl__System__GetMem_qqrv
mov dword [ebp - 0x118], eax
mov byte [ebp - 0x110], 0
xor eax, eax
mov al, byte [ebp - 0x110]
lea eax, [eax + eax*2]
mov edx, dword [0x52d7ac]
mov edx, dword [edx]
lea edx, [edx + eax*2]
lea eax, [ebp - 0x108]
call sub.Vcl40.bpl__Sysutils_StrCopy_qqrpct1
call sub.Vcl40.bpl__Sysutils_StrUpper_qqrpc
lea eax, [ebp - 0x108]
push eax
lea eax, [ebp - 0x108]
push eax
call sub.user32.dll_CharToOemA
lea edx, [ebp - 0x4c4]
lea eax, [ebp - 0x108]
call sub.Vcl40.bpl__Sysutils_StrPas_qqrpc
mov edx, dword [ebp - 0x4c4]
lea eax, [ebp - 0x4c0]
mov ecx, 0xff
call sub.Vcl40.bpl__System__LStrToString_qqrv
lea edx, [ebp - 0x4c0]
xor eax, eax
mov al, byte [ebp - 0x110]
lea eax, [eax + eax*2]
mov ecx, dword [ebp - 0x118]
lea eax, [ecx + eax*2]
mov cl, 5
call sub.Vcl40.bpl__System__PStrNCpy_qqrv
inc byte [ebp - 0x110]
cmp byte [ebp - 0x110], 0xdd
jne 0x5014e5
mov eax, dword [ebp - 0x118]
mov edx, dword [0x52dafc]
mov edx, dword [edx]
mov esi, eax
mov edi, edx
mov ecx, 0x14b
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
mov eax, dword [0x52d654]
mov al, byte [eax]
test al, al
jbe 0x5016e2
mov byte [ebp - 0x127], al
mov byte [ebp - 0x111], 1
xor eax, eax
mov al, byte [ebp - 0x111]
mov edx, dword [0x52d48c]
mov edx, dword [edx]
cmp byte [edx + eax], 0
jne 0x5015e0
xor eax, eax
mov al, byte [ebp - 0x111]
mov edx, dword [0x52d46c]
mov edx, dword [edx]
cmp byte [edx + eax], 0
je 0x5016d0
xor eax, eax
mov al, byte [ebp - 0x111]
mov edx, dword [0x52d46c]
mov edx, dword [edx]
cmp byte [edx + eax], 0
jne 0x5015fd
mov byte [ebp - 0x10f], 0x30
inc byte [ebp - 0x10f]
cmp byte [ebp - 0x10f], 0x3a
jne 0x501613
mov byte [ebp - 0x10f], 0x41
lea eax, [ebp - 0x4cc]
push eax
xor eax, eax
mov al, byte [ebp - 0x111]
mov edx, dword [0x52d65c]
mov edx, dword [edx]
movzx eax, byte [edx + eax]
lea eax, [eax + eax*2]
mov edx, dword [ebp - 0x118]
lea eax, [edx + eax*2]
mov ecx, 4
mov edx, 1
call sub.Vcl40.bpl__System__Copy_qqrv
lea edx, [ebp - 0x4cc]
lea eax, [ebp - 0x4d4]
call sub.Vcl40.bpl__System__PStrCpy_qqrv
lea eax, [ebp - 0x4d8]
mov dl, byte [ebp - 0x10f]
mov byte [eax + 1], dl
mov byte [eax], 1
lea edx, [ebp - 0x4d8]
lea eax, [ebp - 0x4d4]
mov cl, 6
call sub.Vcl40.bpl__System__PStrNCat_qqrv
lea edx, [ebp - 0x4d4]
xor eax, eax
mov al, byte [ebp - 0x111]
mov ecx, dword [0x52d65c]
mov ecx, dword [ecx]
movzx eax, byte [ecx + eax]
lea eax, [eax + eax*2]
mov ecx, dword [0x52dafc]
mov ecx, dword [ecx]
lea eax, [ecx + eax*2]
mov cl, 5
call sub.Vcl40.bpl__System__PStrNCpy_qqrv
push ebp
xor eax, eax
mov al, byte [ebp - 0x111]
mov edx, dword [0x52d65c]
mov edx, dword [edx]
mov al, byte [edx + eax]
call fcn.00501318
pop ecx
test al, al
jne 0x5015fd
inc byte [ebp - 0x111]
dec byte [ebp - 0x127]
jne 0x5015b0
lea eax, [ebp - 0xdd]
xor ecx, ecx
mov edx, 0xdd
call sub.Vcl40.bpl__System__FillChar_qqrv
mov edx, 0x501ba0
mov eax, 0x501bb4
call fcn.0043bc58
lea edx, [ebp - 0x4c4]
mov eax, dword [0x52d950]
mov eax, dword [eax]
call sub.Vcl40.bpl__Sysutils_StrPas_qqrpc
lea eax, [ebp - 0x4c4]
mov edx, 0x501ba0
call sub.Vcl40.bpl__System__LStrCat_qqrv
mov edx, dword [ebp - 0x4c4]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Assign_qqrrpvr28System__SmallString_iuc_255_
lea eax, [ebp - 0x102]
push eax
lea ecx, [ebp - 0x100]
lea edx, [ebp - 0xfc]
lea eax, [ebp - 0x278]
call fcn.0043c17c
mov edx, 1
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__ResetFile_qqrv
mov eax, dword [ebp - 0x100]
dec eax
test eax, eax
jl 0x501802
inc eax
mov dword [ebp - 0x12c], eax
mov dword [ebp - 0xf0], 0
movzx eax, word [ebp - 0x102]
imul dword [ebp - 0xf0]
add eax, dword [ebp - 0xfc]
mov dword [ebp - 0xf4], eax
mov eax, dword [0x52d534]
mov eax, dword [eax]
add dword [ebp - 0xf4], eax
mov edx, dword [ebp - 0xf4]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Seek_qqrv
push 0
mov edx, dword [0x52d898]
mov edx, dword [edx]
mov ecx, 5
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__BlockRead_qqrv
lea edx, [ebp - 0x10e]
mov ecx, 5
mov al, 5
call fcn.0043be88
push ebp
lea eax, [ebp - 0x10e]
call fcn.005012c8
pop ecx
inc dword [ebp - 0xf0]
dec dword [ebp - 0x12c]
jne 0x501784
mov eax, dword [ebp - 0x100]
mov dword [ebp - 0xf0], eax
mov eax, 0x120
call sub.Vcl40.bpl__System__GetMem_qqrv
mov dword [ebp - 0xe4], eax
lea eax, [ebp - 0x3c0]
xor ecx, ecx
mov edx, 0x48
call sub.Vcl40.bpl__System__FillChar_qqrv
mov eax, dword [0x52d654]
mov al, byte [eax]
test al, al
jbe 0x501ae4
mov byte [ebp - 0x127], al
mov byte [ebp - 0x111], 1
xor eax, eax
mov al, byte [ebp - 0x111]
imul eax, eax, 0x64
mov edx, dword [0x52d654]
movzx edx, byte [edx]
mov ecx, edx
xor edx, edx
div ecx
mov edx, eax
mov eax, dword [ebp - 0xec]
call sub.Vcl40.bpl__Comctrls_TProgressBar_SetPosition_qqri
xor eax, eax
mov al, byte [ebp - 0x111]
mov edx, dword [0x52d65c]
mov edx, dword [edx]
mov al, byte [edx + eax]
mov byte [ebp - 0x110], al
xor eax, eax
mov al, byte [ebp - 0x110]
cmp byte [ebp + eax - 0xdd], 0
jne 0x501ad2
lea eax, [ebp - 0x126]
push eax
lea ecx, [ebp - 0x124]
lea edx, [ebp - 0x120]
lea eax, [ebp - 0x11c]
call fcn.004278e4
lea eax, [ebp - 0x124]
push eax
lea eax, [ebp - 0x126]
push eax
lea eax, [ebp - 0x3c0]
push eax
xor eax, eax
mov al, byte [ebp - 0x110]
push eax
push 0
push 0
push 1
push 0
lea ecx, [ebp - 0x120]
lea edx, [ebp - 0xe4]
lea eax, [ebp - 0x11c]
call fcn.004264e8
push ebp
call fcn.00501388
pop ecx
test al, al
je 0x501aa9
movzx eax, word [ebp - 0x102]
imul dword [ebp - 0xf0]
add eax, dword [ebp - 0xfc]
mov dword [ebp - 0xf8], eax
mov eax, dword [ebp - 0xf8]
dec eax
mov dword [ebp - 0xf4], eax
mov edx, dword [ebp - 0xf4]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Seek_qqrv
push 0
movzx ecx, word [ebp - 0x102]
mov eax, dword [0x52d554]
mov eax, dword [eax]
lea edx, [eax + 1]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__BlockWrite_qqrv
mov eax, dword [ebp - 0xf8]
mov dword [ebp - 0xf4], eax
mov eax, dword [0x52d534]
mov eax, dword [eax]
add dword [ebp - 0xf4], eax
mov edx, dword [ebp - 0xf4]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Seek_qqrv
push 0
xor eax, eax
mov al, byte [ebp - 0x110]
lea eax, [eax + eax*2]
mov edx, dword [0x52dafc]
mov edx, dword [edx]
xor ecx, ecx
mov cl, byte [edx + eax*2]
xor eax, eax
mov al, byte [ebp - 0x110]
lea eax, [eax + eax*2]
mov edx, dword [0x52dafc]
mov edx, dword [edx]
lea edx, [edx + eax*2 + 1]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__BlockWrite_qqrv
mov eax, dword [ebp - 0xf8]
mov dword [ebp - 0xf4], eax
mov eax, dword [0x52d944]
mov eax, dword [eax]
add dword [ebp - 0xf4], eax
mov edx, dword [ebp - 0xf4]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Seek_qqrv
xor eax, eax
mov al, byte [ebp - 0x110]
mov edx, dword [0x52d574]
mov edx, dword [edx]
movsx eax, word [edx + eax*2]
lea edx, [ebp - 0x378]
call sub.Vcl40.bpl__System__Str0Long_qqrv
cmp byte [ebp - 0x378], 1
jne 0x501a4d
mov edx, 0x501bc0
lea eax, [ebp - 0x4c0]
call sub.Vcl40.bpl__System__PStrCpy_qqrv
lea edx, [ebp - 0x378]
lea eax, [ebp - 0x4c0]
call sub.Vcl40.bpl__System__PStrCat_qqrv
lea edx, [ebp - 0x4c0]
lea eax, [ebp - 0x378]
call sub.Vcl40.bpl__System__PStrCpy_qqrv
jmp 0x501a88
cmp byte [ebp - 0x378], 2
jne 0x501a88
mov edx, 0x501bc4
lea eax, [ebp - 0x4c0]
call sub.Vcl40.bpl__System__PStrCpy_qqrv
lea edx, [ebp - 0x378]
lea eax, [ebp - 0x4c0]
call sub.Vcl40.bpl__System__PStrCat_qqrv
lea edx, [ebp - 0x4c0]
lea eax, [ebp - 0x378]
call sub.Vcl40.bpl__System__PStrCpy_qqrv
push 0
xor ecx, ecx
mov cl, byte [ebp - 0x378]
lea edx, [ebp - 0x377]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__BlockWrite_qqrv
inc dword [ebp - 0xf0]
lea eax, [ebp - 0xe4]
call fcn.00427998
lea eax, [ebp - 0x126]
push eax
lea ecx, [ebp - 0x124]
lea edx, [ebp - 0x120]
lea eax, [ebp - 0x11c]
call fcn.00427a1c
inc byte [ebp - 0x111]
dec byte [ebp - 0x127]
jne 0x50184c
mov edx, 0x120
mov eax, dword [ebp - 0xe4]
call sub.Vcl40.bpl__System__FreeMem_qqrv
movzx eax, word [ebp - 0x102]
imul dword [ebp - 0xf0]
add eax, dword [ebp - 0xfc]
mov dword [ebp - 0xf8], eax
mov eax, dword [ebp - 0xf8]
dec eax
mov dword [ebp - 0xf4], eax
mov edx, dword [ebp - 0xf4]
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Seek_qqrv
push 0
mov edx, dword [0x52d914]
mov ecx, 1
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__BlockWrite_qqrv
lea eax, [ebp - 0x278]
mov edx, dword [ebp - 0xf0]
call fcn.0043c214
lea eax, [ebp - 0x278]
call sub.Vcl40.bpl__System__Close_qqrv
mov edx, 0x52e
mov eax, dword [ebp - 0x118]
call sub.Vcl40.bpl__System__FreeMem_qqrv
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x501b8f
lea eax, [ebp - 0x4c4]
call sub.Vcl40.bpl__System__LStrClr_qqrr17System_AnsiString
ret