!ifndef UCVL_REGISTRY_CLEANUP_INCLUDED !define UCVL_REGISTRY_CLEANUP_INCLUDED ; NSIS DeleteRegKey also reports an error for an already-absent key. Confirm ; absence using Win32 status, without treating access denied as success. ; Uses the default 32-bit registry view, like the rest of this installer. !macro RemoveOwnedUserRegistration KEY StrCpy $0 0 ClearErrors DeleteRegKey HKCU "${KEY}" ${If} ${Errors} System::Call 'advapi32::RegOpenKeyExW(p 0x80000001, w "${KEY}", i 0, i 0x20019, *p .r1) i .r0' ${If} $0 == 0 System::Call 'advapi32::RegCloseKey(p r1)' StrCpy $0 20 ${ElseIf} $0 == 2 StrCpy $0 0 ${ElseIf} $0 == 3 StrCpy $0 0 ${Else} StrCpy $0 20 ${EndIf} ${EndIf} ClearErrors !macroend !endif