Skip to content

Commit 4eb3832

Browse files
committed
Spore ModAPI Launcher: ensure injector DLL exists before injecting
1 parent a49f6e0 commit 4eb3832

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Spore ModAPI Launcher/Program.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,13 @@ void InjectSporeProcess(string dllEnding)
245245

246246
try
247247
{
248-
const string modApiDllInjector = "ModAPI.DLLInjector.dll";
249-
IntPtr hDLLInjectorHandle = Injector.InjectDLL(this.ProcessInfo, Path.Combine(this.LauncherKitPath, modApiDllInjector));
248+
string modApiDllInjectorPath = Path.Combine(this.LauncherKitPath, "ModAPI.DLLInjector.dll");
249+
if (!File.Exists(modApiDllInjectorPath))
250+
{
251+
throw new FileNotFoundException("Required injector DLL was not found: " + modApiDllInjectorPath);
252+
}
253+
254+
IntPtr hDLLInjectorHandle = Injector.InjectDLL(this.ProcessInfo, modApiDllInjectorPath);
250255

251256
string[] dlls = GetDLLsToInject(dllEnding);
252257

0 commit comments

Comments
 (0)