galaxy brain

This commit is contained in:
Mino 2020-03-04 01:01:03 +09:00
parent 2a82a16301
commit f8a44f9135
3 changed files with 10 additions and 7 deletions

View file

@ -10,7 +10,6 @@
<PackageReference Include="CommandLineParser" Version="2.7.82" /> <PackageReference Include="CommandLineParser" Version="2.7.82" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Dalamud\Dalamud.csproj" />
<ProjectReference Include="..\lib\CoreHook\src\CoreHook.BinaryInjection\CoreHook.BinaryInjection.csproj" /> <ProjectReference Include="..\lib\CoreHook\src\CoreHook.BinaryInjection\CoreHook.BinaryInjection.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -1,6 +1,6 @@
using System; using System;
using CommandLine; using CommandLine;
using Dalamud.Injector.Windows;
namespace Dalamud.Injector namespace Dalamud.Injector
{ {
@ -8,11 +8,13 @@ namespace Dalamud.Injector
{ {
private static void Main(string[] args) private static void Main(string[] args)
{ {
Parser.Default.ParseArguments<InjectOptions>(args) var shit = Process.Open(12732);
var cmd = shit.ReadCommandLine();
/*Parser.Default.ParseArguments<InjectOptions>(args)
.WithParsed<InjectOptions>(opt => .WithParsed<InjectOptions>(opt =>
{ {
}); });*/
} }
} }
} }

View file

@ -43,7 +43,7 @@ namespace Dalamud.Injector.Windows
PROCESS_ACCESS_RIGHT.PROCESS_TERMINATE; PROCESS_ACCESS_RIGHT.PROCESS_TERMINATE;
var handle = Win32.OpenProcess((uint) access, false, pid); var handle = Win32.OpenProcess((uint) access, false, pid);
if (!handle.IsInvalid) if (handle.IsInvalid)
{ {
throw new Win32Exception(); throw new Win32Exception();
} }
@ -64,7 +64,7 @@ namespace Dalamud.Injector.Windows
throw new Win32Exception(); throw new Win32Exception();
} }
return (uint)bytesRead; return (int)bytesRead;
} }
} }
} }
@ -144,7 +144,9 @@ namespace Dalamud.Injector.Windows
unsafe unsafe
{ {
var pPeb = ReadPebAddress(); var pPeb = ReadPebAddress();
var pPebLdr = pPeb + (int)Marshal.OffsetOf<PEB>("ProcessParameters");
var pPebProc = ReadMemoryExact(pPeb + (int)Marshal.OffsetOf<PEB>("ProcessParameters");
var
Span<byte> procParamBuf = stackalloc byte[sizeof(RTL_USER_PROCESS_PARAMETERS)]; Span<byte> procParamBuf = stackalloc byte[sizeof(RTL_USER_PROCESS_PARAMETERS)];
ReadMemoryExact(pPebLdr, procParamBuf); ReadMemoryExact(pPebLdr, procParamBuf);