<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>1. pe win nu ai fork, deci nu ai nev sa schimbi std handle-ul
apeland aceasta functie.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>2. corect<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>3. inputul si outputul la noul process ori va fi la/de la consola
shell-ului fie la/de la fisier. Deci ghici ciuperca ce-i? foloseste GetStdHandle
sau CreateFile pt a genera handle-uri pe care le pui in STARTUPINFO in functie
de caz. Eu am foloisit </span>DuplicateHandle <span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>pt a obtine handle inheritable
din ce imi da GetStdHandle.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>4. nu. </span>STARTUPINFO.hSthInput<span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'> = handle inheritable la
fisier si gata.<o:p></o:p></span></p>
<div style='border:none;border-top:solid #91C0FF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Segoe UI","sans-serif"'>From:</span></b><span
style='font-size:9.0pt;font-family:"Segoe UI","sans-serif"'>
so-bounces@cursuri.cs.pub.ro [mailto:so-bounces@cursuri.cs.pub.ro] <b>On Behalf
Of </b>Catalin Iacob<br>
<b>Sent:</b> Friday, November 03, 2006 11:04 PM<br>
<b>To:</b> so@cursuri.cs.pub.ro<br>
<b>Subject:</b> [so] Tema 1 Windows - redirectari<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Din ce am observat eu, pe Windows:<br>
<br>
1. functia DuplicateHandle nu face acelasi lucru ca dup2 din Linux in ciuda
asemanarii de nume si nu e utila pentru redirectari<br>
<br>
2. nu se poate folosi SetStdHandle pentru ca el ar schimba outputul si inputul
shellului nu al proceselor pe care le lanseaza <br>
<br>
3. am tot incercat cu setarea explicita a hSthInput, hStdOutput, hStdError din
STARTUPINFO inainte de CreateProcess, problema e ca daca in comanda am de
exemplu doar redirectarea stdout nu stiu ce valori sa pun in hStdInput si
hStdOutput - sa fie utile aici handlere obtinute din CONIN$ si CONOUT$ cu
CreateFile? <br>
<br>
4. pe Win chiar si redirectarile simple gen cat <aa au neaparata nevoie de
pipe-uri<br>
<br>
Rugamintea mea ar fi ca unul dintre asistenti sa imi spuna despre fiecare din
observatiile de mai sus daca e corecta sau nu <br>
<br>
Si daca nu sunt aproape de solutie poate ar putea sa-mi dea si o idee :-D. <br>
<br>
Multumesc<o:p></o:p></p>
</div>
</body>
</html>