66#define MyAppURL " https://vdd.mikethetech.com"
77#define InstallPath " C:\VirtualDisplayDriver"
88#define AppId " VirtualDisplayDriver"
9- #define RegKeyBase " SOFTWARE\MikeTheTech\VirtualDisplayDriver"
10- #define InstallerTempDir " {localappdata} \VDDInstaller"
119
1210[Setup]
1311//no network storage installs
@@ -50,10 +48,8 @@ DisableDirPage=yes
5048Name : " english" ; MessagesFile : " compiler:Default.isl"
5149
5250[Dirs]
53- ; These directories will be automatically created during installation
54- ; with the specified permissions
55- Name : " {app} " ; Permissions: everyone-full ; Flags : uninsalwaysuninstall
56- Name : " {app} \ControlApp" ; Permissions: everyone-full ; Flags : uninsalwaysuninstall
51+ Name : " {app} " ; Permissions: everyone-full
52+ Name : " {app} \ControlApp" ; Permissions: everyone-full
5753
5854[Files]
5955Source : " input\MttVDD.dll" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : VDD
@@ -67,9 +63,6 @@ Source: "dependencies\install.bat"; DestDir: "{app}"; Flags: ignoreversion
6763Source : " dependencies\uninstall.bat" ; DestDir : " {app} " ; Flags : ignoreversion
6864Source : " dependencies\fixxml.ps1" ; DestDir : " {app} " ; Flags : ignoreversion
6965Source : " input\ControlApp\VDDControl.exe" ; DestDir : " {app} \ControlApp" ; Components : ControlApp
70- ; Include PowerShell scripts
71- Source : " input\scripts\*.ps1" ; DestDir : " {app} \scripts" ; Flags : ignoreversion
72- Source : " input\scripts\onoff_at_loginout\*" ; DestDir : " {app} \scripts\onoff_at_loginout" ; Flags : ignoreversion
7366
7467[Types]
7568Name : " basic" ; Description : " Basic install with driver and control app (recommended)" ;
@@ -105,7 +98,7 @@ function IsAppAlreadyInstalled(): Boolean;
10598var
10699 InstalledBy: string;
107100begin
108- Result := RegQueryStringValue(HKEY_LOCAL_MACHINE, ' {#RegKeyBase} ' , ' InstalledBy' , InstalledBy);
101+ Result := RegQueryStringValue(HKEY_LOCAL_MACHINE, ' SOFTWARE\MikeTheTech\VirtualDisplayDriver ' , ' InstalledBy' , InstalledBy);
109102 if Result then
110103 Log(' App is already installed by: ' + InstalledBy)
111104 else
@@ -166,148 +159,55 @@ end;
166159
167160procedure EnsureFilesAndDirectoryExist ();
168161var
169- Src, Dest, TempDir: String;
170- FileCopyResult: Boolean;
162+ Src, Dest: String;
171163begin
172- // Extract necessary files to temp directory
173- try
174- ExtractTemporaryFile(' getlist.bat' );
175- except
176- Log(' Warning: Failed to extract getlist.bat to temporary directory' );
177- end ;
178-
179- try
180- ExtractTemporaryFile(' gpulist.txt' );
181- except
182- Log(' Warning: Failed to extract gpulist.txt to temporary directory' );
183- end ;
184-
185- // Create installer temp directory if it doesn't exist
186- TempDir := ExpandConstant(' {#InstallerTempDir}' );
187- if not DirExists(TempDir) then
188- begin
189- if not CreateDir(TempDir) then
190- begin
191- Log(' Error: Failed to create directory: ' + TempDir);
192- MsgBox(' Failed to create the required temporary directory. ' +
193- ' The installation may not complete successfully.' , mbError, MB_OK);
194- Exit;
195- end ;
196- end ;
197-
198- // Copy the getlist.bat file
164+ ExtractTemporaryFile(' getlist.bat' );
165+ ExtractTemporaryFile(' gpulist.txt' );
166+ if not DirExists(ExpandConstant(' {localappdata}\VDDInstaller' )) then
167+ CreateDir(ExpandConstant(' {localappdata}\VDDInstaller' ));
168+ Src := ExpandConstant(' {tmp}\lfn.exe' );
169+ Dest := ExpandConstant(' {localappdata}\VDDInstaller\lfn.exe' );
170+ if not FileExists(Dest) then
171+ FileCopy(Src, Dest, False);
199172 Src := ExpandConstant(' {tmp}\getlist.bat' );
200- Dest := TempDir + ' \getlist.bat' ;
201-
202- if FileExists(Src) then
203- begin
204- if not FileExists(Dest) then
205- begin
206- FileCopyResult := FileCopy(Src, Dest, True);
207- if not FileCopyResult then
208- Log(' Error: Failed to copy ' + Src + ' to ' + Dest);
209- end ;
210- end
211- else
212- Log(' Error: Source file not found: ' + Src);
213-
214- // Copy the gpulist.txt file
173+ Dest := ExpandConstant(' {localappdata}\VDDInstaller\getlist.bat' );
174+ if not FileExists(Dest) then
175+ FileCopy(Src, Dest, False);
215176 Src := ExpandConstant(' {tmp}\gpulist.txt' );
216- Dest := TempDir + ' \gpulist.txt' ;
217-
218- if FileExists(Src) then
219- begin
220- if not FileExists(Dest) then
221- begin
222- FileCopyResult := FileCopy(Src, Dest, True);
223- if not FileCopyResult then
224- Log(' Error: Failed to copy ' + Src + ' to ' + Dest);
225- end ;
226- end
227- else
228- Log(' Error: Source file not found: ' + Src);
177+ Dest := ExpandConstant(' {localappdata}\VDDInstaller\gpulist.txt' );
178+ if not FileExists(Dest) then
179+ FileCopy(Src, Dest, False);
229180end ;
230181
231182procedure RunGetListAndPopulateGPUComboBox ;
232183var
233184 I, ResultCode: Integer;
234- ListPath, GetListPath, TempDir : String;
185+ ListPath: String;
235186begin
236- // Add default option
237187 GPUComboBox.Items.Add(' Best GPU (Auto)' );
238188
239- // Ensure necessary files are available
240189 EnsureFilesAndDirectoryExist();
241-
242- // Use defined constant for temp directory
243- TempDir := ExpandConstant(' {#InstallerTempDir}' );
244- GetListPath := TempDir + ' \getlist.bat' ;
245- ListPath := TempDir + ' \gpulist.txt' ;
246-
247- // Verify getlist.bat exists
248- if not FileExists(GetListPath) then
190+ ListPath := ExpandConstant(' {localappdata}\VDDInstaller\gpulist.txt' );
191+ if not FileExists(ExpandConstant(' {localappdata}\VDDInstaller\getlist.bat' )) then
249192 begin
250- Log(' Error: getlist.bat not found at: ' + GetListPath);
251- MsgBox(' Error: GPU listing utility not found. You can still proceed with installation ' +
252- ' but GPU selection may not work properly.' , mbError, MB_OK);
253- GPUComboBox.ItemIndex := 0 ;
193+ MsgBox(' Error: getlist.bat not found.' , mbError, MB_OK);
254194 Exit;
255195 end ;
256-
257- // Execute getlist.bat to gather GPU information
258- Log(' Executing: ' + GetListPath);
259- if Exec(GetListPath, ' ' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode) then
196+ if Exec(ExpandConstant(' {localappdata}\VDDInstaller\getlist.bat' ), ' ' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode) then
260197 begin
261- Log(' getlist.bat executed with result code: ' + IntToStr(ResultCode));
262-
263- if ResultCode <> 0 then
264- begin
265- Log(' Warning: getlist.bat exited with non-zero code: ' + IntToStr(ResultCode));
266- end ;
267-
268- // Load GPU list if available
269198 if FileExists(ListPath) then
270199 begin
271200 GPUList := TStringList.Create;
272201 try
273- try
274- GPUList.LoadFromFile(ListPath);
275- Log(' Loaded ' + IntToStr(GPUList.Count) + ' GPUs from list' );
276-
277- for I := 0 to GPUList.Count - 1 do
278- begin
279- if Trim(GPUList[I]) <> ' ' then
280- begin
281- GPUComboBox.Items.Add(GPUList[I]);
282- Log(' Added GPU: ' + GPUList[I]);
283- end ;
284- end ;
285- except
286- begin
287- Log(' Error loading GPU list' );
288- MsgBox(' Error loading GPU list. Default GPU selection will be used.' , mbError, MB_OK);
289- end ;
290- end ;
202+ GPUList.LoadFromFile(ListPath);
203+ for I := 0 to GPUList.Count -1 do
204+ GPUComboBox.Items.Add(GPUList[I]);
291205 finally
292- GPUList.Free;
206+ GPUList.Free;
293207 end ;
294- end
295- else
296- begin
297- Log(' Warning: GPU list file not found at: ' + ListPath);
298- MsgBox(' Could not find the GPU list. Default GPU selection will be used.' , mbInformation, MB_OK);
299208 end ;
300- end
301- else
302- begin
303- Log(' Error: Failed to execute getlist.bat' );
304- MsgBox(' Failed to detect GPUs. Default GPU selection will be used.' , mbError, MB_OK);
305209 end ;
306-
307- // Ensure a default selection is made
308210 GPUComboBox.ItemIndex := 0 ;
309-
310- Log(' GPU initialization completed' );
311211end ;
312212
313213function NextButtonClick (CurPageID: Integer): Boolean;
@@ -361,24 +261,8 @@ begin
361261 Result := MonitorsEdit.Text;
362262end ;
363263
364- function GetInstallDate (Param: string): string;
365- begin
366- // Format as yyyy-mm-dd using GetDateTimeString
367- Result := GetDateTimeString(' yyyy-mm-dd' , ' -' , ' -' );
368- end ;
369-
370264function MergePar (Param: string): string;
371265begin
372- {
373- Properly quote parameters to handle paths with spaces.
374- The third parameter (%3 in install.bat) is the installation path.
375-
376- Jocke's fix in install.bat:
377- 1. For PowerShell: powershell script gets path with special quoting "\"%AppPath%\""
378- 2. For nefconw.exe: Driver installation uses special quoting "\"%AppPath%\MttVDD.inf\""
379-
380- Both approaches ensure paths with spaces work correctly.
381- }
382266 Result := Format(' %s "%s" "%s"' , [
383267 ExpandConstant(' {code:GetVDCount}' ),
384268 ExpandConstant(' {code:GetSelectedGPU}' ),
@@ -432,11 +316,9 @@ end;
432316
433317[Registry]
434318Root : HKLM; Subkey : " SOFTWARE\MikeTheTech" ; Flags : uninsdeletekeyifempty
435- Root : HKLM; Subkey : " {#RegKeyBase}" ; Flags : uninsdeletekeyifempty
436- Root : HKLM; Subkey : " {#RegKeyBase}" ; ValueType : string ; ValueName : " VDDPATH" ; ValueData : " {app} " ; Flags : uninsdeletevalue
437- Root : HKLM; Subkey : " {#RegKeyBase}" ; ValueType : string ; ValueName : " InstalledBy" ; ValueData : " Installer" ; Flags : uninsdeletevalue
438- Root : HKLM; Subkey : " {#RegKeyBase}" ; ValueType : string ; ValueName : " InstallDate" ; ValueData : " {code:GetInstallDate}" ; Flags : uninsdeletevalue
439- Root : HKLM; Subkey : " {#RegKeyBase}" ; ValueType : string ; ValueName : " Version" ; ValueData : " {#MyAppVersion}" ; Flags : uninsdeletevalue
319+ Root : HKLM; Subkey : " SOFTWARE\MikeTheTech\VirtualDisplayDriver" ; Flags : uninsdeletekeyifempty
320+ Root : HKLM; Subkey : " SOFTWARE\MikeTheTech\VirtualDisplayDriver" ; ValueType : string ; ValueName : " VDDPATH" ; ValueData : " {app} " ; Flags : uninsdeletevalue
321+ Root : HKLM; Subkey : " SOFTWARE\MikeTheTech\VirtualDisplayDriver" ; ValueType : string ; ValueName : " InstalledBy" ; ValueData : " Installer" ; Flags : uninsdeletevalue
440322
441323
442324[Run]
0 commit comments