Skip to content

Commit

Permalink
fix uac bug
Browse files Browse the repository at this point in the history
Signed-off-by: ふぁ <yuki@yuki0311.com>
  • Loading branch information
fa0311 committed Jan 29, 2023
1 parent d15213f commit 1a7460d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions DMMGamePlayerFastLauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def run(
elif self.non_request_admin:
self.error_manager.error(error=ErrorManager.permission_error)
else:
args = [f'"{arg}"' for arg in args]
ctypes.windll.shell32.ShellExecuteW(
None, "runas", args[0], " ".join(args[1:]), None, 1
)
Expand Down
9 changes: 7 additions & 2 deletions Task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
for p in psutil.process_iter(attrs=("name", "pid", "cmdline")):
if p.info["name"] != "DMMGamePlayerFastLauncher.exe":
continue

cmdline = p.info["cmdline"]
if "--bypass-uac" in cmdline:
cmdline.remove("--bypass-uac")
if "--non-bypass-uac" not in cmdline:
cmdline.append("--non-bypass-uac")
cmdline = [f'"{cmd}"' for cmd in cmdline]
os.kill(p.info["pid"], signal.SIGTERM)
print("killed " + " ".join(cmdline))
ctypes.windll.shell32.ShellExecuteW(
None, "runas", cmdline[0], " ".join(cmdline[1:]), None, 1
)
break
else:
print("Error")

0 comments on commit 1a7460d

Please sign in to comment.