From 52f1450245efae1e62d37b8976fae0ef1511fa63 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 24 Feb 2023 19:17:22 +0100 Subject: [PATCH] fix: correct paths to nethost.dll --- src/Inject/NosSmooth.Injector/NosInjector.cs | 14 +++++++++++--- .../NosSmooth.Injector/NosSmooth.Injector.csproj | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Inject/NosSmooth.Injector/NosInjector.cs b/src/Inject/NosSmooth.Injector/NosInjector.cs index f01d8b3..c6e8e8c 100644 --- a/src/Inject/NosSmooth.Injector/NosInjector.cs +++ b/src/Inject/NosSmooth.Injector/NosInjector.cs @@ -67,7 +67,14 @@ public class NosInjector ) { using var process = Process.GetProcessById(processId); - return Inject(process, dllPath, classPath, methodName, data); + return Inject + ( + process, + dllPath, + classPath, + methodName, + data + ); } /// @@ -113,8 +120,8 @@ public class NosInjector var netHostInjectionResult = InjectNetHostDll ( injector, - Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), - System.IO.Path.GetDirectoryName(dllPath), + Path.GetFullPath("."), + System.IO.Path.GetDirectoryName(Path.GetFullPath(dllPath)), System.IO.Path.GetDirectoryName(process.MainModule?.FileName) ); @@ -204,6 +211,7 @@ public class NosInjector private Result InjectNetHostDll(Reloaded.Injector.Injector injector, params string?[] pathsToSearch) { string? foundPath = pathsToSearch + .Where(x => !string.IsNullOrEmpty(x)) .Select(x => Path.Join(x, "nethost.dll")) .Select(Path.GetFullPath) .FirstOrDefault(File.Exists); diff --git a/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj b/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj index 32228fa..84d9b0f 100644 --- a/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj +++ b/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj @@ -5,7 +5,7 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb;.dll enable enable - 2.0.0 + 2.0.1 Inject with possibility to return an integer and pass in arbitrary arguments. -- 2.48.1