Function at 0x402c60
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x30
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x44]
test edi, edi
je 0x402ffd
mov ebp, dword [sym.imp.KERNEL32.DLL_GlobalLock]
push edi
call ebp
mov esi, eax
cmp word [esi + 0xe], 1
je 0x402c96
push edi
call dword [sym.imp.KERNEL32.DLL_GlobalUnlock]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x30
ret
mov ebx, dword [esi + 4]
mov edx, dword [esi + 8]
mov dword [esp + 0x2c], ebx
mov dword [esp + 0x18], edx
lea ecx, [ebx*8 + 0x1f]
lea eax, [ebx + 0x1f]
shr ecx, 5
shl ecx, 2
mov edi, ecx
mov dword [esp + 0x34], ecx
imul edi, edx
shr eax, 5
shl eax, 2
test edi, edi
mov dword [esp + 0x38], eax
je 0x402ff2
cmp ebx, 0xf3e58
ja 0x402ff2
cmp edx, 0xf3e58
ja 0x402ff2
mov eax, edi
xor edx, edx
div dword [esp + 0x18]
cmp eax, ecx
jb 0x402ff2
cmp edi, 0xfffffbd7
ja 0x402ff2
lea eax, [edi + 0x428]
push eax
push 0x40
call dword [sym.imp.KERNEL32.DLL_GlobalAlloc]
test eax, eax
mov dword [esp + 0x3c], eax
je 0x402ff2
push eax
call ebp
mov edx, dword [esp + 0x18]
xor ecx, ecx
mov dword [eax], 0x28
mov dword [eax + 4], ebx
mov dword [eax + 8], edx
mov word [eax + 0xc], 1
mov word [eax + 0xe], 8
mov dword [eax + 0x10], ecx
mov dword [eax + 0x14], edi
mov edx, dword [esi + 0x18]
mov dword [eax + 0x18], edx
mov edx, dword [esi + 0x1c]
mov dword [eax + 0x1c], edx
mov dword [eax + 0x20], 0x100
mov dword [eax + 0x24], ecx
mov cl, byte [esi + 0x29]
mov byte [esp + 0x14], cl
mov cl, byte [esi + 0x28]
mov dl, byte [esi + 0x2a]
mov byte [esp + 0x15], cl
mov cl, byte [esi + 0x2e]
mov byte [esp + 0x13], cl
mov cl, byte [esi + 0x2d]
mov byte [esp + 0x16], cl
mov cl, byte [esi + 0x2c]
test dl, dl
mov byte [esp + 0x17], cl
jne 0x402daa
mov cl, byte [esp + 0x14]
test cl, cl
jne 0x402dd3
mov cl, byte [esp + 0x15]
test cl, cl
jne 0x402dd3
cmp byte [esp + 0x13], 0xff
jne 0x402dd3
cmp byte [esp + 0x16], 0xff
jne 0x402dd3
cmp byte [esp + 0x17], 0xff
jmp 0x402dd1
cmp dl, 0xff
jne 0x402dd3
cmp byte [esp + 0x14], dl
jne 0x402dd3
cmp byte [esp + 0x15], dl
jne 0x402dd3
mov cl, byte [esp + 0x13]
test cl, cl
jne 0x402dd3
mov cl, byte [esp + 0x16]
test cl, cl
jne 0x402dd3
mov cl, byte [esp + 0x17]
test cl, cl
je 0x402e1c
lea ecx, [eax + 0x29]
mov edi, 0x80
mov bl, byte [esp + 0x14]
mov byte [ecx + 1], dl
mov byte [ecx], bl
mov bl, byte [esp + 0x15]
mov byte [ecx - 1], bl
add ecx, 4
dec edi
jne 0x402ddb
mov dl, byte [esp + 0x13]
lea ecx, [eax + 0x229]
mov edi, 0x80
mov bl, byte [esp + 0x16]
mov byte [ecx + 1], dl
mov byte [ecx], bl
mov bl, byte [esp + 0x17]
mov byte [ecx - 1], bl
add ecx, 4
dec edi
jne 0x402e00
mov ebx, dword [esp + 0x2c]
jmp 0x402e5c
cmp dl, byte [esp + 0x13]
jbe 0x402e43
xor edx, edx
lea edi, [eax + 0x29]
or cl, 0xff
add edi, 4
sub cl, dl
inc edx
mov byte [edi - 3], cl
mov byte [edi - 4], cl
mov byte [edi - 5], cl
cmp edx, 0x100
jb 0x402e27
jmp 0x402e5c
xor ecx, ecx
lea edx, [eax + 0x29]
mov byte [edx + 1], cl
mov byte [edx], cl
mov byte [edx - 1], cl
inc ecx
add edx, 4
cmp ecx, 0x100
jb 0x402e48
mov edx, dword [esi + 0x20]
lea ecx, [esi + edx*4 + 0x28]
mov edx, dword [eax + 0x20]
mov dword [esp + 0x1c], ecx
lea edi, [eax + edx*4 + 0x28]
mov eax, dword [esp + 0x18]
test eax, eax
jbe 0x402fd4
mov ebp, ebx
mov dword [esp + 0x2c], eax
shr ebp, 3
lea ecx, [ebp*8]
sub ebx, ecx
mov edx, ebx
xor ebx, ebx
xor ecx, ecx
mov dword [esp + 0x20], edx
mov dword [esp + 0x28], ebx
mov dword [esp + 0x24], ecx
mov eax, ecx
xor ecx, ecx
test ebp, ebp
jbe 0x402f5e
mov edx, dword [esp + 0x1c]
lea esi, [ebx + edx]
mov dl, byte [esi + ecx]
and dl, 0x80
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 0x40
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 0x20
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 0x10
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 8
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 4
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 2
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
mov dl, byte [esi + ecx]
and dl, 1
inc eax
neg dl
sbb dl, dl
and edx, 0xff
mov byte [edi + eax], dl
inc eax
inc ecx
cmp ecx, ebp
jb 0x402eb1
mov edx, dword [esp + 0x20]
test edx, edx
jbe 0x402fad
mov esi, dword [esp + 0x1c]
lea ecx, [ebx + ebp]
mov dword [esp + 0x18], edx
mov cl, byte [ecx + esi]
mov byte [esp + 0x30], cl
mov ecx, 7
mov esi, dword [esp + 0x30]
and esi, 0xff
add eax, edi
mov edx, 1
shl edx, cl
test esi, edx
je 0x402f95
mov byte [eax], 0xff
jmp 0x402f98
mov byte [eax], 0
mov edx, dword [esp + 0x18]
inc eax
dec ecx
dec edx
mov dword [esp + 0x18], edx
jne 0x402f85
mov ebx, dword [esp + 0x28]
mov edx, dword [esp + 0x20]
mov ecx, dword [esp + 0x24]
mov eax, dword [esp + 0x34]
mov esi, dword [esp + 0x38]
add ecx, eax
mov eax, dword [esp + 0x2c]
add ebx, esi
dec eax
mov dword [esp + 0x24], ecx
mov dword [esp + 0x28], ebx
mov dword [esp + 0x2c], eax
jne 0x402e9e
mov eax, dword [esp + 0x44]
mov esi, dword [sym.imp.KERNEL32.DLL_GlobalUnlock]
push eax
call esi
mov edi, dword [esp + 0x3c]
push edi
call esi
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
mov ecx, dword [esp + 0x44]
push ecx
call dword [sym.imp.KERNEL32.DLL_GlobalUnlock]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x30
ret