mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-05 12:44:13 +00:00
maybe pywin32 GetCommandLine is not really GetCommandLineW
This commit is contained in:
parent
389d70a682
commit
33f84412b4
@ -12,14 +12,16 @@ def get_argv():
|
|||||||
information using Windows API calls and massages it into the right
|
information using Windows API calls and massages it into the right
|
||||||
shape.
|
shape.
|
||||||
"""
|
"""
|
||||||
# <https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156%28v=vs.85%29.aspx>
|
|
||||||
from win32ui import (
|
|
||||||
GetCommandLine,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ctypes import WINFUNCTYPE, WinError, windll, POINTER, byref, c_int, get_last_error
|
from ctypes import WINFUNCTYPE, WinError, windll, POINTER, byref, c_int, get_last_error
|
||||||
from ctypes.wintypes import LPWSTR, LPCWSTR
|
from ctypes.wintypes import LPWSTR, LPCWSTR
|
||||||
|
|
||||||
|
# <https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156%28v=vs.85%29.aspx>
|
||||||
|
GetCommandLineW = WINFUNCTYPE(
|
||||||
|
LPWSTR,
|
||||||
|
use_last_error=True
|
||||||
|
)(("GetCommandLineW", windll.kernel32))
|
||||||
|
|
||||||
# <https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspx>
|
# <https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspx>
|
||||||
CommandLineToArgvW = WINFUNCTYPE(
|
CommandLineToArgvW = WINFUNCTYPE(
|
||||||
POINTER(LPWSTR), LPCWSTR, POINTER(c_int),
|
POINTER(LPWSTR), LPCWSTR, POINTER(c_int),
|
||||||
@ -28,8 +30,8 @@ def get_argv():
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
command_line = GetCommandLine()
|
command_line = GetCommandLineW()
|
||||||
print("GetCommandLine() -> {!r}".format(command_line), file=sys.stderr)
|
print("GetCommandLineW() -> {!r}".format(command_line), file=sys.stderr)
|
||||||
argc = c_int(0)
|
argc = c_int(0)
|
||||||
argv_unicode = CommandLineToArgvW(command_line, byref(argc))
|
argv_unicode = CommandLineToArgvW(command_line, byref(argc))
|
||||||
if argv_unicode is None:
|
if argv_unicode is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user