#211929 - 2016-09-01 09:52 PM
WRITEVALUE function fails but REG ADD works
|
JNK
Fresh Scripter
Registered: 2006-04-11
Posts: 33
Loc: USA
|
I have a weird issue. First, some environment information:
Windows 10 Enterprise, 64-bit; fully patched and updated (current branch) Kixtart (wkix32) 4.66 Domain joined Logged on as a Domain User; User is a Local Admin User Account Control (UAC) is turned off (never notify)
I have a custom registry setting I need to update: HKLM\software\firm\variables | test="1" (reg_sz) during the running of the Logon Script.
My logon script code looks like this: $_ = writevalue("HKLM\software\firm\variables","test","1","reg_sz") The result (@error) is 5 (access denied) and the entry is not written (obviously).
BUT if I run a REG ADD "HKLM\software\firm\variables" /v "test" /d "1" /t "reg_sz" /f
in a cmd window, the result is 0 (success) and the entry is written.
The command is successful on both an "elevated" and a "non-elevated" cmd.exe.
I also have a Group Policy in place to modify the ACL of HKLM\software\firm to "Administrators: Full Control". These permission are propagated down to all sub keys and values. Registry hive permissions have been verified in the GUI.
Is there a bug in the WRITEVALUE function in 4.66 or am I missing something?
|
Top
|
|
|
|
#211936 - 2016-09-02 01:25 PM
Re: WRITEVALUE function fails but REG ADD works
[Re: Allen]
|
JNK
Fresh Scripter
Registered: 2006-04-11
Posts: 33
Loc: USA
|
ah, missing environment detail. I think I already have the WOW64AlternateRegView option set to ON but let me verify that. If it turns out to be that simple, I hang my head in shame for making such a rookie mistake.
... always appreciate the helpful folks here in the forum. I lurk here quite frequently and have learned a lot!
Thanks!
|
Top
|
|
|
|
#211937 - 2016-09-02 01:40 PM
Re: WRITEVALUE function fails but REG ADD works
[Re: JNK]
|
JNK
Fresh Scripter
Registered: 2006-04-11
Posts: 33
Loc: USA
|
UPDATE: Confirmed I had code in place to set the WOW64AlternateRegView option.
Unfortunately, I also found a typo.
#grumble
Thank you for pointing me in the right direction!
Edited by JNK (2016-09-02 01:41 PM)
|
Top
|
|
|
|
#211941 - 2016-09-04 01:44 PM
Re: WRITEVALUE function fails but REG ADD works
[Re: Jochen]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
Yeah - including the Sanity function - which is built in to KGen.
KGen is part of the Kix Development package and allows you to write scripts without manually specifying functions, and it lets you break large scripts into smaller files. Run KGEN against your primary script source file and it will combine all of the sub-files, then scan them for any needed UDFs, adding them to the finished script. It does this recursively so even UDFs with dependencies are resolved.
When KGen finishes assembling the script, it runs Sanity, which scans the full script looking for unbalanced functions, quotes, parens, checks for undeclared or duplicately defined variables, and variables or macros in strings. It even generates a variable list reporting when it was declared and first defined. A "Code Map" helps to quickly find unbalanced statements. KGen supports directives to load specific "Private" UDFs, prevent scanning for dependencies, define additional libraries, and even skip parsing of a line that's correct but always generates a warning (Execute commands often have $ in the strings).
The Kix Development pack is a free download from my site, is written in Kix and includes our entire production UDF library.
I write a large number of complex Kix scripts that we use in production, and I use KGen for every one of them. Running KGen without args will locate the BUILD.INI file, where I've configured the defaults to not tokenized the code and to run sanity. I then have 3 other sections called DEV, PKG, and PROD. These all simply build the script, tokenize the result (leaving an un-tokenized .GEN file), bypass Sanity, and then copy the resulting script to the Dev environment, a Package folder for deployment, or our Production environment.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 761 anonymous users online.
|
|
|