PDA

View Full Version : Registry and Vista



czar
15-11-2006, 02:04 AM
I have been trying to get a program working correctly with Windows Vista.

It currently works correctly for Windows XP. However, I am having problem with the copy protection.

The "administrator" has to run the registration process. Upon registration the settings are stored in HKEY_LOCAL_MACHINE. These are readable to all users. So once the admin has registered the software all users of that machine have the licensed version available.

Now the problem.

In Windows Vista the HKEY_LOCAL_MACHINE is not written to and instead the values are stored in a "virtual store" that is local to the administrator's account - in other words the other users still only have access to the demo version.


Questions:
1. If I cannot write to local_machine where then should I write these settings?
2. With Delphi 7 is it possible to force Windows Vista to go to the highest privileges level? And if so how?

I know vista isn't out yet so most of you won't have any experience with it yet. I can tell you it is going to be pain to get older software working with vista ;)

tux
15-11-2006, 07:41 AM
did you try right clicking the application and selecting "Run as Administrator"?

admins are run as standard user until they need to be admins, so i guess because it works with the registry redirection, its running as standard user

czar
15-11-2006, 08:04 AM
Yes I tried that - however the hkey_local_machine registry codes still ended up in a virtual store - which is local and not accessible by teh other accounts on the system.

cronodragon
15-11-2006, 02:51 PM
Is it possible to use a file registry instead of the system registry?

czar
15-11-2006, 05:16 PM
That would be an option. That also comes with problems. You need to set up a public directory.

I understand that M$ wants developers to put application data into the "documents and settings" directory structure - however, none of these directories seem to be easily shareable.

So it come sback to using a shared public directory off the c: drive - e.g. c:\MyApp

Which begs the question why not install the entire project in that directory and have done with it?

The more I work with Vista the more I feel M$ has "fixed" things that weren't broken - it is a frustrating experience.

cronodragon
15-11-2006, 05:30 PM
So it come sback to using a shared public directory off the c: drive - e.g. c:\MyApp

Which begs the question why not install the entire project in that directory and have done with it?

If M$ wants everyone to use their shared folder structure, they should have made it in a way that benefits it's use. If they are pushing so much, most developers just won't use it, and I think the reaction of M$ will be to return to a simple structure in the following versions of Windows.

tux
15-11-2006, 06:36 PM
what about the "C:\Users\Public" folders?

czar
15-11-2006, 07:25 PM
Ok I solved the problem. I will explain the solution so that others will find it a bit easier to work with Vista in the future.

The important thing is that even an Administrator does not have "administrator" rights by default. The admin is running their session with lower rights. That means any program that tries to write to hkey_local_machine will in fact be storing that information into a local store. i.e. that info will not be available to other users on the system.

Solution run the app by right clicking and selecting "run as administrator" (I know Tux suggested it above, but while trying many things I didn't spot the fact that it had succeeded when I tried that.).

Make sure you only use hkey_current_user unless it needs to be system wide. Do not change any files in Program Files after the initial install - any application data should go to the directory of the same name in Documents and Settings.

If anyone else can add any more Vista Tips then please do.