![]() |
AW: Packages in anderem Verzeichnis
Anstatt des Suchpfad des Parent-Prozesses zu verpfuschen,
wäre es bestimmt schöner das Environment als Parameter an CreateProcess zu übergeben. :stupid: |
AW: Packages in anderem Verzeichnis
Zitat:
Reading the Environment to pass it from parent to child, the block in whole should be read and passed, and it will be in this structure Zitat:
So, no.. (for me at least) it is not nicer at all. |
AW: Packages in anderem Verzeichnis
Delphi-Quellcode:
var Environment := TStringList.Create;
Environment.TrailingLineBreak := True; Environment.LineBreak := #0; //Environment.StrictDelimiter := True; //Environment.Delimiter := #0; //Environment.DelimitedText := GetEnvironmentStrings; var P := GetEnvironmentStrings; var S: String; while P <> '' do begin Environment.Add(P); Inc(P, Succ(Length(P))); end; Environment.Values['PATH'] := Environment.Values['PATH'] + ';' + TPath.Combine(TPath.GetAppPath, 'Version_1.0.0'); var Test := Environment.Text; //CreateProcess(ApplicationName, CommandLine, ProcessAttributes, ThreadAttributes, InheritHandles, CreationFlags, PChar(Environment.Text), CurrentDirectory, StartupInfo, ProcessInformation); |
AW: Packages in anderem Verzeichnis
Zitat:
Alas, i can't repeat it on my XE8, and neither it will work on older versions. On side note: Environment.Text should add an extra null char (two zeros bytes when used with CreateProcess), so it should be PChar(Environment.Text + #0), of course assuming the last line has the null terminator, if not then it should be added also, and that honestly because i never used StringList with #0 as LineBreak, it gives me goosebumps. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:59 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz