|
| 1 | + |
| 2 | + |
| 3 | +#define Version "1.0" |
| 4 | +#define AppName ".NET Assembly Info" |
| 5 | + |
| 6 | + |
| 7 | +[Setup] |
| 8 | +AppName={#AppName} |
| 9 | +AppID={#AppName} |
| 10 | +AppVerName={#AppName} {#Version} |
| 11 | +SetupMutex={#AppName} {#Version} |
| 12 | +AppVersion={#Version} |
| 13 | +VersionInfoVersion={#Version} |
| 14 | +AppCopyright=© ElektroStudios 2018 |
| 15 | +AppPublisher=ElektroStudios |
| 16 | +DefaultDirName={pf}\ElektroStudios\{#AppName} |
| 17 | +DefaultGroupName={#AppName} |
| 18 | +UninstallDisplayIcon={app}\uninstall.ico |
| 19 | +OutputBaseFilename=NET Assembly Info |
| 20 | +Compression=lzma/ultra64 |
| 21 | +InternalCompressLevel=ultra64 |
| 22 | +SolidCompression=true |
| 23 | +AlwaysShowComponentsList=False |
| 24 | +DisableWelcomePage=False |
| 25 | +DisableDirPage=True |
| 26 | +DisableProgramGroupPage=True |
| 27 | +DisableReadyPage=True |
| 28 | +DisableStartupPrompt=True |
| 29 | +FlatComponentsList=False |
| 30 | +LanguageDetectionMethod=None |
| 31 | +RestartIfNeededByRun=False |
| 32 | +ShowLanguageDialog=NO |
| 33 | +ShowTasksTreeLines=True |
| 34 | +SetupIconFile=Icon.ico |
| 35 | +WizardImageFile=embedded\WizardImage.bmp |
| 36 | +WizardSmallImageFile=embedded\WizardSmallImage.bmp |
| 37 | +InfoBeforeFile=embedded\InfoBefore.rtf |
| 38 | +Uninstallable=True |
| 39 | +ArchitecturesAllowed=x86 x64 |
| 40 | +ArchitecturesInstallIn64BitMode=x64 |
| 41 | + |
| 42 | +[Files] |
| 43 | +; VCL Styles |
| 44 | +Source: {cf}\Inno Setup\*; DestDir: {cf}\Inno Setup; Attribs: readonly system; Flags: uninsneveruninstall overwritereadonly onlyifdoesntexist |
| 45 | + |
| 46 | +; Temp files |
| 47 | +Source: {tmp}\*; DestDir: {tmp}; Flags: recursesubdirs createallsubdirs ignoreversion |
| 48 | + |
| 49 | +; Program |
| 50 | +Source: {app}\*; DestDir: {app}; Flags: recursesubdirs createallsubdirs ignoreversion |
| 51 | + |
| 52 | +[Run] |
| 53 | +Filename: {app}\ServerRegistrationManager.exe; Parameters: "uninstall ""{app}\AssemblyInfo.dll"""; WorkingDir: {app}; StatusMsg: Unregistering the shell-extension...; Flags: runhidden runascurrentuser waituntilterminated |
| 54 | +Filename: {app}\ServerRegistrationManager.exe; Parameters: "install ""{app}\AssemblyInfo.dll"" -codebase"; WorkingDir: {app}; StatusMsg: Registering the shell-extension...; Flags: runhidden runascurrentuser waituntilterminated |
| 55 | + |
| 56 | +[UninstallRun] |
| 57 | +Filename: {app}\ServerRegistrationManager.exe; Parameters: "uninstall ""{app}\AssemblyInfo.dll"""; WorkingDir: {app}; StatusMsg: Unregistering the shell-extension...; Flags: runhidden runascurrentuser waituntilterminated |
| 58 | + |
| 59 | +[Code] |
| 60 | +
|
| 61 | +// ************************ |
| 62 | +// Uninstallation Variables |
| 63 | +// ************************ |
| 64 | +
|
| 65 | +Var |
| 66 | + UninstallSuccess : Boolean; // Determines whether the uninstallation succeeded. |
| 67 | +
|
| 68 | +
|
| 69 | +// ******* |
| 70 | +// Imports |
| 71 | +// ******* |
| 72 | +
|
| 73 | +// Load VCL Style |
| 74 | +procedure LoadVCLStyle(VClStyleFile: String); external 'LoadVCLStyleA@files:VclStylesinno.dll stdcall setuponly'; |
| 75 | +procedure LoadVCLStyle_UnInstall(VClStyleFile: String); external 'LoadVCLStyleA@{app}\Uninstall.dll stdcall uninstallonly delayload'; |
| 76 | +
|
| 77 | +// Unload VCL Style |
| 78 | +procedure UnLoadVCLStyles; external 'UnLoadVCLStyles@files:VclStylesinno.dll stdcall setuponly'; |
| 79 | +procedure UnLoadVCLStyles_UnInstall; external 'UnLoadVCLStyles@{app}\Uninstall.dll stdcall uninstallonly delayload'; |
| 80 | +
|
| 81 | +// Create Symbolic Link |
| 82 | +function CreateSymbolicLink(lpSymlinkFileName, lpTargetFileName: string; dwFlags: Integer): Boolean; external '[email protected] stdcall setuponly'; |
| 83 | +
|
| 84 | +
|
| 85 | +// ******* |
| 86 | +// Methods |
| 87 | +// ******* |
| 88 | +
|
| 89 | +// Deletes the VCL style files from {app} after uninstall. |
| 90 | +procedure DeleteVclFiles(); |
| 91 | +begin |
| 92 | +
|
| 93 | + If FileExists(ExpandConstant('{app}\uninstall.vsf')) then begin |
| 94 | + DeleteFile(ExpandConstant('{app}\uninstall.vsf')); |
| 95 | + end; |
| 96 | +
|
| 97 | + If FileExists(ExpandConstant('{app}\uninstall.dll')) then begin |
| 98 | + DeleteFile(ExpandConstant('{app}\uninstall.dll')); |
| 99 | + end; |
| 100 | +
|
| 101 | + // Safe remove {app} dir. It does not remove the folder if it has files or subdirs. |
| 102 | + If DirExists(ExpandConstant('{app}')) then begin |
| 103 | + DelTree(ExpandConstant('{app}\'), true, false, false); |
| 104 | + end; |
| 105 | +
|
| 106 | +end; |
| 107 | +
|
| 108 | +// **************** |
| 109 | +// Installer Events |
| 110 | +// **************** |
| 111 | +
|
| 112 | +// E: Occurs when the installer initializes. |
| 113 | +// ----------------------------------------- |
| 114 | +function InitializeSetup(): Boolean; |
| 115 | +begin |
| 116 | +
|
| 117 | + // Initialize the VCL skin style. |
| 118 | + ExtractTemporaryFile('Carbon.vsf'); |
| 119 | + LoadVCLStyle(ExpandConstant('{tmp}\Carbon.vsf')); |
| 120 | +
|
| 121 | + Result := True; |
| 122 | +
|
| 123 | +end; |
| 124 | +
|
| 125 | +// E: Occurs when the installer deinitializes. |
| 126 | +// ------------------------------------------- |
| 127 | +procedure DeinitializeSetup(); |
| 128 | +begin |
| 129 | +
|
| 130 | + // Deinitialize the VCL skin style. |
| 131 | + UnLoadVCLStyles; |
| 132 | +
|
| 133 | +end; |
| 134 | +
|
| 135 | +// E: Occurs when the installer page is at PostInstall. |
| 136 | +// ---------------------------------------------------- |
| 137 | +procedure CurStepChanged(CurStep: TSetupStep); |
| 138 | +begin |
| 139 | +
|
| 140 | + if CurStep = ssPostInstall then begin |
| 141 | + CreateSymbolicLink(ExpandConstant('{app}\Uninstall.vsf'), ExpandConstant('{cf}\Inno Setup\Carbon.vsf'), 0) |
| 142 | + CreateSymbolicLink(ExpandConstant('{app}\Uninstall.dll'), ExpandConstant('{cf}\Inno Setup\VclStylesinno.dll'), 0) |
| 143 | + end; |
| 144 | +
|
| 145 | +end; |
| 146 | +
|
| 147 | +// ****************** |
| 148 | +// Uninstaller Events |
| 149 | +// ****************** |
| 150 | +
|
| 151 | +// E: Occurs when the uninstaller current page changes. |
| 152 | +// ---------------------------------------------------- |
| 153 | +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); |
| 154 | +begin |
| 155 | +
|
| 156 | + if CurUninstallStep = usDone then begin |
| 157 | + UninstallSuccess:= True; |
| 158 | + end; |
| 159 | +
|
| 160 | +end; |
| 161 | +
|
| 162 | +
|
| 163 | +// E: Occurs when the uninstaller initializes. |
| 164 | +// ------------------------------------------- |
| 165 | +function InitializeUninstall: Boolean; |
| 166 | +begin |
| 167 | +
|
| 168 | + Result := True; |
| 169 | +
|
| 170 | + // Initialize the VCL skin style. |
| 171 | + If FileExists(ExpandConstant('{app}\Uninstall.vsf')) then begin |
| 172 | + LoadVCLStyle_UnInstall(ExpandConstant('{app}\Uninstall.vsf')); |
| 173 | + end; |
| 174 | +
|
| 175 | +end; |
| 176 | +
|
| 177 | +// E: Occurs when the uninstaller deinitializes. |
| 178 | +// --------------------------------------------- |
| 179 | +procedure DeinitializeUninstall(); |
| 180 | +begin |
| 181 | +
|
| 182 | + // Deinitialize the VCL skin style. |
| 183 | + If FileExists(ExpandConstant('{app}\uninstall.dll')) then begin |
| 184 | + UnLoadVCLStyles_UnInstall; |
| 185 | + UnloadDll(ExpandConstant('{app}\uninstall.dll')); |
| 186 | + end; |
| 187 | +
|
| 188 | + if UninstallSuccess then begin |
| 189 | + DeleteVclFiles; |
| 190 | + end; |
| 191 | +
|
| 192 | +end; |
0 commit comments