From 481602e64ecd5371c06dd50fed78374b988ee8f0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 4 Dec 2023 23:34:48 +0900 Subject: [PATCH] [win] Set argv[0] to module name This gives the usual argv[0] (program path). --- nq/source/sys_win.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nq/source/sys_win.c b/nq/source/sys_win.c index 176d8bdf9..4151b069c 100644 --- a/nq/source/sys_win.c +++ b/nq/source/sys_win.c @@ -116,8 +116,8 @@ SleepUntilInput (int time) HINSTANCE global_hInstance; int global_nCmdShow; +static char argv_0[65536]; const char *argv[MAX_NUM_ARGVS]; -static const char *empty_string = ""; HWND hwnd_dialog; static void @@ -172,7 +172,8 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, GlobalMemoryStatus (&lpBuffer); argc = 1; - argv[0] = empty_string; + argv[0] = argv_0; + GetModuleFileNameA (0, argv_0, sizeof(argv_0)); while (*lpCmdLine && (argc < MAX_NUM_ARGVS)) { while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))