Starting administrator progs from a service using Windows VISTA

Posted: 11-10-2006, 03:44 PM
Hi,
I have a problem in launching an application through my service. I am
trying to launch e. g. update.exe through my service. The update.exe has a
UI. The UI should displayed on the current desktop. But the update.exe has to
run
with admin rights. Therefore a UserAccount exits.

I´m trying this stuff with using the "CreateProcessAsUser" API function.

Here my code (pieces):
if (LogonUser(szUserName, _T("."), szPwd, LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, &hUser) == FALSE)
{ //error
}
else
{
if (CreateProcessAsUser(hUser, NULL, szComLine, NULL, NULL, FALSE,
CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi) == 0)
{ //error

}
}

CreateProcessAsUser failed. GetLastError is 740. And the error msgbox is
displayed in session0 (Service session on VISTA!).

What make I wrong?

Maybe there is another possibility to start my update.exe. Without using a
admin account. Perhaps I can impersonate the current launching process
(update.exe) from User Rights to admin rights. Is there a possibility?

Many thanks for your answer.




Reply With Quote

Responses to "Starting administrator progs from a service using Windows VISTA"

Jimmy Brush
Guest
Posts: n/a
 
Re: Starting administrator progs from a service using Windows VISTA
Posted: 11-11-2006, 11:48 AM
Hello,

I found this bit of information in the MSDN forums that may help you:

1. use the LogonUser API to logon on the admin user and get their (not
elevated) “filtered” token. You can also get the user token of an existing
process running as admin.

2. call GetTokenInformation with the InformationClass set to
TOKEN_LINKED_TOKEN to get the full (elevated) token.

3. You can then impersonate to the higher privileged token and spawn from
there



--
- JB

Windows Vista Support Faq
http://www.jimmah.com/vista/

Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
local administrator in Windows Vista Sachin Jindal Windows Vista Administration 6 08-03-2006 02:29 AM
Print Spooler Service not automatically starting Rick Windows XP Printers / Scanners / Fax 0 10-27-2003 08:12 PM
starting service, minlogon/command shell system Roger Levy Windows XP Embedded 1 10-05-2003 07:34 PM
Error starting IPSEC service Steve Windows XP Work Remotely 0 10-04-2003 11:24 AM
Workstation Service not starting? Steve Lefevre Windows XP Setup 0 08-03-2003 07:31 PM