mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
Recover the key from the time when the process was created
Thanks Wintermute!
This commit is contained in:
parent
cd45ecd377
commit
16d806a2bb
4 changed files with 63 additions and 197 deletions
|
|
@ -24,6 +24,13 @@ namespace Dalamud.Bootstrap
|
|||
throw new NotImplementedException("TODO");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pid"></param>
|
||||
/// <exception cref="BootstrapException">
|
||||
/// Thrown when it could not relaunch FINAL FANTASY XIV or inject Dalamud.
|
||||
/// </exception>
|
||||
public void Relaunch(uint pid)
|
||||
{
|
||||
// TODO
|
||||
|
|
@ -48,10 +55,11 @@ namespace Dalamud.Bootstrap
|
|||
using var process = Process.Open(pid);
|
||||
var commandLine = process.ReadCommandLine();
|
||||
|
||||
if (!EncodedArgument.Parse(commandLine[1], out var container))
|
||||
{
|
||||
// Recover the key
|
||||
|
||||
}
|
||||
// TODO: check if contains arg[1]
|
||||
|
||||
if EncryptedArgument.Extract(commandLine[1], )
|
||||
|
||||
|
||||
// TODO:
|
||||
|
|
@ -67,6 +75,20 @@ namespace Dalamud.Bootstrap
|
|||
process.Terminate();
|
||||
}
|
||||
|
||||
private static uint RecoverKey(Process gameProcess)
|
||||
{
|
||||
var createdTime = gameProcess.GetCreationTime();
|
||||
|
||||
var currentDt = DateTime.Now;
|
||||
var currentTick = Environment.TickCount;
|
||||
|
||||
var delta = currentDt - createdTime;
|
||||
var createdTick = (uint)currentTick - (uint)delta.TotalMilliseconds;
|
||||
|
||||
// only the high nibble is used.
|
||||
return createdTick & 0xFFFF_0000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Injects Dalamud into the process. See remarks for process state prerequisites.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue