🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Capturing output from CreateProcess in WinXP

#10792
From: Pete Fraser
Date: Mon, 15 Mar 2004 16:14
27 lines
1961 bytes
I've just answered my own question (again - must try harder before posting).
The security attributes needs a valid structure under NT. Use:
    if (IsWindowsNT())        // user specified function
    {
        InitializeSecurityDescriptor(&sd,
            SECURITY_DESCRIPTOR_REVISION);
        SetSecurityDescriptorDacl(&sd, true, NULL, false);
        sa.nLength = sizeof(SECURITY_ATTRIBUTES);
        sa.bInheritHandle = true;
        sa.lpSecurityDescriptor = &sd;
    }
and then change 4th parameter to CreateFile to be &sa and it all works

Rgds Pete

"Pete Fraser" <pete._no_spam_fraser@frasersoft.nospam.net> wrote in message
news:4055d230$1@newsgroups.borland.com...
>     I'm trying to capture the output from an external command but nothing
> seems to allow CreateProcess to write it's output to the file I've
created.
>
> The string "Fred was here" is always written to the file, but the output
> from 'Command' is not.
> Does anyone know why and can enlighten me.
> Confused, Pete

<snip>
Technical Details
Message-ID: <4055d659@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4055d230$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,c392016e8c59806d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-15 08:40:24 PST
From: "Pete Fraser" <pete._no_spam_fraser@frasersoft.nospam.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4055d230$1@newsgroups.borland.com>
Subject: Re: Capturing output from CreateProcess in WinXP
Date: Mon, 15 Mar 2004 16:14:16 -0000
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 195.12.18.1
Message-ID: <4055d659@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1079367257 195.12.18.1 (15 Mar 2004 08:14:17 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail