From: <ah...@us...> - 2008-10-09 16:11:32
|
Revision: 11955 http://jvcl.svn.sourceforge.net/jvcl/?rev=11955&view=rev Author: ahuser Date: 2008-10-09 16:11:29 +0000 (Thu, 09 Oct 2008) Log Message: ----------- Mantis #4513: TJvCreateProcess and console application causes EAccessViolation in CB2009 Modified Paths: -------------- trunk/jvcl/run/JvCreateProcess.pas Modified: trunk/jvcl/run/JvCreateProcess.pas =================================================================== --- trunk/jvcl/run/JvCreateProcess.pas 2008-10-08 19:44:29 UTC (rev 11954) +++ trunk/jvcl/run/JvCreateProcess.pas 2008-10-09 16:11:29 UTC (rev 11955) @@ -184,6 +184,7 @@ procedure GotoReadyState; procedure GotoWaitState(const AThreadCount: Integer); procedure GotoRunningState; + procedure SetCommandLine(const Value: string); protected procedure CheckReady; procedure CheckRunning; @@ -212,7 +213,7 @@ property ErrorReader: TJvBaseReader read FErrorReader; published property ApplicationName: string read FApplicationName write FApplicationName; - property CommandLine: string read FCommandLine write FCommandLine; + property CommandLine: string read FCommandLine write SetCommandLine; property CreationFlags: TJvCPSFlags read FCreationFlags write FCreationFlags default []; property CurrentDirectory: string read FCurrentDirectory write FCurrentDirectory; property Environment: TStrings read GetEnvironment write SetEnvironment; @@ -1292,6 +1293,16 @@ end; end; +procedure TJvCreateProcess.SetCommandLine(const Value: string); +begin + FCommandLine := Value; + {$IFDEF UNICODE} + { A constant string will cause an access violation in CreateProcessW } + if StringRefCount(FCommandLine) = -1 then + FCommandLine := Copy(FCommandLine, 1, MaxInt); + {$ENDIF UNICODE} +end; + procedure TJvCreateProcess.SetEnvironment(const Value: TStrings); begin FEnvironment.Assign(Value); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |