[Qt-interest] Registry Virtualization in Windows Vista and QSettings

Constantin Makshin cmakshin at gmail.com
Wed Nov 4 16:26:08 CET 2009


On Wed, 04 Nov 2009 10:56:29 +0300, Anthony Serdyukov  
<uksus70+qt at gmail.com> wrote:
> Thank you, Constantin, for your reply.
>
> My application has a settings dialog. Some settings should be stored
> user-scoped, but several of them are system-wide. Thus, system
> administrator should have an opportunity to open the program, go to
> the settings dialog and alter several settings to affect all users. At
> the same time plain user should also go to this dialog and alter only
> user-scoped settings. Therefore, I have to determine whether current
> user is permitted to write to the SystemScope, and depending of the
> result disable, hide, etc. system-scoped settings.
>
> Thank you, Marco, too.
>
> All right, adding a manifest is the way to disable virtualization for
> my application, thanks for the tip. However, this knowledge raises
> several another questions.
> First, how is it combined with Qt cross-platform development?
> Obviously, embedding manifest should be Windows-specific build step.
> And the second, is there a strait way to embed an elevation point into
> Qt program? Again, seems like it should be Windows-specific code
> (#ifdef).
Obviously, your application shouldn't request admin privileges (by using  
an elevated manifest or anything else) unless it really needs them. So  
just check if the user is an admin and disable/hide/etc. unneeded settings  
if [s]he isn't.

> But what about other platforms? As far as I'm concerned, Ubuntu Linux
> also has something similar to Windows UAC: it asks for an
> administrator credentials when an application tries to  perform some
> secure operation. Isn't there any "Qute" cross-platform interface for
> these tasks?
In *nix you can check the effective ID of the current user (geteuid()  
function) or, what may be even better, check if your application has write  
access to the system-scope settings file.

-- 
Constantin Makshin



More information about the Qt-interest-old mailing list