-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSudoAPI-Inno.iss
73 lines (68 loc) · 2.35 KB
/
NSudoAPI-Inno.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#define MyAppName "NSudoAPI-Inno"
#define MyAppVersion "1.0"
#define MyAppPublisher "© Wilenty"
#define MyAppURL "https://wilenty.wixsite.com/SoftwareByWilenty/inno-setup-xp-ee-script-studio-port"
#define MyAppExeName "MyProg.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{D4B4FD6A-4B66-4CEE-B734-19DB56838C5F}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppCopyright={#MyAppPublisher}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultGroupName={#MyAppName}
OutputBaseFilename={#MyAppName} {#MyAppVersion}
CreateAppDir=False
Uninstallable=no
DisableFinishedPage=True
PrivilegesRequired=lowest
#include "NSudoAPI.isi"
[code]
Function InitializeSetup(): Boolean;
var
Params: String;
Int: Integer;
begin
Result := True;
EnableFsRedirection(False);
if IsAdminLoggedOn then
begin
For Int := 0 to ParamCount do
Params := Params + '"' + ParamStr(Int) + '" ';
If NSudoCreateProcess(UM_SYSTEM, PM_DEFAULT, ML_MEDIUM_PLUS, PPC_NORMAL, SWM_DEFAULT, -1, True, Params, GetTempDir) = 0 then
Result := False;
end
else
begin
MsgBox('Please right click on me, then: run as Administrator!'#13#10#9#9'Bye, bye...', mbError, MB_OK);
Result := False;
end;
end;
Function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
Var
RegKeys: TArrayOfString;
Int: Integer;
begin
If RegGetSubkeyNames(HKLM, 'SAM\SAM\Domains\Builtin\Aliases\Names', RegKeys) then
begin
Result := 'Reg keys of HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Builtin\Aliases\Names:' + NewLine;
For Int := 0 To GetArrayLength(RegKeys)-1 do
Result := Result + RegKeys[Int] + NewLine;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
var
ErrorCode: Integer;
begin
If CurPageID = wpReady then
begin
WizardForm.Show;
Exec(ExpandConstant('{cmd}'), '/c whoami /user&pause', GetTempDir, SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
end;
end;