summaryrefslogtreecommitdiffstats
path: root/osdep/win32-console-wrapper.c
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2023-12-23 18:46:54 +0100
committersfan5 <sfan5@live.de>2023-12-27 22:55:56 +0100
commit9565675488c51133e85627e5e610bf631eca6289 (patch)
tree8b8df1dab6b396097916d5115e8047241a0be910 /osdep/win32-console-wrapper.c
parentf57ec94d9f176184414ad8ef916a0b657c1b22ec (diff)
downloadmpv-9565675488c51133e85627e5e610bf631eca6289.tar.bz2
mpv-9565675488c51133e85627e5e610bf631eca6289.tar.xz
various: use correct PATH_MAX for win32
In commit c09245cdf2491211f3e0bfe47f28cc0e0a2e05c8 long-path support was enabled for mpv without actually making sure that there was no code left that used the old limit (260 Unicode chars) for buffer sizes. This commit fixes all but one case.
Diffstat (limited to 'osdep/win32-console-wrapper.c')
-rw-r--r--osdep/win32-console-wrapper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/osdep/win32-console-wrapper.c b/osdep/win32-console-wrapper.c
index 4e74daca47..787abafb23 100644
--- a/osdep/win32-console-wrapper.c
+++ b/osdep/win32-console-wrapper.c
@@ -19,6 +19,9 @@
#include <stdio.h>
#include <windows.h>
+// copied from osdep/io.h since this file is standalone
+#define MP_PATH_MAX (32000)
+
int wmain(int argc, wchar_t **argv, wchar_t **envp);
static void cr_perror(const wchar_t *prefix)
@@ -75,10 +78,11 @@ static int cr_runproc(wchar_t *name, wchar_t *cmdline)
int wmain(int argc, wchar_t **argv, wchar_t **envp)
{
wchar_t *cmd;
- wchar_t exe[MAX_PATH];
+ wchar_t *exe;
cmd = GetCommandLineW();
- GetModuleFileNameW(NULL, exe, MAX_PATH);
+ exe = LocalAlloc(LPTR, MP_PATH_MAX * sizeof(wchar_t));
+ GetModuleFileNameW(NULL, exe, MP_PATH_MAX);
wcscpy(wcsrchr(exe, '.') + 1, L"exe");
// Set an environment variable so the child process can tell whether it