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

Registry
plus

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

Change Registry Permissions to Modify Read-Only Subkeys

Keywords:    wntAccessAdd     ENUM

Question:

I am writing a script to install NFS Maestro. This requires a device to be installed. The only way I could get the device installed and started was to create registry entries under @RegMachine,"SYSTEM\CurrentControlSet\Enum\Root. By default, you cannot write to the Enum key. I was able to run my script if I went into my registry editor and changed the permissions on Enum to Full Control for the ID performing the installation.

Is there a way I can change the permissions on Enum to create keys and values and update this registry key in Winbatch? I would like to make the change or add the entry and then it would be ok to change the permissions back to read only.

Answer:

The Win32 NT Network extender has a wntAccessAdd function that can change the security settings for registry entries.

The current version of the wntAccessAdd function in the NTnetwork extenders applies registry permissions to subkeys as well.

The following code changes the permissions on a registry key and any subkeys.

	AddExtender("WWWNT34I.DLL")
	RegHandle=RegOpenKey(@RegCurrent,"Control Panel\Desktop")
	Ok=wntAccessAdd("", RegHandle, "NWANT2",401, "Reg:Full")
	RegCloseKey(RegHandle)
You can change permissions on remote registries by doing a RegConnect first, and then using the handle returned from RegOpenKey.
Article ID:   W13713
Filename:   Change Registry Permissions and Modify Read-Only Subkeys.txt
File Created: 2001:03:01:13:18:08
Last Updated: 2001:03:01:13:18:08