WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Error Codes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

1526 RegLoad-UnloadHive Access Denied

 Keywords: 1526 RegLoadHive RegUnloadHive Access Denied 

Question:

I am tring the execute the following code. Yet I keep getting the error 1526. I am able to manually load the (ntuser.dat) hive and create the subkey and unload the hive. So I don't think it's an access permissions issue. Why do you think I am getting an accessed denied error?
; the default User's Registry
LoadRes=RegLoadHive(@REGUSERS,"DefUser","c:\documents and settings\Default User\ntuser.dat")
reg=RegOpenKey(@REGUSERS,"DefUser")

; Make change to Registry (Can be anything)
res=regCreateKey(reg,"Software\CCRW")

; Unload and save the Defualt User Hive
UnLoadRes=RegUnloadHive(@REGUSERS,"DefUser")

Answer:

That error is a result of the subkey handle still being open. Make sure you are using RegCloseKey to close the handle before you attempt to unload the hive.
; the default User's Registry
LoadRes=RegLoadHive(@REGUSERS,"DefUser","c:\documents and settings\Default User\ntuser.dat")
reg=RegOpenKey(@REGUSERS,"DefUser")

; Make change to Registry (Can be anything)
res=regCreateKey(reg,"Software\CCRW")

;Free the handles
RegCloseKey(reg)
RegCloseKey(res)

; Unload and save the Defualt User Hive
UnLoadRes=RegUnloadHive(@REGUSERS,"DefUser")

Article ID:   W15140
File Created: 2002:09:05:13:49:56
Last Updated: 2002:09:05:13:49:56