#179875 - 2007-08-28 05:32 PM
LoadKey problem
|
luca
Fresh Scripter
Registered: 2003-06-27
Posts: 5
|
I try to use loadkey to import a registry key.
I have this test script: writevalue("HKEY_CURRENT_USER\Test","Test","ORIGINAL","REG_SZ") ? "save" $ReturnCode = SaveKey("HKEY_CURRENT_USER\Test", "c:\zz_test.dat") ? $ReturnCode If $ReturnCode = 0 ? "Key SAVED...." Endif
writevalue("HKEY_CURRENT_USER\Test","Test","CHANGED","REG_SZ")
? "-----------------" ? "load" $ReturnCode = LoadKey("HKEY_CURRENT_USER\Test", "c:\zz_test.dat") ? $ReturnCode If $ReturnCode = 0 ? "Key loaded...." Endif
I run the script and this is the result.
================================ C:\test>KIX32.EXE zz_test.KIX 0 save 0 Key SAVED....0 -------------- load 5 ================================
I done a lot of test, but the script dosen't work. In the "Test" key I found always CHANGED. Why? I'm administrator of my pc, it is not a permission problem.
Thank You Luca Passioni
|
Top
|
|
|
|
#180146 - 2007-09-05 12:48 AM
Re: LoadKey problem
[Re: Les]
|
luca
Fresh Scripter
Registered: 2003-06-27
Posts: 5
|
I can writevalue without problem. I tried on a Win2003 Server and I was the administrator. FULL CONTROL of the registry key. I tried on a Vista Business, check registry permission and was FULL CONTROL.
5- is access denied, but this is impossible!
Someone have more suggestions?
Thank You Luca Passioni
|
Top
|
|
|
|
#180163 - 2007-09-05 05:34 PM
Re: LoadKey problem
[Re: Les]
|
luca
Fresh Scripter
Registered: 2003-06-27
Posts: 5
|
I'm the "ADMINISTRATOR", I think that administrator has "Backup/Restore" permission. What do You think about?
I open regedt32, open the key and the permission are "FULL CONTROL". How can I set "Backup/Restore" permission?
Thank You Luca P.
|
Top
|
|
|
|
#180215 - 2007-09-06 09:50 PM
Re: LoadKey problem
[Re: Arend_]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
apronk, I think you mean WriteValue()
I tested the following: I am Domain Admin I put my Domain Account (Domain\UserID) in the local group "Backup Operators" on my computer. (I also tested this when I was NOT in the "Backup Operators" group) In the registry, I created a new key "HKEY_CURRENT_USER\test" Here is the script I tried:
;Script Options If Not @LOGONMODE Break On Else Break Off EndIf Dim $RC $RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf
;Code $RC = SaveKey("HKEY_CURRENT_USER\test","c:\test.dat") If @ERROR "SaveKey Error" ? "Error " + @ERROR + ": " + @SERROR ? $RC ? EndIf
$RC = LoadKey("HKEY_CURRENT_USER\test","c:\test.dat") If @ERROR "LoadKey Error" ? "Error " + @ERROR + ": " + @SERROR ? $RC ? EndIf
? @KIX ? @SCRIPTEXE ?
Get $RC |
Here is the output on screen
LoadKey Error
Error 5: Access is denied.
5
4.53
KIX32.EXE
I presume an undocumented feature or a bug or so?
|
Top
|
|
|
|
#180218 - 2007-09-06 11:29 PM
Re: LoadKey problem
[Re: NTDOC]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Windows XP SP2
KiXtart version is: 4.53
KiXtart executable name is: KIX32.EXE
User privilege by PRIV macro: ADMIN
Reading Key ERROR: 2 - The system cannot find the file specified.
Value read from HKLM\SOFTWARE\TEST_KIX was:
Saving Key ERROR: 0 - The operation completed successfully.
Loading Key ERROR: 5 - Access is denied.
|
Top
|
|
|
|
#180219 - 2007-09-06 11:37 PM
Re: LoadKey problem
[Re: Witto]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
I forgot to create a Value called sample
KiXtart version is: 4.53
KiXtart executable name is: KIX32.EXE
User privilege by PRIV macro: ADMIN
Reading Key ERROR: 0 - The operation completed successfully.
Value read from HKLM\SOFTWARE\TEST_KIX was: aaa
Saving Key ERROR: 0 - The operation completed successfully.
Loading Key ERROR: 5 - Access is denied.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 262 anonymous users online.
|
|
|