LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I delete a registry key of the windows registry

When I install a USB device on my computer, the system\CurrentControlSet\Enum\USB registry key is updated with a new key. I want to delete this key with the registry vi's of LabVIEW. When I try to open the system\CurrentControlSet\Enum\USB key in the registry, LabVIEW gives me error -604: "Remote registry access denied", even if the security access mask is KEY_ALL_ACCESS. Does someone know why I cannot open this key? I can delete the key manually, if I change the permission of my key to Full Control.
Message 1 of 6
(6,664 Views)
Hi

depending of the type of windows OS a standard user account cannot write and delete registry keys under system\*. The LV registry functions do not change any security settings in the registry.
The security access mask is used to ask if the current user has this access rights and not to set it.
LV has no built in functions or VIs which allow to change any security settings. I'm not aware of any toolboxes which will provide such functions.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 6
(6,663 Views)
Thanks for your reply, Waldemar. I have administrator rights on my computer and I'm able to delete a registry key manually. If I do it programmatically in LabVIEW, the program gives me error -604 when I try to open a valid registry key, even before deleting it.
See my attached program. Thanks for your help.

Bart
0 Kudos
Message 3 of 6
(6,663 Views)
Hi Bart,

I do not do much which HW related registry keys so I have a little lack of knowledge.

I made a look in the registry of my Win XP Professional. The keys under USB have a security settings which allows "All Users" to read keys and enumerate subkeys. The group "System" has full access. The administrator does not belong to the group "System" so it falls into the group "All Users". That's why you cannot delete the key.
You state in your question you have to change permissions before you can delete it manually. That's the way the securitiy settings are.
You receive error -604 from "Open Registry Key" because the standard access mask is "KEY_READ | KEY_WRITE" and you don't have KEY_WRITE access.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 4 of 6
(6,663 Views)
The problem I find with Labview's delete key is that it will NOT delete a key which has a subkey.
This means, you got to start at the subkey, and delete all of them first.
 
This does work, but what I am stuggling to do is to obtain a list of the subkeys using labview.
(You need to know what you want to delete)
 
Pitty there is no function that simply deletes a key, including it's sub keys! ?
 
Goose
0 Kudos
Message 5 of 6
(6,230 Views)

Hi morngoose,

The software developers at NI always welcome suggestions. Perhaps you'd like to file this observation on our Product Suggestion webpage? For now, I believe your workaround is the best available option. Perhaps, with your help, we might have this functionality in the next release of LabVIEW...

Cheers,
Emilie K. | Applications Engineer | National Instruments

0 Kudos
Message 6 of 6
(6,201 Views)