06-04-2009 01:53 AM
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?
06-05-2009 04:56 AM
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
08-21-2009 07:44 PM
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.
08-23-2009 02:58 PM
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
08-24-2009 03:09 AM
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!?
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 !?
/end rant
08-24-2009 03:10 AM
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.
08-24-2009 03:39 AM
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
08-24-2009 03:58 AM
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
08-24-2009 04:02 AM
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?
08-24-2009 04:10 AM - edited 08-24-2009 04:12 AM
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
The uninstaller, as far as I know, only removes files which were created by the installer and haven't been modified since installation.
Daniel