Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,207,879 members, 8,000,706 topics. Date: Tuesday, 12 November 2024 at 02:01 PM

How Do You Elevate Privileges On Vista At Runtime - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How Do You Elevate Privileges On Vista At Runtime (1772 Views)

Update Jtable At Runtime / Conpaas - An Open-source Runtime Environment For Cloud Applications / I Use Open App.path & "file.txt" For Output As #1 But Wasnt Working In Vista (2) (3) (4)

(1) (Reply)

How Do You Elevate Privileges On Vista At Runtime by Nobody: 5:28pm On Dec 14, 2009
any help as to how you let your program request an administrator privilege while running.
in python or QT

i have googled but the option i may settle for it

run the software e.g app.exe
then use os.sytem() to run a commandline like runas /user:Administrator "app.exe"
app.exe is the same software, then then terminate the first app.exe process.

that will work but i know there are better ways to do this.
Re: How Do You Elevate Privileges On Vista At Runtime by joefazee(m): 8:59pm On Dec 14, 2009
Well, i have not be doing GUI with QT, but whatever, check the pythonwin32 module and i think it contains something inside.
see

import win32net
import win32netcon
shinfo={ }
shinfo['netname'] = 'python test'
shinfo['type'] = win32netcon.STYPE_DISKTREE
shinfo['remark'] = 'data files'
shinfo['permissions'] = 0
shinfo['max_uses'] = -1
shinfo['current_uses'] = 0
shinfo['path'] = 'c:\\my_data'
shinfo['passwd'] = ''
server = 'servername'
win32net.NetShareAdd(server, 2, shinfo)


What the above code does is to create a shared folder across LAN network, the dictionary object contain key of [netname, passwd] that enable you to logon and gain administrative level before performing the task. so, look into win32neton module
Re: How Do You Elevate Privileges On Vista At Runtime by Nobody: 10:47am On Dec 15, 2009
thanks for your contribution,
i later figured it out that Microsoft has the info on their website

http://msdn.microsoft.com/en-us/library/bb756929.aspx

it's working like magic now

(1) (Reply)

How To Make Money With Opensource / Dear Programmer, I Have An Idea / Which Is Better Inline Javascript Or External Javascript

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 6
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.