<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[wiedermal pipes :)]]></title><description><![CDATA[<p>Hi leute. Hab mich jetzt echt hier durch die komplette forensuche durchgehangelt. Ich will einfach die ausgaben der cmd auslesen und neue befehle eintippen können - remote.<br />
Hab mir da mal bissl was zamgebastelt:</p>
<pre><code>char buf[512];
    DWORD dummy, dummy2;
    HANDLE Read, Write;
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;

    ZeroMemory(&amp;sa, sizeof(SECURITY_ATTRIBUTES));
    ZeroMemory(&amp;pi, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&amp;si, sizeof(STARTUPINFO));

    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.bInheritHandle = true;
    sa.lpSecurityDescriptor = NULL;

    memset(buf, 0, sizeof(buf));
    CreatePipe(&amp;Read, &amp;Write, &amp;sa, NULL);
    strcpy(buf, &quot;mkdir C:\\testfolder\r\n&quot;);
    WriteFile(Write, buf, strlen(buf)+1, &amp;dummy, NULL);

    si.cb          = sizeof(STARTUPINFO);
    si.dwFlags     = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
    si.hStdInput   = Read;
    si.hStdOutput  = Write;
    si.hStdError   = Write;
    si.wShowWindow = SW_HIDE;

    if(!CreateProcess(NULL, buf, NULL, NULL, TRUE, 0, NULL, &quot;C:\\&quot;, &amp;si, &amp;pi)) {
        sprintf(buf, &quot;Errornum: %d&quot;, GetLastError);
        MessageBox(NULL, &quot;error&quot;, buf, MB_OK | MB_ICONSTOP);
        return -1;
    }

    memset(buf, 0, sizeof(buf));
    ReadFile(Read, buf, sizeof(buf), &amp;dummy2, NULL);

    MessageBox(NULL, buf, &quot;bla&quot;, MB_OK | MB_ICONINFORMATION);
</code></pre>
<p>CreateProcess() schlägt fehl. Hab auch schon probiert statt &quot;C:\&quot; NULL zu nehmen wie ich es oft gesehen habe.</p>
<p>so long..<br />
mfg jghj</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/83467/wiedermal-pipes</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 11:32:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/83467.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Aug 2004 22:10:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to wiedermal pipes :) on Fri, 20 Aug 2004 22:10:56 GMT]]></title><description><![CDATA[<p>Hi leute. Hab mich jetzt echt hier durch die komplette forensuche durchgehangelt. Ich will einfach die ausgaben der cmd auslesen und neue befehle eintippen können - remote.<br />
Hab mir da mal bissl was zamgebastelt:</p>
<pre><code>char buf[512];
    DWORD dummy, dummy2;
    HANDLE Read, Write;
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;

    ZeroMemory(&amp;sa, sizeof(SECURITY_ATTRIBUTES));
    ZeroMemory(&amp;pi, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&amp;si, sizeof(STARTUPINFO));

    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.bInheritHandle = true;
    sa.lpSecurityDescriptor = NULL;

    memset(buf, 0, sizeof(buf));
    CreatePipe(&amp;Read, &amp;Write, &amp;sa, NULL);
    strcpy(buf, &quot;mkdir C:\\testfolder\r\n&quot;);
    WriteFile(Write, buf, strlen(buf)+1, &amp;dummy, NULL);

    si.cb          = sizeof(STARTUPINFO);
    si.dwFlags     = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
    si.hStdInput   = Read;
    si.hStdOutput  = Write;
    si.hStdError   = Write;
    si.wShowWindow = SW_HIDE;

    if(!CreateProcess(NULL, buf, NULL, NULL, TRUE, 0, NULL, &quot;C:\\&quot;, &amp;si, &amp;pi)) {
        sprintf(buf, &quot;Errornum: %d&quot;, GetLastError);
        MessageBox(NULL, &quot;error&quot;, buf, MB_OK | MB_ICONSTOP);
        return -1;
    }

    memset(buf, 0, sizeof(buf));
    ReadFile(Read, buf, sizeof(buf), &amp;dummy2, NULL);

    MessageBox(NULL, buf, &quot;bla&quot;, MB_OK | MB_ICONINFORMATION);
</code></pre>
<p>CreateProcess() schlägt fehl. Hab auch schon probiert statt &quot;C:\&quot; NULL zu nehmen wie ich es oft gesehen habe.</p>
<p>so long..<br />
mfg jghj</p>
]]></description><link>https://www.c-plusplus.net/forum/post/587506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/587506</guid><dc:creator><![CDATA[jghj]]></dc:creator><pubDate>Fri, 20 Aug 2004 22:10:56 GMT</pubDate></item><item><title><![CDATA[Reply to wiedermal pipes :) on Sat, 21 Aug 2004 09:05:29 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp" rel="nofollow">MSDN: Creating a Child Process with Redirected Input and Output</a></p>
<p>Ansonsten: Was für einen Fehler bekommst du denn von CreateProcess - GetLastError?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/587588</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/587588</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 21 Aug 2004 09:05:29 GMT</pubDate></item><item><title><![CDATA[Reply to wiedermal pipes :) on Sat, 21 Aug 2004 10:43:00 GMT]]></title><description><![CDATA[<p>bei dem msdn sample machen die das mit childprozessen etc. und ich denke das müsste man doch eigtl garnicht alles brauchen oder? Ich will ja eigtl nur einen befehl ausführen (in meinem bsp jetzt mkdir testfolder) und einfach den output bekommen.<br />
GetLastError() gibt errorcode 2 zurück.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/587642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/587642</guid><dc:creator><![CDATA[jghj]]></dc:creator><pubDate>Sat, 21 Aug 2004 10:43:00 GMT</pubDate></item><item><title><![CDATA[Reply to wiedermal pipes :) on Sat, 21 Aug 2004 10:56:39 GMT]]></title><description><![CDATA[<p>jghj schrieb:</p>
<blockquote>
<p>bei dem msdn sample machen die das mit childprozessen etc. und ich denke das müsste man doch eigtl garnicht alles brauchen oder?</p>
</blockquote>
<p>Doch, ich denke schon, dass du den Code weitgehend so brauchst.</p>
<p>jghj schrieb:</p>
<blockquote>
<p>Ich will ja eigtl nur einen befehl ausführen (in meinem bsp jetzt mkdir testfolder) und einfach den output bekommen.<br />
GetLastError() gibt errorcode 2 zurück.</p>
</blockquote>
<p>2 The system cannot find the file specified. ERROR_FILE_NOT_FOUND</p>
<p>Du musst imho die Shell starten, und dort den Befehl ausführen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/587652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/587652</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 21 Aug 2004 10:56:39 GMT</pubDate></item><item><title><![CDATA[Reply to wiedermal pipes :) on Sat, 21 Aug 2004 11:07:00 GMT]]></title><description><![CDATA[<p>ok hab jetzt einfach mal den command mit dem cmd pfad davor eingetippt. Fehler von CreateProcess kommt keiner mehr .... was ich jetzt aber seeehhhrrr seltsam finde, in dem folder, in dem die exe liegt werden 4 dateien erstellt die so heißen: &quot;(C), der, konnte, Microsoft&quot;<br />
also das weiß ich echt nicht was das sein soll <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";D"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/587662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/587662</guid><dc:creator><![CDATA[jghj]]></dc:creator><pubDate>Sat, 21 Aug 2004 11:07:00 GMT</pubDate></item><item><title><![CDATA[Reply to wiedermal pipes :) on Sat, 21 Aug 2004 11:34:34 GMT]]></title><description><![CDATA[<p>Wenn du die cmd.exe startest siehst du ganz oben folgendes (so sieht es bei mir unter W2k aus):</p>
<blockquote>
<p>Microsoft Windows 2000 [Version 5.00.2195]<br />
(C) Copyright 1985-2000 Microsoft Corp.</p>
</blockquote>
<p>Evtl. hängt es damit zusammen.<br />
Aber schau dir auch mal die Parameter von cmd.exe mit /? an. Du kannst den Befehl nicht einfach direkt anhängen - ich denke du bräuchtest /c.</p>
<p>Aber warum nimmst du nicht einfach direkt CreateFile <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/587673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/587673</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 21 Aug 2004 11:34:34 GMT</pubDate></item></channel></rss>