Tprocess fails to launch a process
Original Reporter info from Mantis: a.fortuny
-
Reporter name: Antonio Fortuny
Original Reporter info from Mantis: a.fortuny
- Reporter name: Antonio Fortuny
Description:
When executing the method TProcess.Execute, WinCE reports an error 87 which indicates a wrong parameter
Steps to reproduce:
This code works when using CreateProcess:
var
pi: TPROCESSINFORMATION;
si: TStartupInfo;
Msg: String;
Error: Integer;
{$IFDEF WINCE}
wPath: WideString;
{$ELSE}
wPath: String;
//si: TStartupInfo;
{$ENDIF}
begin
FillChar(pi,SizeOf(TPROCESSINFORMATION),#0);
wPath := APath;
{$IFDEF WINCE}
si.cb := SizeOf(TStartupInfo);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOW;
Result := CreateProcess(PWideChar(wPath), nil, nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, si, pi);
{$ELSE}
FillChar(si,SizeOf(TStartupInfo),#0);
si.cb := SizeOf(TStartupInfo);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOW;
Result := CreateProcess(nil, PChar(APath), nil, nil, False, CREATE_NEW_PROCESS_GROUP, nil, nil, @si, @pi);
{$ENDIF}
if not Result then begin
Error := GetLastError;
Logger.Add(Format(' Pocket program "%s" launching error %d:"%s"', [wPath, Error, SysErrorMessage(Error)]), 0);
end;
end;
Additional information:
In the unit ..\Lazarus\fpc\2.6.1\source\packages\fcl-process\wince\process.inc at first line of the Execute method (source line 184) FInheritHandles is set to True where MS says it must to be set to False as it is not implemented. It appears to be checked anyway. SI information present or nil doesn't matter.
Mantis conversion info:
- Mantis ID: 23935
- OS: WinCE
- OS Build: 5.0 6.0
- Platform: Win32-64
- Version: 2.6.1
- Fixed in version: 3.0.0
- Fixed in revision: 26320 (#3369466d)