From 33f84412b4462f16cdb4115d41e575ca2ecd6f7a Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 11 Jan 2021 10:19:17 -0500 Subject: [PATCH] maybe pywin32 GetCommandLine is not really GetCommandLineW --- src/allmydata/windows/fixups.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/allmydata/windows/fixups.py b/src/allmydata/windows/fixups.py index 8537e06b5..f91232457 100644 --- a/src/allmydata/windows/fixups.py +++ b/src/allmydata/windows/fixups.py @@ -12,14 +12,16 @@ def get_argv(): information using Windows API calls and massages it into the right shape. """ - # - from win32ui import ( - GetCommandLine, - ) from ctypes import WINFUNCTYPE, WinError, windll, POINTER, byref, c_int, get_last_error from ctypes.wintypes import LPWSTR, LPCWSTR + # + GetCommandLineW = WINFUNCTYPE( + LPWSTR, + use_last_error=True + )(("GetCommandLineW", windll.kernel32)) + # CommandLineToArgvW = WINFUNCTYPE( POINTER(LPWSTR), LPCWSTR, POINTER(c_int), @@ -28,8 +30,8 @@ def get_argv(): import sys - command_line = GetCommandLine() - print("GetCommandLine() -> {!r}".format(command_line), file=sys.stderr) + command_line = GetCommandLineW() + print("GetCommandLineW() -> {!r}".format(command_line), file=sys.stderr) argc = c_int(0) argv_unicode = CommandLineToArgvW(command_line, byref(argc)) if argv_unicode is None: