Re: Launch an executable as a user from an administrative account



Hello Philou66,

Philou66 wrote:
Hi,
I am logged in as an Administrator on a windows xp's Telnet server.
An user is currently logged on the machine, and from the telnet
server, I would like to run a program as if the user launched it.
A kind of runas, but I don't know the user's password.

I tried this piece of code that looks exactly to what I'm looking
for : http://sayala.com/code/ProcessAsUser.cs

If I run it simply as the logged on user, it works okay.
But if I connect to telnet, login as admin, and try it again, it will
fail on the API call OpenProcessToken.

Is there really a way to do what I'm looking for ?
The ultimate goal is to be able to modify some user parameters with
SystemParametersInfo, while being logged on as Admin.
This is possible by editing the users' registry keys, but needs
reboot!! I am looking for a way to immediatly commit any changes.

Thanks for you help, and have a nice day!


What you want to do is not really easy. You need to "steal" the token from one of the executables that the interactively logged in user is running and then launch an executable using CreateProcessAsUser with the stolen token, so it runs on the interactive user's desktop and in the context of the user. One of the problems you will face is clearly identifying a process of the user (as there are potentially many interactively logged on users), from which you can steal the token. I encourage you to look at the superusr sample that shipped with the Platform SDK samples up to and including the Windows Server 2003 SP1 Platform SDK.

--
Stefan



.



Relevant Pages

  • Re: Product for Running Embedded C# Application
    ... Telnet sessions or Web sessions with our Web server on the device and a lot ... There's a Telnet server available to Windows CE ... communicates with specific hardware and forwards data to a back end ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: X-Window and Java question
    ... I know next to nothing about java and have a few questions; ... > Students telnet into the Redhat server and use PICO to create their ... > In another group it was suggested that I install an X Server on the Windows ...
    (alt.os.linux.redhat)
  • Re: X-Window and Java question
    ... I know next to nothing about java and have a few questions; ... > Students telnet into the Redhat server and use PICO to create their ... > In another group it was suggested that I install an X Server on the Windows ...
    (linux.redhat)
  • Re: ssh
    ... As far as I know no one has ssh (server) for Windows built in. ... IBM has "secure telnet" for wIntegrate for secure logins to Windows ...
    (comp.databases.pick)
  • Re: BaseClasses still missing
    ... other lib files should be in the ..\Microsoft Platform SDK for Windows ... Server 2003 R2\lib folder. ... Is there a makefile in this folder? ...
    (microsoft.public.win32.programmer.directx.audio)