Evan's Blog
EvanZhu0721 / 公开仓库

SBMS

镜像已同步

SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.

上游 GitHub
READ-ONLY MIRROR

README、源码与 Release 已保存到本站;源码视图固定到 commit a37d6c4b。

main/ root / installer
a37d6c4b· 固定源码快照
installer/SBMS.iss6.2 KB
1#define AppName "SBMS"
2#ifndef AppVersion
3#define AppVersion "0.0.0-dev"
4#endif
5#ifndef OutputSuffix
6#define OutputSuffix ""
7#endif
8#define AppPublisher "SBMS"
9#define AppExeName "sbms-tray.exe"
10
11[Setup]
12AppId={{7EB4D7A8-16A9-4B6F-82E3-31A77BC81B6A}
13AppName={#AppName}
14AppVersion={#AppVersion}
15AppPublisher={#AppPublisher}
16DefaultDirName={autopf64}\SBMS
17DefaultGroupName=SBMS
18DisableProgramGroupPage=yes
19ArchitecturesAllowed=x64compatible
20ArchitecturesInstallIn64BitMode=x64compatible
21PrivilegesRequired=admin
22OutputDir=..\target\installer
23OutputBaseFilename=SBMS-Setup-{#AppVersion}-x64{#OutputSuffix}
24Compression=lzma2
25SolidCompression=yes
26WizardStyle=modern
27UninstallDisplayIcon={app}\{#AppExeName}
28CloseApplications=no
29RestartApplications=no
30ChangesEnvironment=no
31SetupLogging=yes
32#ifndef UnsignedBuild
33SignTool=sbmssign
34SignedUninstaller=yes
35#endif
36
37[Files]
38Source: "..\target\release\sbms.exe"; DestDir: "{app}"; Flags: ignoreversion
39Source: "..\target\release\sbms-tray.exe"; DestDir: "{app}"; Flags: ignoreversion
40Source: "..\target\driver\SBMSIndirectDisplay.inf"; DestDir: "{app}\driver"; Flags: ignoreversion
41Source: "..\target\driver\SBMSIndirectDisplay.dll"; DestDir: "{app}\driver"; Flags: ignoreversion
42Source: "..\target\driver\SBMSIndirectDisplay.cat"; DestDir: "{app}\driver"; Flags: ignoreversion
43Source: "maintenance.ps1"; DestDir: "{app}\installer"; Flags: ignoreversion
44Source: "manage-sunshine-instance.ps1"; DestDir: "{app}\installer"; Flags: ignoreversion
45Source: "..\NOTICE.md"; DestDir: "{app}\licenses"; Flags: ignoreversion
46Source: "..\LICENSE"; DestDir: "{app}\licenses"; DestName: "GPL-3.0.txt"; Flags: ignoreversion
47Source: "..\LICENSES\MS-PL.txt"; DestDir: "{app}\licenses"; Flags: ignoreversion
48Source: "..\LICENSES\Apache-2.0.txt"; DestDir: "{app}\licenses"; Flags: ignoreversion
49Source: "maintenance.ps1"; DestName: "sbms-maintenance.ps1"; Flags: dontcopy
50
51[InstallDelete]
52; User state under {localappdata}\SBMS is intentionally preserved during upgrades.
53Type: files; Name: "{app}\diagnose-sbms.ps1"
54Type: files; Name: "{app}\install-sbms-driver.ps1"
55Type: files; Name: "{app}\install-sbms-program-files.ps1"
56Type: files; Name: "{app}\README.md"
57Type: files; Name: "{app}\RELEASE_NOTES.md"
58Type: files; Name: "{app}\run-sbms-native.ps1"
59Type: files; Name: "{app}\SBMSDeviceHost.exe"
60Type: files; Name: "{app}\SBMSNative.exe"
61Type: files; Name: "{app}\SBMSSetup.exe"
62Type: files; Name: "{app}\driver\IddSampleDriver.cer"
63Type: filesandordirs; Name: "{app}\driver\IddSampleDriver"
64
65[UninstallDelete]
66; A deliberate uninstall removes configuration, display overrides, and diagnostics.
67Type: filesandordirs; Name: "{localappdata}\SBMS"
68Type: files; Name: "{app}\diagnose-sbms.ps1"
69Type: files; Name: "{app}\install-sbms-driver.ps1"
70Type: files; Name: "{app}\install-sbms-program-files.ps1"
71Type: files; Name: "{app}\README.md"
72Type: files; Name: "{app}\RELEASE_NOTES.md"
73Type: files; Name: "{app}\run-sbms-native.ps1"
74Type: files; Name: "{app}\SBMSDeviceHost.exe"
75Type: files; Name: "{app}\SBMSNative.exe"
76Type: files; Name: "{app}\SBMSSetup.exe"
77Type: files; Name: "{app}\driver\IddSampleDriver.cer"
78Type: filesandordirs; Name: "{app}\driver\IddSampleDriver"
79
80[Icons]
81Name: "{group}\SBMS"; Filename: "{app}\sbms-tray.exe"; Parameters: "--open"; WorkingDir: "{app}"
82Name: "{group}\Uninstall SBMS"; Filename: "{uninstallexe}"
83
84[Code]
85function PowerShellPath(): String;
86begin
87 Result := ExpandConstant('{sys}\WindowsPowerShell\v1.0\powershell.exe');
88end;
89
90function RunMaintenanceScript(
91 ScriptPath: String;
92 Action: String;
93 Root: String;
94 var ResultCode: Integer): Boolean;
95var
96 Parameters: String;
97begin
98 if not FileExists(ScriptPath) then
99 begin
100 ResultCode := 2;
101 Result := False;
102 exit;
103 end;
104 Parameters :=
105 '-NoLogo -NoProfile -NonInteractive -File "' + ScriptPath +
106 '" -Action "' + Action + '" -InstallRoot "' + Root + '"';
107 Result := Exec(
108 PowerShellPath(),
109 Parameters,
110 '',
111 SW_HIDE,
112 ewWaitUntilTerminated,
113 ResultCode);
114end;
115
116function RunMaintenance(Action: String; Root: String; var ResultCode: Integer): Boolean;
117begin
118 Result := RunMaintenanceScript(
119 AddBackslash(Root) + 'installer\maintenance.ps1',
120 Action,
121 Root,
122 ResultCode);
123end;
124
125function PrepareToInstall(var NeedsRestart: Boolean): String;
126var
127 ResultCode: Integer;
128 ScriptPath: String;
129begin
130 Result := '';
131 if DirExists(ExpandConstant('{app}')) then
132 begin
133 ExtractTemporaryFile('sbms-maintenance.ps1');
134 ScriptPath := ExpandConstant('{tmp}\sbms-maintenance.ps1');
135 if not RunMaintenanceScript(
136 ScriptPath,
137 'PrepareUpgrade',
138 ExpandConstant('{app}'),
139 ResultCode) then
140 Result := 'Could not start the SBMS upgrade preparation helper.'
141 else if ResultCode <> 0 then
142 Result := 'The existing SBMS session or configuration could not be preserved safely. Setup was cancelled.';
143 end;
144end;
145
146procedure CurStepChanged(CurStep: TSetupStep);
147var
148 ResultCode: Integer;
149begin
150 if CurStep = ssPostInstall then
151 begin
152 if not RunMaintenance('Install', ExpandConstant('{app}'), ResultCode) then
153 RaiseException('Could not start SBMS installation maintenance.')
154 else if ResultCode <> 0 then
155 RaiseException(Format('SBMS driver or startup registration failed (exit code %d).', [ResultCode]));
156 end;
157end;
158
159function InitializeUninstall(): Boolean;
160var
161 ResultCode: Integer;
162begin
163 Result := RunMaintenance('PreflightUninstall', ExpandConstant('{app}'), ResultCode);
164 if not Result then
165 MsgBox('Could not start SBMS uninstall preflight.', mbError, MB_OK)
166 else if ResultCode <> 0 then
167 begin
168 MsgBox(
169 Format('SBMS uninstall preflight failed (exit code %d). No uninstall changes were started.', [ResultCode]),
170 mbError,
171 MB_OK);
172 Result := False;
173 end;
174end;
175
176procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
177var
178 ResultCode: Integer;
179begin
180 if CurUninstallStep = usUninstall then
181 begin
182 if not RunMaintenance('Uninstall', ExpandConstant('{app}'), ResultCode) then
183 RaiseException('Could not start SBMS uninstall maintenance.')
184 else if ResultCode <> 0 then
185 RaiseException(
186 Format('SBMS external cleanup failed or was only partially compensated (exit code %d). Application files were retained.', [ResultCode]));
187 end;
188end;
189