Skip to content

Commit

Permalink
Ability to rename the executable module (su.exe -> sudo.exe)
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor-mialyk committed May 29, 2023
1 parent 0f3b7bb commit 0704215
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .vscode/spellright.dict

This file was deleted.

2 changes: 1 addition & 1 deletion Sudo/RunAsSystem.pas
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ procedure RunAsSystem(const Command: string);
SI.wShowWindow := SW_HIDE;

if not CreateProcessWithTokenW(DuplicatedTokenHandle, 0, NULL,
PChar('"' + GetAppPath + SuApp + '" ' + GetSuCommandLine +
PChar('"' + ParamStr(0) + '" ' + GetSuCommandLine +
' ---- ' + ConsolePid + ' ' + Command), 0, NULL, Pointer(StartupDir), SI, PI) then
begin
ErrorCode := GetLastError();
Expand Down
5 changes: 1 addition & 4 deletions Sudo/Su.pas
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
System.SysUtils,
My.Lib;

const
SuApp = 'su.exe';

{$INCLUDE Common.g.pas}

{$SETPEFLAGS IMAGE_FILE_RELOCS_STRIPPED}
Expand Down Expand Up @@ -249,7 +246,7 @@ function GetSuCommandLine: string;
SEI.fMask := SEE_MASK_DOENVSUBST or SEE_MASK_FLAG_NO_UI or SEE_MASK_NOCLOSEPROCESS or
SEE_MASK_NOASYNC or SEE_MASK_NO_CONSOLE;
SEI.lpVerb := 'runas';
SEI.lpFile := PChar(GetAppPath + SuApp);
SEI.lpFile := Pointer(ParamStr(0));
SEI.lpParameters := PChar(CommandLine + ' ---- ' + IntToStr(GetCurrentProcessId()) + ' ' + Command);
SEI.nShow := SW_HIDE;

Expand Down

0 comments on commit 0704215

Please sign in to comment.