View Single Post
Old 3rd March 2021, 13:07   #20
stass
Senior Member
 
Join Date: Nov 2012
Posts: 166
I'm sorry, but I'm back to the damn registry keys in Windows 10 ...

A seemingly simple task is to determine the existence of a key in the registry. It is easy to determine whether there is such a key or not.
The key is still the same:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows Defender \ Spynet

And one more :
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ WindowsSelfHost \ UI \ Visibility

But the task was not solvable!
What's the matter ? How do I solve this?

code:
!addplugindir .
!include "LogicLib.nsh"
!include "Registry.nsh"
OutFile "IfKeyExist-test.exe"
RequestExecutionLevel admin
Var NameKey

Section
StrCpy $NameKey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Spynet"
ClearErrors
${registry::KeyExists} "$NameKey" $R0
${If} $R0 = -1
MessageBox MB_OK "NO Key"
${ElseIf} $R0 = 0
MessageBox MB_OK "OK!"
${EndIf}

${Do}
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows Defender" $0
IntOp $0 $0 + 1
StrCpy $2 $1
${If} $2 == "Spynet"
ClearErrors
sleep 30
MessageBox MB_OK "$1"
${EndIf}
${LoopUntil} $1 == ""

StrCpy $NameKey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility"
ClearErrors
${registry::KeyExists} "$NameKey" $R0
${If} $R0 = -1
MessageBox MB_OK "NO Key"
${ElseIf} $R0 = 0
MessageBox MB_OK "OK!"
${EndIf}

${Do}
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\WindowsSelfHost\UI" $0
IntOp $0 $0 + 1
StrCpy $2 $1
${If} $2 == "Visibility"
ClearErrors
sleep 30
MessageBox MB_OK "$1"
${EndIf}
${LoopUntil} $1 == ""
SectionEnd

stass is offline   Reply With Quote