- Dec
- 236
- 2
From and elevated TCC, I was tinkering with some of the @REG functions and ran into some issues. This is what my registry for HKCU\Environment looks like at the beginning:
I now run the following from a .BTM file:
the results are as follows:
So let look at the results:
I now run the following from a .BTM file:
@echo off
echo %@REGEXIST[HKCU\Environment\semiphore]
echo %@REGSET[HKCU\Environment\semiphore,REG_SZ,10]
echo %@REGQUERY[HKCU\Environment\semiphore]
echo %@REGQUERY[HKCU_64\Environment\semiphore]
echo %@REGEXIST[HKCU\Environment\semiphore]
echo %@REGEXIST[HKCU_64\Environment\semiphore]
echo %@REGDELKEY[HKCU\Environment\semiphore]
echo %@REGDELKEY[HKCU_64\Environment\semiphore]
echo %@REGQUERY[HKCU\Environment\semiphore]
echo %@REGEXIST[HKCU\Environment\semiphore]
echo %@REGSET[HKCU\Environment\semiphore,REG_SZ,10]
echo %@REGQUERY[HKCU\Environment\semiphore]
echo %@REGQUERY[HKCU_64\Environment\semiphore]
echo %@REGEXIST[HKCU\Environment\semiphore]
echo %@REGEXIST[HKCU_64\Environment\semiphore]
echo %@REGDELKEY[HKCU\Environment\semiphore]
echo %@REGDELKEY[HKCU_64\Environment\semiphore]
echo %@REGQUERY[HKCU\Environment\semiphore]
the results are as follows:
0
0
10
10
0
0
0
0
10
The following is the state of my registry after running the .BTM file above:0
10
10
0
0
0
0
10
So let look at the results:
echo %@REGEXIST[HKCU\Environment\semiphore] returns a 0 that sound right, the key doesn't exist at this point.
echo %@REGSET[HKCU\Environment\semiphore,REG_SZ,10] returns a 0, that means no error, that sounds right too.
echo %@REGQUERY[HKCU\Environment\semiphore] and echo %@REGQUERY[HKCU_64\Environment\semiphore], query the key and query the key using the 64 bit version both return 10, that the correct value.
echo %@REGEXIST[HKCU\Environment\semiphore] and echo %@REGEXIST[HKCU_64\Environment\semiphore] return 0, but the previous REGQUERY call indicate that the key does exist so these call should be returning 1 and not 0.
echo %@REGDELKEY[HKCU\Environment\semiphore] and echo %@REGDELKEY[HKCU_64\Environment\semiphore] are attempts to delete the key, but the 0 returned indicates that these attempts did fail.
echo %@REGQUERY[HKCU\Environment\semiphore], querying the key returns a 10, indicating that the attempt to delete the key did fail.
Is my understanding of how these @REG functions work flawed or is there a problem with @REGEXIST and @REGDELKEY?echo %@REGSET[HKCU\Environment\semiphore,REG_SZ,10] returns a 0, that means no error, that sounds right too.
echo %@REGQUERY[HKCU\Environment\semiphore] and echo %@REGQUERY[HKCU_64\Environment\semiphore], query the key and query the key using the 64 bit version both return 10, that the correct value.
echo %@REGEXIST[HKCU\Environment\semiphore] and echo %@REGEXIST[HKCU_64\Environment\semiphore] return 0, but the previous REGQUERY call indicate that the key does exist so these call should be returning 1 and not 0.
echo %@REGDELKEY[HKCU\Environment\semiphore] and echo %@REGDELKEY[HKCU_64\Environment\semiphore] are attempts to delete the key, but the 0 returned indicates that these attempts did fail.
echo %@REGQUERY[HKCU\Environment\semiphore], querying the key returns a 10, indicating that the attempt to delete the key did fail.
Last edited: