CreateProcess( not inhiert handle not working
Posted on 2004-10-26
When I run my app on WinXP w/SP1. CreateProcess doesn't allow the launch
handle to inheirt the the handles.
*I have not tried it on xp w/sp2
This works on Win2k, Win98se.
If it is I have to set the sececurity for it.
Then I have and it still doesn't get the handle.
In the msdn it said it changed the way the security is done with createprocess on winxp w/sp2 and w2003, but
doesn't exaplain exactly what it changed. Which lead me to try to include the @security, but it still doesn't work
Does anyone know which Windows Update might of affectted this, because as of April of this year this code was working
on WinXP w/SP1.
Delphi v6 w/all updates
FillChar(FossilPI, sizeof(TProcessInformation), 0);
FillChar(FossilSI, SizeOf(TStartupInfo), 0);
FossilSI.cb := SizeOf(TStartupInfo);
FossilSI.dwFlags := STARTF_USESHOWWINDOW;
FossilSI.wShowWindow := SW_NORMAL;
AppPath := 'C:\RG\';
AppParams := ExtractFilePath(ParamStr(0)) + 'mSyncFos.exe 1 '+IntToStr(Sock1Handle)+' 100 C:\RG\RENEGADE.EXE -N1 -B19200 -T -Q';
SetSecurityDescriptorDacl(@secDes, True, nil, False);
With Security do begin
nlength := SizeOf(TSecurityAttributes) ;
binherithandle := true;
lpsecuritydescriptor := @SecDes;
if CreateProcess(nil, PChar(AppParams), nil, nil, true, NORMAL_PRIORITY_CLASS, nil, PChar(AppPath), FossilSI, FossilPI) then begin
FossilRS := WaitForSingleObject(FossilPI.hProcess, 1000);
until FossilRS <> WAIT_TIMEOUT;