Logical differences

(imported topic written by SystemAdmin)

Is there a logical difference between the following relevance statements:

exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer != 0)

not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer = 0))

(imported comment written by SystemAdmin)

Hello dmoore,

I have run the following test so you can see the difference:

  1. The key does not exist

  2. The key does but the value does not exist

  3. The value exists but is empty

  4. The value is 0

  5. The value is != 0

Hope this helps.

Here are the results:

//key does not exist

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsol” of registries as string)whose (it as integer != 0)

A: False

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsol” of registries as string)whose (it as integer = 0))

A: True

  1. The key does but the value does not exist

//The key does but the value does not exist

q: exists (values “securityleve” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer != 0)

A: False

q: not (exists (values “securityleve” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer = 0))

A: True

  1. The value exists but is empty

//The value exists but is empty

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer != 0)

A: False

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer = 0))

A: True

  1. The value is 0

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer != 0)

A: False

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer = 0))

A: True

  1. The value is != 0

//The value exists but is empty

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer != 0)

A: False

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of registries as string)whose (it as integer = 0))

A: True

(imported comment written by SystemAdmin)

Looks like my original response wasn’t looking at the right place in the registry. I have an x64 win7 machine. I had to change “registries” to “native registry” and then did the same tests:

//key does not exist

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsol” of native registry as string)whose (it as integer != 0)

A: False

T: 0.059 ms

I: singular boolean

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsol” of native registry as string)whose (it as integer = 0))

A: True

T: 0.069 ms

I: singular boolean

  1. The key does but the value does not exist

//The key does but the value does not exist

q: exists (values “securityleve” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer != 0)

A: False

T: 0.079 ms

I: singular boolean

q: not (exists (values “securityleve” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer = 0))

A: True

T: 0.101 ms

I: singular boolean

  1. The value exists but is empty

//The value exists but is empty

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer != 0)

A: False

T: 0.089 ms

I: singular boolean

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer = 0))

A: False

T: 0.090 ms

I: singular boolean

  1. The value is 0

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer != 0)

A: False

T: 0.074 ms

I: singular boolean

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer = 0))

A: False

T: 0.077 ms

I: singular boolean

  1. The value is != 0

//The value exists but is empty

q: exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer != 0)

A: True

T: 0.078 ms

I: singular boolean

q: not (exists (values “securitylevel” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Setup\RecoveryConsole” of native registry as string)whose (it as integer = 0))

A: True

T: 0.079 ms

I: singular boolean