chore: log all CreateProcess args, environment

This commit is contained in:
goaaats 2022-05-23 23:52:21 +02:00
parent 12b9ac4307
commit 45fd104e42
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -1,7 +1,9 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
@ -87,11 +89,20 @@ namespace Dalamud.Injector
try
{
Log.Information("Starting with __COMPAT_LAYER={CompatLayer}", Environment.GetEnvironmentVariable("__COMPAT_LAYER"));
var commandLine = $"\"{exePath}\" {arguments}";
Log.Information("Starting with:");
Log.Information("lpCommandLine: {CommandLine}", commandLine);
Log.Information("lpCurrentDirectory: {CurrentDirectory}", workingDir);
Log.Information("Environment:");
foreach (var envVar in Environment.GetEnvironmentVariables().Cast<DictionaryEntry>())
{
Log.Information("\t{Key}={Value}", envVar.Key, envVar.Value);
}
if (!PInvoke.CreateProcess(
null,
$"\"{exePath}\" {arguments}",
commandLine,
ref lpProcessAttributes,
IntPtr.Zero,
false,