Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: wntAccessAdd 64-bit Registry Key
AddExtender("WWWNT34I.DLL") key=RegOpenKey(@REGCLASSES,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}") Ok=wntAccessAdd("", key, "Administrators",401, "Reg:Full") RegCloseKey(key) key = RegCreateKey (@REGCLASSES,'CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}') RegSetEx(key,'[LocalizedString]','%%Computername%%','',2) RegCloseKey(key)Can someone tell me how I can change ownership to Administrators?
HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}
I just tried the code on a 32bit machine and there it works. On a 64bit machine there are 5 instances of this key:
T1 = wntOwnerSet("", @REGCLASSES, "CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 400, "Administrators", 0) T2 = wntOwnerSet("", @REGCLASSES, "Wow6432Node\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 400, "Administrators", 0) T3 = wntOwnerSet("", @REGMACHINE, "SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 400, "Administrators", 0) T4 = wntOwnerSet("", @REGMACHINE, "SOFTWARE\Classes\Wow6432Node\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 400, "Administrators", 0) T5 = wntOwnerSet("", @REGMACHINE, "SOFTWARE\Wow6432Node\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 400, "Administrators", 0)If I run this code on a clean machine I see that the owner on T2, T4 and T5 is being changed while T1 and T3 remain unchanged. No Winbatch error though. The problem is that I need to change T1 or T3 in order to make this change work.
The question is how do I make the 32bit Winbatch exe change the owner of a 64bit key?
Note: UAC is enabled on the system and the script is running elevated. The compiled exe is signed and the ExecutionLevel is highestAvailable. The script works fine if I use RegOpenFlags to force it to use the 64bit key. So, the main question is: Is there a way to tell wntAccessAdd to use the 64bit key and not the redirected wow64 key?
key = RegOpenKeyEx( @REGCLASSES, "", "READ", 64 , "" ) rslt = wntOwnerSet("", key, "CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 400, "Administrators", 0) RegCloseKey (key) key = RegOpenKeyEx( @REGCLASSES, "CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "READ", 64 , "" ) rslt = wntAccessAdd("", key, "Administrators",401, "Reg:Full") RegCloseKey (key) key = RegOpenKeyEx( @REGCLASSES, "CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "WRITE", 64 , "" ) rslt = RegSetEx(key,'[LocalizedString]','%%Computername%%','',2) RegCloseKey (key)Thanks for your help.
Article ID: W18329
Filename: wntAccessAdd 64-bit Registry Key.txt
File Created: 2012:11:26:09:57:14
Last Updated: 2012:11:26:09:57:14