LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Installer Properties --> Registry: delete a key?

I know I can easily add registry keys and values under Windows specifying them in the Installer Properties --> Registry page of LabVIEW 8.2.1.

Is it possible to delete keys and values in the same way? I tried with the '-' character as I can do in a .reg file, but It doesn't work.

Is there a simple way?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 24
(4,272 Views)

Hi Vix,

 

with the Application Builder Installer you can only create registry keys, not deleting them programmatically. What you should do as a workaround would be creating an executable that uses Windows Registry Access VIs and launch it silently during installation through a batch file.

 

Hope this helps, sorry for not giving a simpler workaround for doing what you need.

 

Best regards,

 

Fabio

Fabio M.
NI
Principal Engineer
0 Kudos
Message 2 of 24
(4,249 Views)

Hi,

 

I'm having trouble writing registry keys in Vista.  Access seems to be denied for HKEY_LOCAL_MACHINE and only works for HKEY_CURRENT_USER.

 

For example, refer to the LV shipped example "write to registry.vi" and try it.

 

My application needs to write certain values to keys in the registry after installation then read them later.  I have been placing these values in the HKEY_LOCAL_MACHINE until now.  Is there a work-around to writing at run-time to HKEY_LOCAL_MACHINE?  Is there another location in the registry which I can store the values for all users?

 

Thanks for your help.

 

Battler.

0 Kudos
Message 3 of 24
(4,176 Views)

battler. wrote:

Hi,

 

I'm having trouble writing registry keys in Vista.  Access seems to be denied for HKEY_LOCAL_MACHINE and only works for HKEY_CURRENT_USER.

 

For example, refer to the LV shipped example "write to registry.vi" and try it.

 

My application needs to write certain values to keys in the registry after installation then read them later.  I have been placing these values in the HKEY_LOCAL_MACHINE until now.  Is there a work-around to writing at run-time to HKEY_LOCAL_MACHINE?  Is there another location in the registry which I can store the values for all users?

 

Thanks for your help.

 

Battler.


Sorry, I can't resist. The workaround is not to use Vista! And of course Windows 7.

 

The longer answer is you need to write code that elevates the impersonation level of the current user which will of course cause a login dialog to appear. And no there are no VIs for that so far, so it's about writing C code.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 24
(4,150 Views)

rolfk wrote:

 

The longer answer is you need to write code that elevates the impersonation level of the current user which will of course cause a login dialog to appear. And no there are no VIs for that so far, so it's about writing C code.

 


Dammit! It riles me so much that it's damn-near impossible to take a working, useful LabVIEW code and turn it into a more professional application! It's a sad fact that most PC users are using a Windows OS, so it's a sad fact that my codes are virtually always written to work under Windows. But, how are we supposed to continue using LabVIEW if, when it comes to relatively simple tasks such as using the registry to store information that is globally available to all users, we just cannot!? Smiley Mad

Did NI not consider that this might be needed? Not all of us know C code to be able to create a little dll (or whatever is needed) that elevates the user privilege level to achieve this. There's got to be an easier way !? Smiley Sad

 

/end rant

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 24
(4,127 Views)

Rolf,

 

I think my question was more aimed at which sections of the registry I can write to at run-time in Vista and expect the changes to apply for all users.

 

Unfortunately I cannot avoid my customers using Vista.  Even I have to use the damned thing after all!

 

Battler.

0 Kudos
Message 6 of 24
(4,126 Views)

battler. wrote:

Rolf,

 

I think my question was more aimed at which sections of the registry I can write to at run-time in Vista and expect the changes to apply for all users.

 

Unfortunately I cannot avoid my customers using Vista.  Even I have to use the damned thing after all!

 

Battler.


I think there is no section in the registry where any normal user has write access to and which will persist, without making that section explicitedly have that access rights. Microsoft finally found that they had to do something about protection and having parts of the system thatanyone can write too, is simply a security risk.As far as I know they even removed the Documents and Settings/All Users part of the harddisk hierarchy because of the same reason. If they didn't it would be the best place to put those things possibly in the form of an INI file. NI can not fix the mess MS has been getting into over the years and finally started to address.

 

Rolf Kalbermatter

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 24
(4,122 Views)

rolfk wrote:

I think there is no section in the registry where any normal user has write access to and which will persist, without making that section explicitedly have that access rights. Microsoft finally found that they had to do something about protection and having parts of the system thatanyone can write too, is simply a security risk.As far as I know they even removed the Documents and Settings/All Users part of the harddisk hierarchy because of the same reason. If they didn't it would be the best place to put those things possibly in the form of an INI file. NI can not fix the mess MS has been getting into over the years and finally started to address.

 

Rolf Kalbermatter

 


No, they didn't remove this folder. And that's exactly where I would suggest to save application specific, but not user specific data. It's just at a new location in Vista, C:\ProgramData.

But don't use this absolute path because it can be changed, so always use a windows API call to get the all users application data folder.

I posted a VI here (originally found on LAVA) that will do the API call.

 

Just as a side note, a lot of programmers were just relying on the fact that a Win XP user has admin rights. Even on XP some users had limited privileges. Ask them what they think of software that runs only with admin rights... So whenever possible software shouldn't require admin privileges (except for installation, of course).

 

Daniel

 

Message 8 of 24
(4,113 Views)

Thanks guys.

 

I am using the Application Data folder for my ini files.  However, I would like to place some things which are hidden from the user (they can always find it in App Data folder).  Also I would like for this information to remain on their computer even after uninstall.

 

Any ideas?

0 Kudos
Message 9 of 24
(4,108 Views)

What do you mean by "hidden"? The registry isn't really hidden. And the ProgramData folder is a hidden folder, so unless a user shows hidden files & folders it won't be visible.

If you just want to obscure some things, you can store information in a binary file (instead of plain text ini file).

 

Files you create in the ProgramData folder remain on disk when you uninstall the application. I think there has been a thread on how to remove those files and it seems it's not straightforward to remove them. So if you want to keep the files you're lucky Smiley Happy

The uninstaller, as far as I know, only removes files which were created by the installer and haven't been modified since installation.

 

Daniel

 

 

Message Edited by dan_u on 08-24-2009 11:12 AM
0 Kudos
Message 10 of 24
(4,104 Views)