Results 1 to 2 of 2

Thread: Change the application user in the environment

  1. #1
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Change the application user in the environment

    Hi,

    I would like my application to be executed by a speific user under Windows.
    The "current" user may not have the necessary rights to create a new file, and I would like this action to be performed by "Administrator" user.

    Like my I/O operations are performed in a sub-application, I could simply execute this QProcess as an "Administrator" task... For that I can use the void QProcess::setEnvironment ( const QStringList & environment ) function.

    The problem is the fallowing : I don't know the keys corresponding.
    Using QStringList environment = QProcess::systemEnvironment(), I know that the user name is store in the key "USERNAME". But, in wich key is stored the password ?!

    I've the value of the administrator password, but not the key.
    As somebody an idea ?

    Thanks for your help.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change the application user in the environment

    No, you cannot do it like that...
    And the admin pwd is not stored in the registry . Come on, not even Windows is not that stupid.

    Even if you query the user for the admin password, I'm not really sure if you can use QProcess for launching a process with less credentials than the parent process.

    I think you're on the wrong path. Perhaps searching MSDN would provide some results, because I think something like this is not possible without platform API.

    If you use Vista, then read something about UAC. I guess it is easier to do it in Vista . If you need any materials, I'll help you( I think I attached something in an older post )

    Regards

Similar Threads

  1. Replies: 3
    Last Post: 31st March 2006, 18:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.