Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
AddExtender("WWWNT34I.DLL") myReghandleParent = RegOpenKey(@REGMACHINE, "SOFTWARE\Classes\KBMap") myReghandle = RegOpenKey(myReghandleParent , "DefaultIcon") ;The key with no permissions users = wntAccessList("", myReghandle, 400, 0) If StrIndexNC(users, "System", 1, @FWDSCAN) == 0 || StrIndexNC(users, "Users", 1, @FWDSCAN) == 0 || StrIndexNC(users, "Administrator", 1, @FWDSCAN) == 0 myreturn = wntAccessMod("", myReghandleParent, 400, 1, 0) ; This one fails If myreturn == 1 Then Message("Change done", "Done") TimeDelay(3) myreturn = wntAccessMod("", myReghandleParent, 400, 1, 0) ; This one works If myreturn == 1 Then Message("Change done", "Done2") EndIf RegClosekey(myReghandle) RegClosekey(myReghandleParent)Info:
Winbatch 2005C NT extender 39008.0.0.1 Windows XP SP2To replicate the Reg Key with missing permissions, perform the following on the sub key.
In terms of the procedure you posted, it looks like you're setting up a classic "Catch-22" scenario. You've removed all the ACEs in the DACL [Discrtionary ACL, a.k.a. "the permissions"]. The result is that *NOBODY* has rights to access the key using normal security. Only the owner of the object retains any control at all, and only to re-write the DACL. So, the underlying steps that need to be performed is to take ownership of the key using wntOwnerSet() and, at the same time, choose to "Zap" the DACL/permissions. Finally, use wntAccessMod() to re-enable ACL inheritance on the key. This only works on *LOCAL* registry keys. If you're accessing a registry key on a remote system, you can't do the part with wntAccessMod().
Article ID: W17071
File Created: 2007:07:03:14:28:04
Last Updated: 2007:07:03:14:28:04