Function at 0x10509db
Capabilities:
Check mutex on windows
Query environment variable
Query or enumerate registry value
Set registry value

Disassembly:
mov eax, reloc.ADVAPI32.dll_AddAccessAllowedAce
call fcn.01077798
sub esp, 0x90
mov eax, dword [0x10de03c]
push ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x10], eax
mov dword [ebp - 0x84], edi
call fcn.01021462
mov ebx, eax
mov eax, dword [ebp + 8]
xor esi, esi
sub eax, esi
mov dword [ebp - 0x64], ebx
je 0x1050a43
dec eax
jne 0x1050d53
call fcn.01021478
push eax
push edi
call dword [sym.imp.msvcrt.dll_wcscpy]
mov esi, dword [sym.imp.msvcrt.dll_wcscat]
push 0x100a584
push edi
call esi
push 0x1005a94
push edi
call esi
add esp, 0x18
jmp 0x1050d53
cmp dword [ebx + 0xbec], esi
je 0x1050a73
push 0x104
push edi
push 0x100a544
mov word [edi], si
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
push edi
call fcn.0105089c
mov word [ebx + reloc.ADVAPI32.dll_RegDeleteValueW], 4
jmp 0x1050d53
call fcn.01050891
push eax
push edi
call dword [sym.imp.msvcrt.dll_wcscpy]
cmp word [edi], si
pop ecx
pop ecx
jne 0x1050d53
mov ebx, dword [sym.imp.ADVAPI32.dll_RegCreateKeyExW]
lea eax, [ebp - 0x88]
push eax
lea eax, [ebp - 0x68]
push eax
push esi
push 0x2000000
push esi
push esi
push esi
push 0x100a0f0
mov edi, WaitForSingleObject
push edi
call ebx
push dword [ebp - 0x68]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea eax, [ebp - 0x88]
push eax
lea eax, [ebp - 0x68]
push eax
push esi
push 0x2000000
push esi
push esi
push esi
push 0x100a4f8
push edi
call ebx
cmp eax, esi
jne 0x1050d53
push 0x100a4c8
push esi
push esi
mov dword [ebp - 0x94], 0x28
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
cmp eax, esi
mov dword [ebp - 0x8c], eax
je 0x1050b0c
push 0x2710
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [ebp - 0x94]
push eax
lea eax, [ebp - 0x60]
push eax
lea eax, [ebp - 0x98]
push eax
push esi
push reloc.MFC42u.DLL_CView::OnEndPrintPreview
push dword [ebp - 0x68]
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
test eax, eax
mov edi, dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
je 0x1050b53
push 4
lea eax, [ebp - 0x7c]
push eax
push 4
push esi
push reloc.MFC42u.DLL_CView::OnEndPrintPreview
push dword [ebp - 0x68]
mov dword [ebp - 0x7c], 0xa
call edi
jmp 0x1050b59
mov eax, dword [ebp - 0x60]
mov dword [ebp - 0x7c], eax
cmp dword [ebp - 0x7c], esi
mov dword [ebp - 0x80], esi
mov dword [ebp - 0x70], esi
jle 0x1050c1b
lea ecx, [ebp - 0x74]
call fcn.01075e60
mov eax, dword [ebp - 0x70]
inc eax
push eax
mov dword [ebp - 0x78], eax
lea eax, [ebp - 0x74]
push reloc.MFC42u.DLL_CView::OnEndPrintPreview
push eax
mov dword [ebp - 4], esi
call fcn.01075e84
add esp, 0xc
lea eax, [ebp - 0x88]
push eax
lea eax, [ebp - 0x6c]
push eax
push esi
push 0x2000000
push esi
push esi
push esi
push dword [ebp - 0x74]
push dword [ebp - 0x68]
call ebx
test eax, eax
jne 0x1050bf2
lea eax, [ebp - 0x90]
push eax
lea eax, [ebp - 0x38]
push eax
lea eax, [ebp - 0x9c]
push eax
push esi
push 0x100a478
push dword [ebp - 0x6c]
mov dword [ebp - 0x90], 0x28
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
test eax, eax
jne 0x1050c0f
mov eax, dword [ebp - 0x80]
cmp eax, dword [ebp - 0x38]
jg 0x1050c0f
push dword [ebp - 0x6c]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov eax, dword [ebp - 0x38]
mov dword [ebp - 0x80], eax
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x74]
call fcn.01075e24
mov eax, dword [ebp - 0x78]
cmp eax, dword [ebp - 0x7c]
mov dword [ebp - 0x70], eax
jl 0x1050b68
jmp 0x1050c1b
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x74]
call fcn.01075e24
mov eax, dword [ebp - 0x7c]
cmp dword [ebp - 0x70], eax
jne 0x1050c44
lea eax, [ebp - 0x88]
push eax
lea eax, [ebp - 0x6c]
push eax
push esi
push 0x2000000
push esi
push esi
push esi
push reloc.MFC42u.DLL_CView::OnEndPrintPreview
push dword [ebp - 0x68]
call ebx
mov dword [ebp - 0x70], esi
lea eax, [ebp - 0x80]
push eax
call dword [sym.imp.msvcrt.dll_time]
mov ebx, dword [ebp - 0x64]
cmp word [ebx + reloc.ADVAPI32.dll_RegDeleteValueW], 2
pop ecx
jne 0x1050d23
push 4
lea eax, [ebp - 0x80]
push eax
push 4
push esi
push 0x100a478
push dword [ebp - 0x6c]
call edi
add ebx, 0x8b8
push ebx
lea ecx, [ebp - 0x64]
call fcn.010761cc
mov eax, dword [ebp - 0x64]
xor ebx, ebx
inc ebx
cmp dword [eax - 8], esi
mov dword [ebp - 4], ebx
jne 0x1050c9d
push 0x2779
lea ecx, [ebp - 0x64]
call fcn.01075e90
mov eax, dword [ebp - 0x64]
mov eax, dword [eax - 8]
add eax, eax
push eax
push esi
lea ecx, [ebp - 0x64]
call fcn.01076304
push eax
push ebx
push esi
push 0x100a458
push dword [ebp - 0x6c]
call edi
call fcn.01021478
push eax
push dword [ebp - 0x84]
call dword [sym.imp.msvcrt.dll_wcscpy]
pop ecx
pop ecx
lea ecx, [ebp - 0x78]
call fcn.01075e60
mov eax, dword [ebp - 0x70]
inc eax
push eax
lea eax, [ebp - 0x78]
push 0x100a438
push eax
mov byte [ebp - 4], 2
call fcn.01075e84
push dword [ebp - 0x78]
push dword [ebp - 0x84]
call dword [sym.imp.msvcrt.dll_wcscat]
add esp, 0x14
push dword [ebp - 0x84]
call fcn.0105089c
lea ecx, [ebp - 0x78]
mov byte [ebp - 4], bl
call fcn.01075e24
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x64]
call fcn.01075e24
push dword [ebp - 0x6c]
mov edi, dword [sym.imp.ADVAPI32.dll_RegCloseKey]
call edi
push dword [ebp - 0x68]
call edi
cmp dword [ebp - 0x8c], esi
je 0x1050d53
push dword [ebp - 0x8c]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [ebp - 0x8c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
mov dword fs:[0], ecx
mov ecx, dword [ebp - 0x10]
pop ebx
call fcn.01075aef
leave
ret 4