With Vista out, I want to make sure that my applications behave themselves properly. I'm running into the problem of where/how to save (re)writable information in the registry.
For user-preferences I can ofcours use HKEY_CURRENT_USER. But what to use for information that is instrument specific? I.e. info that should be written and shared by multiple users? I would think HKEY_LOCAL MACHINE... but that's not writable for non-admin's, is it? Is there another default place for that?
With regedit, I can ofcourse make my little software part of LOCAL MACHINE writable for all users... But that's no option for regular users... How would I distribute such software? The Installer from Application Builder can make registry keys, but it doesn't allow to set the permissions...
Hello Anthony and the others,
that is also my problem, is there a proper place
in the registry where non Admin have the right to
write and other users can read this information.
"Current_User" is no good idea it will be overwritten
at the next login.
My idea is, I want to log the time that an application
has consumed, since the first start.
I wrote a small program for that (LV6.0.2).
Are there any ideas? A combined licence and log file
is no good idea, you just have to keep the new file
and copy from time to time this file, where the software
looking for it.
Is there an example of an LabView program that the admin
starts once (a kind of installation routine) and that
creates an registry key and sets the right in a way that
every user has the right to read and write to that key?
I am sorry to say that I do not have an out-of-the-box solution ready yet. Reading the documentation to Microsoft's UAC sounds a bit 1984ish to me, and leads me to the conclusion that machine-dependent settings might be better off in a "good ol' .INI file".
I will discuss this matter with some colleagues if maybe they have an idea how to build a workaround. Meanwhile, I recommend this lecture, if you have not already read it:
In short terms, Microsoft specifies all "per machine" settings as administrative duties, thus needing the corresponding administrative token. This may be just my personal opinion, but I don't think it's wise to ask the user for administrative access each time you want to save machine-specific settings or want to log the amount of time your (demo) application has already run...
I have tried a workaround myself, but with bad result. The idea was to write into "current_user" and to read from all other "HKEY_USERS\.." subkeys. It should work, but it doesn't, perhaps someone knows the clou. Please try my workaround and give me feedback.
P.S.: The code is LV6.0.2, first run as admin the installation program.
first of all, I strongly discourage you to create "hidden" registry keys, especially using copyrighted/trademarked names of other software products. This may not only be a copyright infringement, but might also been prosecuted as software manipulation.
If I remember correctly, I provided you with an alternative solution when we met IRL last weekend (using a file's date/time info to log usage activity). Another option might be some kind of telephone-based activation: your program generates an n-digit code based on the current time, which your customer will give you via telephone. Using the same code algorithm, you generate an activation code which then initiates your 10-minute countdown. The downside of this idea is that your customer needs to call whenever he wants to test your app, the upside is that you can grant as many tests as you like without having the customer to de- and reinstall your program.
This having said, there is a tool from Microsoft which can be used to edit access rights for the registry. It's name is "SubInACL.exe" - but I cannot provide you with a download link.
in the meantime I found the tool to touch / change the time and date of a file, it is called "touch.com" (from Charles Dye). But the manipulation of file informations is only a resolution if you want to store only a few numbers and it is good idea, that you gave to me. But if you have a couple of writeable informations, that you want to store in the registry, you have to set the rights of these registry keys properly, if my workaround is only working for admin-users. So thank you for the hint to the registry tool "SubInACL.exe". The reason for my investigation into this topic was: I want to provide a test-software, that you can run on a lab-computer without internet access with limited run-time. And the result of my experiments is: There is no chance to do that without extra hardware (e.g. SD-card). My resolution will be: that the demo-software will not work properly. It is a measurement software for a specific hardware (Zahner IM6) and I will introduce a routine that will manipulate the measured data randomly, so the customer can test the "look and feel" and the capabilities, but the measured data is slightly messed up.
But I'm still interested, if it is possible to store information in a readable form in the "HKEY_USERS\.." subkeys of the other users, that are accredited localy on this machine.
thank you for this information! So there is still the good old ini-file, but you have to set the rights properly, also for future not-admin users, to do that I wrote a routine, but I'm not shure if it works under "Vista", see: http://forums.ni.com/ni/board/message?board.id=170&message.id=298722#M298722