Function at 0x40d4b0
Capabilities:
Check if file exists
Get common file path
Query or enumerate registry value
Set registry value

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x566023
mov eax, dword fs:[0]
push eax
sub esp, 0x27c
mov eax, dword [0x5d51c0]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov ebx, ecx
mov dword [ebp - 0x27c], ebx
lea ecx, [ebp - 0x30]
mov dword [ebp - 0x280], 0
call fcn.00432cb0
push 0x104
lea edi, [ebx + 0x29c]
mov dword [ebp - 4], 0
push edi
lea ecx, [ebx + 0x118]
mov dword [ebp - 0x270], 0
call fcn.0042e9d9
mov esi, dword [sym.imp.ADVAPI32.dll_RegCreateKeyW]
lea eax, [ebp - 0x270]
push eax
push str.SoftwareHncPath
push SysReAllocString
call esi
mov ebx, dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
test eax, eax
jne 0x40d566
push 0x104
push edi
push 1
push 0
push str.Work
push dword [ebp - 0x270]
call ebx
push dword [ebp - 0x270]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea ecx, [ebp - 0x30]
mov dword [ebp - 4], 0xffffffff
call fcn.00432e61
mov edi, dword [sym.imp.ADVAPI32.dll_RegOpenKeyW]
lea eax, [ebp - 0x26c]
push eax
push str.SoftwareHNCHwp9.6HwpFrameAppState
push SysReAllocString
mov dword [ebp - 0x288], 0
mov byte [ebp - 0x274], 0
mov dword [ebp - 0x284], 4
mov dword [ebp - 0x278], 4
call edi
test eax, eax
jne 0x40d5f8
lea eax, [ebp - 0x278]
push eax
lea eax, [ebp - 0x288]
push eax
lea eax, [ebp - 0x284]
push eax
push 0
push str.HwpxFormatDefaults
push dword [ebp - 0x26c]
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
mov ecx, dword [ebp - 0x274]
test eax, eax
movzx ecx, cl
mov edx, 1
cmove ecx, edx
mov dword [ebp - 0x274], ecx
push dword [ebp - 0x26c]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov eax, dword [ebp - 0x27c]
push 0
push 0
push 0xf0
push dword [eax + 0x4c4]
call dword [sym.imp.USER32.dll_SendMessageW]
dec eax
cmp eax, 1
ja 0x40d9d6
mov dword [ebp - 0x280], 1
mov dword [ebp - method.CRegCtrl.virtual_0], vtable.CRegCtrl.0
push str.SoftwareHncHwp9.6
push SysReAllocString
lea ecx, [ebp - 0x278]
mov dword [ebp - 4], 1
call fcn.0041f650
lea eax, [ebp - 0x270]
mov dword [ebp - method.CRegCtrl.virtual_0], vtable.CRegCtrl.0
push eax
push 0xf003f
push 0
push str.SoftwareHncHwp
push SysReAllocString
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x40d767
lea eax, [ebp - 0x270]
push eax
push str.SoftwareHncHwp9.6
push SysReAllocString
call esi
test eax, eax
jne 0x40d767
lea eax, [ebp - 0x270]
mov dword [ebp - 0x26c], 1
push eax
push str.SoftwareHncHwp9.6Template
push SysReAllocString
call esi
test eax, eax
jne 0x40d713
push 4
lea eax, [ebp - 0x26c]
push eax
push 4
push 0
push str.Draw_NewInstall
push dword [ebp - 0x270]
call ebx
push 4
lea eax, [ebp - 0x26c]
push eax
push 4
push 0
push str.Doc_NewInstall
push dword [ebp - 0x270]
call ebx
push 4
lea eax, [ebp - 0x26c]
push eax
push 4
push 0
push str.Clipart_NewInstall
push dword [ebp - 0x270]
call ebx
lea eax, [ebp - 0x270]
push eax
push str.SoftwareHncHwp9.6HwpFrameAppState
push SysReAllocString
call esi
test eax, eax
jne 0x40d767
push 4
lea eax, [ebp - 0x26c]
push eax
push 4
push 0
push str.DocPasswordLevel
push dword [ebp - 0x270]
call ebx
cmp byte [ebp - 0x274], 1
jne 0x40d767
push 4
lea eax, [ebp - 0x288]
push eax
push 4
push 0
push str.HwpxFormatDefaults
push dword [ebp - 0x270]
call ebx
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x268], ax
lea eax, [ebp - 0x266]
push eax
call fcn.0054cbf0
add esp, 0xc
mov dword [ebp - 0x26c], 0
lea eax, [ebp - 0x26c]
mov dword [ebp - 0x274], 1
mov dword [ebp - 0x284], 0x104
push eax
push str.SOFTWAREHNCSharedInstall_InformationHwp96
push reloc.OLEAUT32.dll_SysReAllocString
call edi
test eax, eax
jne 0x40d7ff
lea eax, [ebp - 0x284]
push eax
lea eax, [ebp - 0x268]
push eax
lea eax, [ebp - 0x274]
push eax
push 0
push str.Path
push dword [ebp - 0x26c]
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExW]
test eax, eax
jne 0x40d7ff
push str.HOffice96Binhncxml90.dll
lea eax, [ebp - 0x268]
push 0x104
push eax
call fcn.0054b5e8
add esp, 0xc
lea eax, [ebp - 0x26c]
push eax
push str.CLSID4FB7AF81_C03E_4517_B2AE_19535BB44EEFInprocServer32
push SysReAllocString
call esi
test eax, eax
jne 0x40d88a
movdqu xmm0, xmmword [0x5afb60]
mov eax, dword [0x5afb70]
lea ecx, [ebp - 0x28]
mov dword [ebp - 0x18], eax
lea edx, [ecx + 2]
movdqu xmmword [ebp - 0x28], xmm0
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d831
sub ecx, edx
sar ecx, 1
lea eax, [ecx + ecx]
push eax
lea eax, [ebp - 0x28]
push eax
push 1
push 0
push str.ThreadingModel
push dword [ebp - 0x26c]
call ebx
lea ecx, [ebp - 0x268]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d862
sub ecx, edx
sar ecx, 1
lea eax, [ecx + ecx]
push eax
lea eax, [ebp - 0x268]
push eax
push 1
push 0
push 0
push dword [ebp - 0x26c]
call ebx
lea eax, [ebp - 0x26c]
push eax
push str.CLSID4FB7AF81_C03E_4517_B2AE_19535BB44EEFProgID
push SysReAllocString
call esi
test eax, eax
jne 0x40d8f5
movdqu xmm0, xmmword [str.HncModU.Hwp.HNCXML9]
lea ecx, [ebp - 0x3c]
lea edx, [ecx + 2]
movdqu xmmword [ebp - 0x3c], xmm0
movdqu xmm0, xmmword [0x5afc10]
movdqu xmmword [ebp - 0x2c], xmm0
movq xmm0, qword [0x5afc20]
movq qword [ebp - 0x1c], xmm0
mov edi, edi
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d8d0
sub ecx, edx
sar ecx, 1
lea eax, [ecx + ecx]
push eax
lea eax, [ebp - 0x3c]
push eax
push 1
push 0
push 0
push dword [ebp - 0x26c]
call ebx
lea eax, [ebp - 0x26c]
push eax
push str.CLSID4FB7AF81_C03E_4517_B2AE_19535BB44EEFVersionIndependentProgID
push SysReAllocString
call esi
test eax, eax
jne 0x40d965
movdqu xmm0, xmmword [str.HncModU.Hwp.HNCXML9]
lea ecx, [ebp - 0x3c]
lea edx, [ecx + 2]
movdqu xmmword [ebp - 0x3c], xmm0
movdqu xmm0, xmmword [0x5afc10]
movdqu xmmword [ebp - 0x2c], xmm0
movq xmm0, qword [0x5afc20]
movq qword [ebp - 0x1c], xmm0
lea esp, [esp]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d940
sub ecx, edx
sar ecx, 1
lea eax, [ecx + ecx]
push eax
lea eax, [ebp - 0x3c]
push eax
push 1
push 0
push 0
push dword [ebp - 0x26c]
call ebx
lea eax, [ebp - 0x26c]
push eax
push str.HncModU.Hwp.HNCXML9CLSID
push SysReAllocString
call esi
test eax, eax
jne 0x40d9be
mov ecx, 0x13
lea edi, [ebp - 0x60]
mov esi, str.4FB7AF81_C03E_4517_B2AE_19535BB44EEF
rep movsd dword es:[edi], dword [esi]
lea ecx, [ebp - 0x60]
lea edx, [ecx + 2]
movsw word es:[edi], word [esi]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d993
sub ecx, edx
sar ecx, 1
lea eax, [ecx + ecx]
push eax
lea eax, [ebp - 0x60]
push eax
push 1
push 0
push 0
push dword [ebp - 0x26c]
call ebx
mov esi, dword [sym.imp.ADVAPI32.dll_RegCreateKeyW]
push dword [ebp - 0x26c]
mov edi, dword [sym.imp.ADVAPI32.dll_RegCloseKey]
call edi
push dword [ebp - 0x270]
call edi
jmp 0x40d9dc
mov edi, dword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea eax, [ebp - 0x270]
push eax
push 0xf003f
push 0
push str.SoftwareHNCShared9.6Fonts
push SysReAllocString
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x40da3d
mov esi, dword [sym.imp.USER32.dll_SendMessageW]
push eax
push eax
mov eax, dword [ebp - 0x27c]
push 0xf0
mov dword [ebp - 0x26c], 1
push dword [eax + 0x624]
call esi
test eax, eax
je 0x40da8f
dec eax
cmp eax, 1
ja 0x40dab3
mov dword [ebp - 0x26c], 1
jmp 0x40da99
lea eax, [ebp - 0x270]
push eax
push str.SoftwareHNCShared9.6Fonts
push SysReAllocString
call esi
mov esi, dword [sym.imp.USER32.dll_SendMessageW]
test eax, eax
jne 0x40dabb
push eax
push eax
mov eax, dword [ebp - 0x27c]
push 0xf0
mov dword [ebp - 0x26c], 1
push dword [eax + 0x624]
call esi
test eax, eax
je 0x40da8f
dec eax
cmp eax, 1
ja 0x40dab3
mov dword [ebp - 0x26c], 1
jmp 0x40da99
mov dword [ebp - 0x26c], 0
push 4
lea eax, [ebp - 0x26c]
push eax
push 4
push 0
push str._font
push dword [ebp - 0x270]
call ebx
push dword [ebp - 0x270]
call edi
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x268], ax
lea eax, [ebp - 0x266]
push eax
call fcn.0054cbf0
mov eax, dword [ebp - 0x27c]
add esp, 0xc
push 0
push 0
push 0xf0
push dword [eax + 0x698]
call esi
dec eax
cmp eax, 1
ja 0x40db44
lea eax, [ebp - 0x268]
push eax
push 1
push 0
push 0x1a
push 0
call dword [sym.imp.SHELL32.dll_SHGetFolderPathW]
push str.HNCUserShared96HwpTemplateDocKORNormal90.hwt
lea eax, [ebp - 0x268]
push 0x104
push eax
call fcn.0054b5e8
add esp, 0xc
lea eax, [ebp - 0x268]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x40db44
lea eax, [ebp - 0x268]
push eax
call fcn.0054bc7d
add esp, 4
mov eax, dword [ebp - 0x280]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0054a22c
mov esp, ebp
pop ebp
ret