Recover the key from the time when the process was created

Thanks Wintermute!
This commit is contained in:
Mino 2020-03-25 16:11:58 +09:00
parent cd45ecd377
commit 16d806a2bb
4 changed files with 63 additions and 197 deletions

View file

@ -155,6 +155,24 @@ namespace Dalamud.Bootstrap
}
}
/// <summary>
/// Returns a time when the process was started.
/// </summary>
public DateTime GetCreationTime()
{
unsafe
{
FileTime creationTime, exitTime, kernelTime, userTime;
if (Win32.GetProcessTimes(m_handle, &creationTime, &exitTime, &kernelTime, &userTime))
{
ProcessException.ThrowLastOsError(GetPid());
}
return (DateTime)creationTime;
}
}
private string[] ParseCommandLine(ReadOnlySpan<byte> commandLine)
{
unsafe