Function at 0x407075
Capabilities:
Encrypt or decrypt via wincrypt

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
mov eax, dword [esi + 0x18]
and dword [ebp - 0x10], 0
mov dword [ebp - 4], 0x8004
cmp eax, 0x8009
je 0x407093
mov dword [ebp - 4], eax
push ebx
push edi
push dword [ebp - 4]
call fcn.00403d6c
push dword [esi + 0x1c]
mov edi, eax
call fcn.00403e3e
push dword [esi + 0x1c]
mov dword [ebp - 0x14], eax
call fcn.00403dcf
mov ebx, eax
mov eax, edi
xor edx, edx
div ebx
mov eax, dword [ebp + 0x10]
lea ecx, [esi + 0x24]
add esp, 0xc
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0xc], ecx
add edi, edx
lea eax, [edi + eax + 0x10]
mov dword [ecx], eax
add eax, ebx
mov ebx, dword [sym.imp.KERNEL32.dll_LocalAlloc]
push eax
push 0x40
call ebx
mov dword [esi + 0x20], eax
test eax, eax
je 0x407253
push 0x10
push eax
call sub.cryptdll.dll_CDGenerateRandomBits
mov eax, dword [esi + 0x20]
push edi
lea ecx, [eax + 0x10]
push ecx
push 0x10
push eax
mov eax, dword [ebp - 4]
push 0x14
push dword [ebp + 8]
call fcn.00403588
add esp, 0x18
test eax, eax
je 0x407241
mov eax, dword [esi + 0x20]
push edi
add eax, 0x10
push eax
push dword [ebp + 0x10]
push dword [ebp + 0xc]
push edi
push eax
mov eax, dword [ebp - 4]
call fcn.00403588
add esp, 0x18
test eax, eax
je 0x407241
push dword [ebp + 0x10]
mov eax, dword [esi + 0x20]
push dword [ebp + 0xc]
lea eax, [eax + edi + 0x10]
push eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x14]
add esp, 0xc
lea edi, [eax + ecx]
push edi
push 0x40
call ebx
mov ebx, eax
test ebx, ebx
je 0x407241
push 1
push edi
push ebx
push dword [esi + 0x14]
lea eax, [esi + 4]
push eax
push 0x14
push dword [ebp + 8]
push dword [ebp - 4]
push 0x10
pop eax
call fcn.004036a9
add esp, 0x20
test eax, eax
je 0x407234
mov edi, dword [ebp - 0x14]
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 8]
push eax
push 0
push edi
push ebx
push dword [esi + 0x1c]
call fcn.00403b70
add esp, 0x18
test eax, eax
je 0x407221
push 0
lea eax, [ebx + edi]
push eax
push 1
push dword [ebp - 8]
call dword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
je 0x4071fd
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax]
mov edi, dword [ebp - 0x18]
add ecx, edi
push ecx
push eax
push dword [esi + 0x20]
push 0
push 1
push 0
push dword [ebp - 8]
call dword [sym.imp.ADVAPI32.dll_CryptEncrypt]
mov dword [ebp - 0x10], eax
test eax, eax
je 0x4071ea
mov eax, dword [ebp - 0xc]
sub dword [eax], edi
jmp 0x4071fd
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___CryptEncrypt__0x_08x__n
call fcn.00409709
pop ecx
pop ecx
push dword [ebp - 8]
call dword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
push dword [ebp - 0x1c]
call fcn.004034e7
pop ecx
test eax, eax
jne 0x407234
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___kull_m_crypto_close_hprov_delete_container__0x_08x__n
jmp 0x40722d
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___kull_m_crypto_hkey_session__0x_08x__n
call fcn.00409709
pop ecx
pop ecx
push ebx
call dword [sym.imp.KERNEL32.dll_LocalFree]
cmp dword [ebp - 0x10], 0
jne 0x407253
push dword [esi + 0x20]
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov dword [esi + 0x20], eax
mov eax, dword [ebp - 0xc]
and dword [eax], 0
mov eax, dword [ebp - 0x10]
pop edi
pop ebx
leave
ret