diff --git a/olm.iss b/olm.iss new file mode 100644 index 0000000..c2717b4 --- /dev/null +++ b/olm.iss @@ -0,0 +1,88 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "olm" +#define MyAppVersion "1.0.0" +#define MyAppPublisher "Fossorial Inc." +#define MyAppURL "https://fossorial.io" +#define MyAppExeName "olm.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={{44A24E4C-B616-476F-ADE7-8D56B930959E} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +DefaultDirName={autopf}\{#MyAppName} +UninstallDisplayIcon={app}\{#MyAppExeName} +; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run +; on anything but x64 and Windows 11 on Arm. +ArchitecturesAllowed=x64compatible +; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the +; install be done in "64-bit mode" on x64 or Windows 11 on Arm, +; meaning it should use the native 64-bit Program Files directory and +; the 64-bit view of the registry. +ArchitecturesInstallIn64BitMode=x64compatible +DefaultGroupName={#MyAppName} +DisableProgramGroupPage=yes +; Uncomment the following line to run in non administrative install mode (install for current user only). +;PrivilegesRequired=lowest +OutputBaseFilename=mysetup +SolidCompression=yes +WizardStyle=modern +; Add this to ensure PATH changes are applied and the system is prompted for a restart if needed +RestartIfNeededByRun=no +ChangesEnvironment=true + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Files] +; The 'DestName' flag ensures that 'olm_windows_amd64.exe' is installed as 'olm.exe' +Source: "C:\Users\Administrator\Downloads\olm_windows_amd64.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}"; Flags: ignoreversion +Source: "C:\Users\Administrator\Downloads\wintun.dll"; DestDir: "{app}"; Flags: ignoreversion +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" + +[Registry] +; Add the application's installation directory to the system PATH environment variable. +; HKLM (HKEY_LOCAL_MACHINE) is used for system-wide changes. +; The 'Path' variable is located under 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'. +; ValueType: expandsz allows for environment variables (like %ProgramFiles%) in the path. +; ValueData: "{olddata};{app}" appends the current application directory to the existing PATH. +; Flags: uninsdeletevalue ensures the entry is removed upon uninstallation. +; Check: IsWin64 ensures this is applied on 64-bit systems, which matches ArchitecturesAllowed. +[Registry] +; Add the application's installation directory to the system PATH. +Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ + ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; \ + Flags: uninsdeletevalue; Check: NeedsAddPath(ExpandConstant('{app}')) + +[Code] +function NeedsAddPath(Path: string): boolean; +var + OrigPath: string; +begin + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, + 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', + 'Path', OrigPath) + then begin + // Path variable doesn't exist at all, so we definitely need to add it. + Result := True; + exit; + end; + + // Perform a case-insensitive check to see if the path is already present. + // We add semicolons to prevent partial matches (e.g., matching C:\App in C:\App2). + if Pos(';' + UpperCase(Path) + ';', ';' + UpperCase(OrigPath) + ';') > 0 then + Result := False + else + Result := True; +end; \ No newline at end of file