Windows Vista Forums
Vista Forums Home Join Vista Forums Tech Publications Windows 7 Forum Vista Tutorials Webcasts Tags

Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

Vista service - session 0 isolation

Update your Vista Drivers
Reply
 
Thread Tools Display Modes
Old 04-17-2007   #1 (permalink)
Gene Vangampelaere
Guest


 

Vista service - session 0 isolation

I'm having a problem with a windows service running on a Vista client.
Situation:
A windows service running as LocalSystem hosts a .net remoting object. When
some event raises then the service starts a process. That process is a
windows forms applicatation. That process must run under the LocalSystem
account because it needs some (local)admin privileges. Under XP we used the
"interact with desktop" functionality to show the forms application. With
Vista (Session 0 Isolation) this is no longer possible. Anyone some advice
about this?


Kind regards,

Gene







My System SpecsSystem Spec
Old 04-17-2007   #2 (permalink)
Jesper
Guest


 

RE: Vista service - session 0 isolation

You need to rearchitect your application and factor the UI piece into an
interactive program. Then you can use LPC to communicate between that and the
service.

This book will tell you how:
http://www.amazon.com/Writing-Secure...6841908&sr=1-2

---
Your question may already be answered in Windows Vista Security:
http://www.amazon.com/gp/product/047...otectyourwi-20


"Gene Vangampelaere" wrote:

> I'm having a problem with a windows service running on a Vista client.
> Situation:
> A windows service running as LocalSystem hosts a .net remoting object. When
> some event raises then the service starts a process. That process is a
> windows forms applicatation. That process must run under the LocalSystem
> account because it needs some (local)admin privileges. Under XP we used the
> "interact with desktop" functionality to show the forms application. With
> Vista (Session 0 Isolation) this is no longer possible. Anyone some advice
> about this?
>
>
> Kind regards,
>
> Gene
>
>
>
>
>
>
>

My System SpecsSystem Spec
Old 04-18-2007   #3 (permalink)
Larry Futrell
Guest


 

Re: Vista service - session 0 isolation

Gene Vangampelaere wrote:
> I'm having a problem with a windows service running on a Vista client.
> Situation:
> A windows service running as LocalSystem hosts a .net remoting object.
> When some event raises then the service starts a process. That process is
> a windows forms applicatation. That process must run under the LocalSystem
> account because it needs some (local)admin privileges. Under XP we used
> the "interact with desktop" functionality to show the forms application.
> With Vista (Session 0 Isolation) this is no longer possible. Anyone some
> advice about this?
>

If a service running as LocalSystem really wants to run a process as
LocalSystem on a user desktop in a Terminal Services session other than 0,
it is esay to do. I have code to do that, which uses the following sequence
of calls. The code below is modified somewhat from my working code to
simplify it, and I have not actually compiled or run it, but it should give
you the general idea. You need to add code to set sessionID to the user's
Terminal Services session ID, and to declare commandLine and set it to the
command to be executed.

STARTUPINFO si;
PROCESS_INFORMATION pi;
HANDLE hToken = NULL;
HANDLE hPrimaryToken = NULL;
DWORD dwSize;
DWORD sessionID;
..
..
..
if (ImpersonateSelf(SecurityImpersonation)) {
if (OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, FALSE, &hToken))
{
dwSize = sizeof sessionID;
if (SetTokenInformation(hToken,
TokenSessionId,
&sessionID,
dwSize)) {
if (DuplicateTokenEx(hToken,
MAXIMUM_ALLOWED,
NULL,
SecurityImpersonation,
TokenPrimary,
&hPrimaryToken)) {
ZeroMemory(&pi, sizeof pi);
ZeroMemory(&si, sizeof si);
si.cb = sizeof(STARTUPINFO);
si.lpDesktop = "winsta0\\default";
if (CreateProcessAsUser(hPrimaryToken,
NULL,
commandLine,
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi)) {
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
CloseHandle(hPrimaryToken);
}
}
CloseHandle(hToken);
}
RevertToSelf();
}

--
Larry Futrell


My System SpecsSystem Spec
Reply
Update your Vista Drivers

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in service user profile in session initialization - Cannot l CVARGASSIMON Vista General 2 04-26-2008 04:57 PM
Terminal Service session slow on Vista for just one server Hassan Vista General 8 11-24-2007 07:47 AM
Vista service - session 0 isolation Gene Vangampelaere Vista General 4 04-17-2007 10:31 AM
Local Session Manager Service - Excessive Handle Count? jminiman Vista performance & maintenance 1 03-04-2007 10:39 PM


Complimentary Industry Resources

Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today!




Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51