🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7646

Re: redirect standard consolle input/output and security. Please Mr.Gambit help me!

#7646
From: Stefano Bonifazi
Date: Thu, 30 Dec 2004 09:13
56 lines
3155 bytes
Hi Mr. Lebeau,
 THANK YOU for Your reply!

> You don't need separate pipes for stdout and stderr.  You can use the same
> pipe for both of them.
>
 I know, it was only a personal choice!

>>   if(!DuplicateHandle(hProcess, ChildSTDOUT_ReadPipeHandleTmp,hProcess,
>> &ChildSTDOUT_ReadPipeHandle, 0, FALSE, DUPLICATE_SAME_ACCESS))
>>    return -4;
>
> Why are you duplicating the pipes you just created?

To be honest I must confess I don't know why ... I reused a code snippet ... 
I always asked myself why ... It sounded redundant to me ... but it worked!

>
>>   si.lpDesktop =  "WinSta0\\Default"; //also tried without anything
> here!!!
>
> Are you intending for the user logged into the service's machine to 
> interact
> with the console that you are creating?  If not, then get rid of that. 
> You
> only need to specify the Desktop if you are going to make the console 
> visual
> for interaction with the user.  Otherwise, CreateProcessAsUser() creates 
> the
> console non-visually instead.

No there was not at first, I added it cause the matter now is that when I 
use an account in this function other than the user logged into the 
service's machine the function succeeds (no one of its functions fails!) but 
the std input/output are not redirected!;(

>
>>   CloseHandle(TempTokenHandle);
>
> You are closing the token while you are still impersonating the user and
> while the console process is still running.  Wait until the console 
> process
> is terminated before doing that.  Also, if CreateProcessAsUser() fails, 
> you
> are not removing the impersonation.
>

I removed it completely, but the result is the same: If I provide to this 
routine the same user that is currently logged on in the service's machine 
(with his desktop open) the function succeeds and the std I/O is redirected 
fine, but with another user the function suceeds, but  I can't see anything 
redirected ;(
How may I do to make it running ok?

My best regards,
Stefano B. 
Technical Details
Message-ID: <41d3c6a3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news.netcologne.de!newsfeed-fusi.netcologne.de!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41d2f95b@newsgroups.borland.com> <41d30173@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,244542df6edac1be
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Stefano Bonifazi" <stefboombastic@email.it>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41d2f95b@newsgroups.borland.com> <41d30173@newsgroups.borland.com>
Subject: Re: redirect standard consolle input/output and security. Please Mr.Gambit help me!
Date: Thu, 30 Dec 2004 10:13:09 +0100
Lines: 58
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 151.24.174.29
Message-ID: <41d3c6a3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1104397987 151.24.174.29 (30 Dec 2004 01:13:07 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news.netcologne.de!newsfeed-fusi.netcologne.de!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail