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;
using System.Collections;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
@ -87,11 +89,20 @@ namespace Dalamud.Injector
try 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( if (!PInvoke.CreateProcess(
null, null,
$"\"{exePath}\" {arguments}", commandLine,
ref lpProcessAttributes, ref lpProcessAttributes,
IntPtr.Zero, IntPtr.Zero,
false, false,