Skip to content

Commit

Permalink
cleanup/fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Aug 4, 2024
1 parent b98702c commit 57463b5
Show file tree
Hide file tree
Showing 7 changed files with 532 additions and 169 deletions.
2 changes: 1 addition & 1 deletion Libraries/Utility/src/utility/system/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def terminate_main_process(

RobustRootLogger().warning("Child processes and/or threads did not terminate, killing main process %s as a fallback.", actual_self_pid)
if sys.platform == "win32":
from utility.system.process import win_get_system32_dir
from utility.system.os_helper import win_get_system32_dir
sys32path = win_get_system32_dir()
subprocess.run(
[str(sys32path / "taskkill.exe"), "/F", "/T", "/PID", str(actual_self_pid)], # noqa: S603
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def HandleCOMCall(action_desc: str = "Unspecified COM function") -> Generator[Ca
future_error_msg = f"An error has occurred in win32 COM function '{action_desc}'"
try:
# Yield back a callable function that will raise if hr is nonzero.
yield lambda hr: HRESULT(hr).raise_for_status(hr, future_error_msg)
yield lambda hr: HRESULT(hr).raise_for_status(hr, future_error_msg) and hr or hr
except (COMError, OSError) as e:
errcode = getattr(e, "winerror", getattr(e, "hresult", None))
if errcode is None:
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Utility/src/utility/system/win32/com/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ class IFileDialog(IModalWindow):
_methods_: ClassVar[list[_ComMemberSpec]] = [
COMMETHOD([], HRESULT, "SetFileTypes",
(["in"], c_uint, "cFileTypes"),
(["in"], c_void_p, "rgFilterSpec")),
(["in"], POINTER(c_void_p), "rgFilterSpec")),
COMMETHOD([], HRESULT, "SetFileTypeIndex",
(["in"], c_uint, "iFileType")),
COMMETHOD([], HRESULT, "GetFileTypeIndex",
Expand Down Expand Up @@ -779,7 +779,7 @@ class IFileDialog(IModalWindow):
AddRef: Callable[[], ULONG]
Release: Callable[[], ULONG]
Show: Callable[[int | HWND], HRESULT]
SetFileTypes: Callable[[c_uint | int, c_void_p], HRESULT]
SetFileTypes: Callable[[c_uint | int, _Pointer[c_void_p]], HRESULT]
SetFileTypeIndex: Callable[[c_uint], HRESULT]
GetFileTypeIndex: Callable[[], _Pointer[c_uint]]
Advise: Callable[[IUnknown | comtypes.COMObject], int]
Expand Down
Loading

0 comments on commit 57463b5

Please sign in to comment.