WIP corehook

This commit is contained in:
Mino 2020-02-27 12:10:07 +09:00
parent 3f78ca5b81
commit 69e7cf9af9
7 changed files with 69 additions and 9 deletions

View file

@ -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" />

View file

@ -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);
}
}
}

View file

@ -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; } = "";
}
}

View 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;
}
}
}

View file

@ -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
{
}
}

View file

@ -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!;
}
}

View file

@ -10,7 +10,7 @@ namespace Dalamud.Injector
Parser.Default.ParseArguments<InjectOptions>(args)
.WithParsed<InjectOptions>(opt =>
{
});
}
}