Can I get admin privileges?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
ninja9578
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 236
Joined: Thu Jan 29, 2009 3:33 pm

Can I get admin privileges?

Post by ninja9578 » Fri Oct 02, 2009 1:58 pm

I'm logged into my computer as admin, however, I don't think my program is running at that level because it fails to open a file c:\test.txt.

I think the problem is that my program is run from an NSIS installer, which uses ExecWait to run it. I think this causes my program to have less than admin privileges. Is there a way to request admin privileges?

spectrum
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

Post by spectrum » Fri Oct 02, 2009 3:45 pm

spectrum

mac
Earned some good credits
Earned some good credits
Posts: 103
Joined: Sat Jul 22, 2006 3:15 am

Re: Can I get admin privileges?

Post by mac » Fri Oct 09, 2009 8:41 am

ninja9578 wrote:...
Is there a way to request admin privileges?
You're talking about Vista right?
Yes, you can annoy the user with a box every time! ^_^'

Add a 'vista.manifest' file to your app's *.rc
like so: 1 24 "vista.manifest"

and in the manifest xml file add:

Code: Select all

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
vista 64bit, OS X 10.4.x, OS X 10.3.9 x 2
(virtualization: vista 32bit, MS XP, MS95, MS98, Debian 3.1, Slackware 12, FreeBSD 6.1, a few more)

wx: 2.8.8/9 (unicode)
compilers: gcc (GTK+2, OS X), vc++6(MSW)

Post Reply