mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
...
This commit is contained in:
parent
bd4f1da8c8
commit
9e38de84e6
@ -310,8 +310,23 @@ try:
|
|||||||
except:
|
except:
|
||||||
_QueryFullProcessImageNameW = 0
|
_QueryFullProcessImageNameW = 0
|
||||||
|
|
||||||
|
_GetLongPathName = _kernel32.GetLongPathNameW
|
||||||
|
_GetLongPathName.argtypes = (LPCWSTR, LPWSTR, DWORD)
|
||||||
|
_GetLongPathName.restype = DWORD
|
||||||
|
MAX_PATH = 260
|
||||||
|
|
||||||
def GetProcessFileName(hHandle):
|
|
||||||
|
def GetLongPathName(file):
|
||||||
|
succ = _GetLongPathName(file, None, 0)
|
||||||
|
if succ == 0:
|
||||||
|
return file
|
||||||
|
buff = create_unicode_buffer(succ)
|
||||||
|
succ = _GetLongPathName(file, buff, succ)
|
||||||
|
path = buff.value
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def _GetProcessFileName(hHandle):
|
||||||
w = create_unicode_buffer(65535)
|
w = create_unicode_buffer(65535)
|
||||||
# 我佛了,太混乱了,不同权限获取的东西完全不一样
|
# 我佛了,太混乱了,不同权限获取的东西完全不一样
|
||||||
if (
|
if (
|
||||||
@ -351,6 +366,14 @@ def GetProcessFileName(hHandle):
|
|||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
||||||
|
def GetProcessFileName(hHandle):
|
||||||
|
p = _GetProcessFileName(hHandle)
|
||||||
|
if p:
|
||||||
|
# GetModuleFileNameExW有可能莫名其妙得到短路径,导致部分路径无法匹配
|
||||||
|
p = GetLongPathName(p)
|
||||||
|
return p
|
||||||
|
|
||||||
|
|
||||||
_CreateProcessW = _kernel32.CreateProcessW
|
_CreateProcessW = _kernel32.CreateProcessW
|
||||||
_CreateProcessW.argtypes = (
|
_CreateProcessW.argtypes = (
|
||||||
c_wchar_p,
|
c_wchar_p,
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 38)
|
set(VERSION_MINOR 38)
|
||||||
set(VERSION_PATCH 8)
|
set(VERSION_PATCH 9)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user