mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
WIP corehook
This commit is contained in:
parent
3f78ca5b81
commit
69e7cf9af9
7 changed files with 69 additions and 9 deletions
|
|
@ -2,7 +2,8 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<nullable>enable</nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.7.82" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Pipes;
|
||||
using System.Text;
|
||||
using CoreHook.BinaryInjection;
|
||||
using CoreHook.BinaryInjection.RemoteInjection;
|
||||
using CoreHook.BinaryInjection.RemoteInjection.Configuration;
|
||||
using CoreHook.IPC.Platform;
|
||||
|
||||
namespace Dalamud.Injector
|
||||
{
|
||||
|
|
@ -18,9 +23,34 @@ namespace Dalamud.Injector
|
|||
//
|
||||
}
|
||||
|
||||
public void Relaunch(uint pid)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public void Inject(uint pid)
|
||||
{
|
||||
|
||||
var corehookConfig = new RemoteInjectorConfiguration
|
||||
{
|
||||
ClrBootstrapLibrary = "",
|
||||
ClrRootPath = "",
|
||||
DetourLibrary = "",
|
||||
HostLibrary = "",
|
||||
InjectionPipeName = "",
|
||||
PayloadLibrary = "",
|
||||
VerboseLog = false,
|
||||
};
|
||||
|
||||
RemoteInjector.Inject(pid, corehookConfig, );
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class PipePlatform : IPipePlatform
|
||||
{
|
||||
public NamedPipeServerStream CreatePipeByName(string pipeName, string serverName = ".")
|
||||
{
|
||||
return new NamedPipeServerStream(pipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 0x10000, 0x10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Dalamud.Injector
|
||||
|
|
@ -14,11 +14,11 @@ namespace Dalamud.Injector
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string RootDirectory { get; set; }
|
||||
public string RootDirectory { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string BinaryDirectory { get; set; }
|
||||
public string BinaryDirectory { get; set; } = "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
Dalamud.Injector/Exceptions.cs
Normal file
28
Dalamud.Injector/Exceptions.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Dalamud.Injector
|
||||
{
|
||||
public class DalamudException : Exception
|
||||
{
|
||||
public DalamudException() : base() { }
|
||||
|
||||
public DalamudException(string message) : base(message) { }
|
||||
|
||||
public DalamudException(string message, Exception inner) : base(message, inner) { }
|
||||
}
|
||||
|
||||
public partial class DalamudProcessException : DalamudException
|
||||
{
|
||||
public uint ProcessId { get; }
|
||||
}
|
||||
|
||||
public partial class DalamudProcessException
|
||||
{
|
||||
public DalamudProcessException(uint pid, string message) : base(message)
|
||||
{
|
||||
ProcessId = pid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -6,5 +6,6 @@ namespace Dalamud.Injector.FFI
|
|||
{
|
||||
internal static class Win32
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ namespace Dalamud.Injector
|
|||
public uint Pid { get; set; }
|
||||
|
||||
[Option("root", Required = true, HelpText = "")]
|
||||
public string RootDirectory { get; set; }
|
||||
public string RootDirectory { get; set; } = null!;
|
||||
|
||||
[Option("bin", Required = true, HelpText = "")]
|
||||
public string BinaryDirectory { get; set; }
|
||||
public string BinaryDirectory { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ namespace Dalamud.Injector
|
|||
Parser.Default.ParseArguments<InjectOptions>(args)
|
||||
.WithParsed<InjectOptions>(opt =>
|
||||
{
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue