Article View: borland.public.cppbuilder.nativeapi
Article #10112Re: CreateProcessAsUser and Privileges
From: Stefano Bonifazi
Date: Sat, 15 May 2004 15:31
Date: Sat, 15 May 2004 15:31
42 lines
3147 bytes
3147 bytes
For the ones who are interested in the problem: I've found 2 solutions: 1) Starting the process with CreateProcess instead of CreateProcessAsUser, with the CREATE_SUSPENDED flag, then I use its handle to give it the privileges required to access the registry and finally I resume its main thread! 2) I call CreateProcess from a SYSTEM user (from a service program!) setting the process desktop to "WinSta0\\Default" but this fails if onother user logged on in the same machine before!! Note that both solutions requires a service to run the "external exe" as a normal program running in the same non administrator account of the "external exe" has not the privileges to change the "external exe" process privileges. It sounds like a great bug...please follow me: I am the administrator, and a programmer ( even if not so great :( ), there are other accounts on my machine who are not administrators... I have an external application (written by somebody, but I only have the exe), and its developer wrote it without considering WinXP rights stuff, so that application fails to load in the non administrative accounts, but I want my other accounts to be able to run it, so I would like to write down a simple application that log on with my administrative account given my user and password, and run the external application with my privileges ... well it sounds that it's not possible ... I must write a service to accomplish this trivial work!!!! Is not a big limitation???? See You all!! Stefano B. "Stefano Bonifazi" <stefboombastic@libero.it> ha scritto nel messaggio news:40a5055b@newsgroups.borland.com... > Hello Everybody!:-) > I have an external application (that is a exe without its code) that fails > to execute under a WinXP OS with accounts that do not have administrative > rights. Its problem is that it tries to access the HKEY_LOCAL_MACHINE key > with write rights (that it does not own!!) > I thought to write a my application that launches it with > CreateProcessAsUser cause I know both User and password of an > Administrator... > First I use the LogonUser API to get the Administrator token handle: >
Technical Details
Message-ID:
<40a637de@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!zen.net.uk!dedekind.zen.co.uk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40a5055b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5fb91eec7fd7a1d9 X-Google-Attributes: gid10cc67,public Reply-To: "Stefano Bonifazi" <stefboombastic@libero.it> From: "Stefano Bonifazi" <stefboombastic@libero.it> Newsgroups: borland.public.cppbuilder.nativeapi References: <40a5055b@newsgroups.borland.com> Subject: Re: CreateProcessAsUser and Privileges Date: Sat, 15 May 2004 17:31:44 +0200 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 151.24.139.200 Message-ID: <40a637de@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1084635102 151.24.139.200 (15 May 2004 08:31:42 -0700) Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!zen.net.uk!dedekind.zen.co.uk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail