Melis Dost
Melis Dost

Reputation: 25

RegRead Function returns a wrong value

I have a script to read registry values. It worked till now but this time it gives me a wrong result

Here's the actual registry value along with the value returned by the code below:

Registry value

And here's the code I'm using:

FileExt = "HKEY_CLASSES_ROOT\CLSID\{F02C1A0D-BE21-4350-88B0- 
7367FC96EF3C}\ShellFolder\Attributes"
Set Shell = WScript.CreateObject("WScript.Shell")
St = Shell.RegRead(FileExt)
wscript.echo St

Upvotes: 2

Views: 232

Answers (1)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200233

The value in the registry is a 32-bit unsigned integer, but VBScript interprets it as a 32-bit signed integer (see for instance here).

Either display the hexadecimal value:

WScript.Echo Hex(St)

or adjust the misinterpreted value:

If St < 0 Then St = St + 2^32
WScript.Echo St

Upvotes: 3

Related Questions