.NET Framework - duplicate registry key

Asked By JAG on 14-Mar-11 07:50 PM
I am attempting to add a subkey (Suppress DWF Upgrade Warning) and
value (1) to an existing registry key as follows:

Const userRoot As String =3D "HKEY_CURRENT_USER"
Const subkey As String =3D "SOFTWARE\AppDataLow\Software\Au=E2=
=80=8B
todesk\Design_ Review\Preferences\User Interface\Suppress Warnings"
Const keyName As String =3D userRoot & "\" & subkey_
Registry.SetValue(keyName, "Suppress DWF Upgrade Warning",
1)

This code works great in XP, but in Windows 7 and Vista the Autodesk
key and subkeys are duplicated instead of adding the subkey and value
to the Suppress Warnings key as desired.

The permissions for the Autodesk key seem to be the same between XP
and 7/Vista, though I am not too familiar with registry key
permissions.

Why the duplication?
Any help would be greatly appreciated.




Mayayana replied to JAG on 15-Mar-11 10:14 AM
You have your terms mixed up, so it is hard to
understand what the problem is. The item on the left
is a subkey. "Suppress DWF Upgrade Warning" is
a value. 1 is the data.

I am not familiar with .Net Registry functions, but since
no one else is answering....

* You should have permission to write to HKCU.

* If you use regular Registry API functions you can
check the return value to see why it fails. (.Net
apparently does not have that ability. If it does then
you should be using the function version instead of
the sub version, so you will have error codes.

------------------------------------
I am attempting to add a subkey (Suppress DWF Upgrade Warning) and
value (1) to an existing registry key as follows:

Const userRoot As String = "HKEY_CURRENT_USER"
Const subkey As String = "SOFTWARE\AppDataLow\Software\Autodesk\Design_
Review\Preferences\User Interface\Suppress Warnings"
Const keyName As String = userRoot & "\" & subkey_
Registry.SetValue(keyName, "Suppress DWF Upgrade Warning",
1)

This code works great in XP, but in Windows 7 and Vista the Autodesk
key and subkeys are duplicated instead of adding the subkey and value
to the Suppress Warnings key as desired.

The permissions for the Autodesk key seem to be the same between XP
and 7/Vista, though I am not too familiar with registry key
permissions.

Why the duplication?
Any help would be greatly appreciated.
JAG replied to Mayayana on 15-Mar-11 07:35 PM
Thank you for your time, and clarification on what a subkey and value
are in the registry. Much appreciated.

Even though the IDE and Notepad failed to show it, I had a special
character embedded in my code, causing the duplicate registry entry in
7/Vista.

Moving on....


oftware\Autodesk\Design_
ey_
Warning",