From 7f2dc196490e71ada41e32a37a4c25d9c8115742 Mon Sep 17 00:00:00 2001 From: tdk Date: Fri, 22 Aug 2014 14:53:56 +0100 Subject: [PATCH] various text and icon changes for rebranding fix bug installing drivers on win 7 --- src/PC/gui/main/FreeOTFEfrmMain.dfm | 26 +- src/PC/gui/main/FreeOTFEfrmMain.pas | 379 ++++++++++++++++++---------- 2 files changed, 257 insertions(+), 148 deletions(-) diff --git a/src/PC/gui/main/FreeOTFEfrmMain.dfm b/src/PC/gui/main/FreeOTFEfrmMain.dfm index ba988fd..49c3189 100644 --- a/src/PC/gui/main/FreeOTFEfrmMain.dfm +++ b/src/PC/gui/main/FreeOTFEfrmMain.dfm @@ -3,7 +3,6 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain OnClose = FormClose OnCloseQuery = FormCloseQuery OnResize = FormResize - ExplicitWidth = 316 ExplicitHeight = 372 PixelsPerInch = 96 TextHeight = 13 @@ -14,7 +13,6 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain inherited StatusBar_Status: TStatusBar Top = 256 ExplicitTop = 256 - ExplicitWidth = 300 end object ToolBar1: TToolBar [2] Left = 0 @@ -108,7 +106,6 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain inherited StatusBar_Hint: TStatusBar Top = 237 ExplicitTop = 237 - ExplicitWidth = 300 end inherited mmMain: TMainMenu inherited File1: TMenuItem @@ -172,7 +169,10 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain Caption = 'Install DoxBox Drivers' end object SetTestMode1: TMenuItem - Action = actTestMode + Action = actTestModeOn + end + object DisallowTestsigneddrivers1: TMenuItem + Action = actTestModeOff end end end @@ -246,9 +246,13 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain Hint = 'Hide console' OnExecute = actConsoleHideExecute end - object actTestMode: TAction + object actTestModeOff: TAction + Caption = 'Disallow Test-signed drivers' + OnExecute = actTestModeOffExecute + end + object actTestModeOn: TAction Caption = 'Allow Test-signed drivers' - OnExecute = actTestModeExecute + OnExecute = actTestModeOnExecute end object actInstall: TAction Caption = 'Install DoxBox' @@ -257,7 +261,7 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain end inherited ilToolbarIcons_Small: TImageList Bitmap = { - 494C010111001300580010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C010111001300780010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000400000005000000001002000000000000050 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -926,7 +930,7 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain end inherited ilToolbarIcons_Large: TImageList Bitmap = { - 494C010111001300580018001800FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C010111001300780018001800FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 00000000000036000000280000006000000078000000010020000000000000B4 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -2459,8 +2463,8 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain end object pmSystemTray: TPopupMenu Images = ilToolbarIcons_Small - Left = 284 - Top = 132 + Left = 252 + Top = 180 object mmRecentlyMounted: TMenuItem Caption = '&Recently mounted' end @@ -2506,7 +2510,7 @@ inherited frmFreeOTFEMain: TfrmFreeOTFEMain Left = 12 Top = 164 Bitmap = { - 494C010102000400500020002000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C010102000400700020002000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000800000002000000001002000000000000040 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 diff --git a/src/PC/gui/main/FreeOTFEfrmMain.pas b/src/PC/gui/main/FreeOTFEfrmMain.pas index 0d2ed9d..96c3912 100644 --- a/src/PC/gui/main/FreeOTFEfrmMain.pas +++ b/src/PC/gui/main/FreeOTFEfrmMain.pas @@ -85,8 +85,10 @@ TfrmFreeOTFEMain = class(TfrmMain) actConsoleHide: TAction; actInstall: TAction; InstallDoxBox1: TMenuItem; - actTestMode: TAction; + actTestModeOn: TAction; SetTestMode1: TMenuItem; + actTestModeOff: TAction; + DisallowTestsigneddrivers1: TMenuItem; procedure actDriversExecute(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -121,9 +123,11 @@ TfrmFreeOTFEMain = class(TfrmMain) procedure actConsoleHideExecute(Sender: TObject); procedure miCreateKeyfileClick(Sender: TObject); procedure actInstallExecute(Sender: TObject); - procedure actTestModeExecute(Sender: TObject); + procedure actTestModeOnExecute(Sender: TObject); + procedure actTestModeOffExecute(Sender: TObject); private + protected TempCypherDriver: string; TempCypherGUID: TGUID; @@ -149,10 +153,14 @@ TfrmFreeOTFEMain = class(TfrmMain) function HandleCommandLineOpts_Count(): integer; function HandleCommandLineOpts_Create(): integer; override; function HandleCommandLineOpts_Dismount(): integer; + function HandleCommandLineOpts_SetTestMode(): integer; + function HandleCommandLineOpts_SetInstalled(): integer; //true = set OK function SetTestMode(silent,SetOn:Boolean):Boolean; - + //sets 'installed' flag in ini file - returns false if fails (ini file must exist or be set as custom) + function SetInstalled():Boolean; + function InstallAllDrivers(driverControlObj: TOTFEFreeOTFEDriverControl;silent: boolean): integer; procedure ReloadSettings(); override; @@ -257,6 +265,8 @@ TfrmFreeOTFEMain = class(TfrmMain) CMDLINE_EXIT_UNABLE_TO_START_PORTABLE_MODE = 104; CMDLINE_EXIT_UNABLE_TO_STOP_PORTABLE_MODE = 105; CMDLINE_EXIT_ADMIN_PRIVS_NEEDED = 106; + CMDLINE_EXIT_UNABLE_TO_SET_TESTMODE = 107; + CMDLINE_EXIT_UNABLE_TO_SET_INSTALLED = 108; CMDLINE_EXIT_UNKNOWN_ERROR = 999; // Command line parameter handled in the .dpr @@ -270,6 +280,7 @@ TfrmFreeOTFEMain = class(TfrmMain) implementation {$R *.DFM} +{ TODO -otdk -crefactor : editing dcr files is awkward - use imagelist instead } {$R FreeOTFESystemTrayIcons.dcr} uses @@ -360,28 +371,37 @@ implementation AUTORUN_SUBSTITUTE_DRIVE = '%DRIVE'; - // Command line parameters... + // Command line parameters. case insensitive. generally only one action per invocation + //swithces only CMDLINE_NOUACESCALATE = 'noUACescalate'; - CMDLINE_DRIVERCONTROL = 'drivercontrol'; + CMDLINE_GUI = 'gui'; + CMDLINE_FORCE = 'force'; + CMDLINE_SET_INSTALLED = 'SetInstalled';//sets 'installed' flag in ini file, creating if nec. - usually used with CMDLINE_SETTINGSFILE + + // cmds with params + CMDLINE_DRIVERCONTROL = 'driverControl'; CMDLINE_PORTABLE = 'portable'; + CMDLINE_TOGGLE = 'toggle'; + CMDLINE_DISMOUNT = 'dismount'; + + +// CMDLINE_MOUNTED = 'mounted'; unused + CMDLINE_SET_TESTMODE ='SetTestMode'; + + // args to Command line parameters... + CMDLINE_COUNT = 'count'; CMDLINE_START = 'start'; CMDLINE_ON = 'on'; CMDLINE_STOP = 'stop'; CMDLINE_OFF = 'off'; - CMDLINE_TOGGLE = 'toggle'; - CMDLINE_DISMOUNT = 'dismount'; - CMDLINE_FORCE = 'force'; - CMDLINE_ALL = 'all'; + CMDLINE_ALL = 'all'; CMDLINE_INSTALL = 'install'; CMDLINE_UNINSTALL = 'uninstall'; - CMDLINE_COUNT = 'count'; - CMDLINE_MOUNTED = 'mounted'; - CMDLINE_GUI = 'gui'; + CMDLINE_DRIVERNAME = 'drivername'; CMDLINE_TOTAL = 'total'; CMDLINE_DRIVERSPORTABLE = 'portable'; - CMDLINE_DRIVERSINSTALLED = 'installed'; - CMDLINE_DRIVERNAME = 'drivername'; - + CMDLINE_DRIVERSINSTALLED = 'installed'; + // Online user manual URL... { TODO -otdk -cenhancement : set project homepage } URL_USERGUIDE_MAIN = 'http://DoxBox.eu/docs/Main'; @@ -432,8 +452,10 @@ procedure TfrmFreeOTFEMain.InitApp(); goForStartPortable := Settings.OptAutoStartPortable; if not(goForStartPortable) then begin - goForStartPortable := SDUConfirmYN( - _('The main DoxBox driver does not appear to be installed/running on this computer')+SDUCRLF+ + // if 'installed' then install drivers and prompt reboot else prompt portable as below + if not Settings.OptInstalled then + goForStartPortable := SDUConfirmYN( + _('The main DoxBox driver does not appear to be installed and running on this computer')+SDUCRLF+ SDUCRLF+ _('Would you like to start DoxBox in portable mode?') ); @@ -445,12 +467,19 @@ procedure TfrmFreeOTFEMain.InitApp(); end else begin - SDUMessageDlg( - _('Please see the "installation" section of the accompanying documentation for instructions on how to install the DoxBox drivers.'), - mtInformation, - [mbOK], - 0 - ); + if Settings.OptInstalled then + begin + actInstallExecute(nil); + end + else + begin + SDUMessageDlg( + _('Please see the "installation" section of the accompanying documentation for instructions on how to install the DoxBox drivers.'), + mtInformation, + [mbOK], + 0 + ); + end; end; end; @@ -694,6 +723,7 @@ function TfrmFreeOTFEMain.AddIconForDrive(driveLetter: ansichar; overlayIdx: int end; + procedure TfrmFreeOTFEMain.InitializeDrivesDisplay(); var tmpColumn: TListColumn; @@ -2743,7 +2773,7 @@ function TfrmFreeOTFEMain.SetTestMode(silent,setOn:Boolean):Boolean; see https://stackoverflow.com/questions/16827229/file-not-found-error-launching-system32-winsat-exe-using-process-start for 'sysnative' this will change if built as 64 bit exe "Alternatively, if you build your program as x64, you can leave the path as c:\windows\system32" } -// ciould alos use SDUWow64DisableWow64FsRedirection +// could also use SDUWow64DisableWow64FsRedirection result := SDUWinExecAndWait32(SDUGetWindowsDirectory()+'\sysnative\bcdedit.exe /set TESTSIGNING '+IfThen(setOn,'ON','OFF'), SW_SHOWNORMAL) <> $FFFFFFFF; if not silent then begin @@ -2753,12 +2783,36 @@ function TfrmFreeOTFEMain.SetTestMode(silent,setOn:Boolean):Boolean; end else begin - SDUMessageDlg(_('Please reboot. After rebooting the DoxBox drivers may be loaded'), mtInformation, [mbOK], 0); + if setOn then SDUMessageDlg(_('Please reboot. After rebooting the DoxBox drivers may be loaded'), mtInformation, [mbOK], 0) + else SDUMessageDlg(_('After rebooting Test Mode will be off'), mtInformation, [mbOK], 0) ; end end; end; -procedure TfrmFreeOTFEMain.actTestModeExecute(Sender: TObject); +function TfrmFreeOTFEMain.SetInstalled():Boolean; +begin + inherited; + //needs to be place to save to + if Settings.OptSaveSettings = slNone then + Settings.OptSaveSettings := slProfile;//exe not supported in win >NT + if result then + begin + Settings.OptInstalled := true; + result := Settings.Save();//todo:needed? + end; +end; + +procedure TfrmFreeOTFEMain.actTestModeOffExecute(Sender: TObject); +var + SigningOS :boolean; +begin + inherited; + SigningOS := (SDUOSVistaOrLater() and SDUOS64bit()); + if SigningOS then SetTestMode(false,false) + else SDUMessageDlg(_('This version of Windows does not support test mode'), mtError, [mbOK], 0); +end; + +procedure TfrmFreeOTFEMain.actTestModeOnExecute(Sender: TObject); var SigningOS :boolean; begin @@ -3145,7 +3199,7 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts_Portable(): integer; Result := cmdExitCode; end; -// Handle "/install" command line +// install all drivers // // !! IMPORTANT !! // NOTICE: THIS DOES NOT CARRY OUT ANY UAC ESCALATION! @@ -3153,25 +3207,19 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts_Portable(): integer; // required // !! IMPORTANT !! // -// Returns: Exit code -function TfrmFreeOTFEMain.HandleCommandLineOpts_DriverControl_Install(driverControlObj: TOTFEFreeOTFEDriverControl): integer; +// Returns: exit code +function TfrmFreeOTFEMain.InstallAllDrivers(driverControlObj: TOTFEFreeOTFEDriverControl;silent: boolean): integer; var - cmdExitCode: integer; + paramValue: string; driverPathAndFilename: string; driverFilenames: TStringList; - silent: boolean; - vista64Bit: boolean; +// vista64Bit: boolean; begin - cmdExitCode := CMDLINE_EXIT_INVALID_CMDLINE; - if SDUCommandLineParameter(CMDLINE_FILENAME, paramValue) then - begin - silent := SDUCommandLineSwitch(CMDLINE_SILENT); - if (uppercase(trim(paramValue)) = uppercase(CMDLINE_ALL)) then - begin - cmdExitCode := CMDLINE_EXIT_UNKNOWN_ERROR; + + result := CMDLINE_EXIT_UNKNOWN_ERROR; driverFilenames:= TStringList.Create(); try @@ -3179,52 +3227,83 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts_DriverControl_Install(driverCont if (driverFilenames.count <= 0) then begin - cmdExitCode := CMDLINE_EXIT_FILE_NOT_FOUND; + result := CMDLINE_EXIT_FILE_NOT_FOUND; end else begin - cmdExitCode := CMDLINE_SUCCESS; + result := CMDLINE_SUCCESS; // If under Vista x64, don't autostart the drivers after // installing - this could cause a bunch of *bloody* *stupid* // warning messages about "unsigned drivers" to be displayed by // the OS - vista64Bit := (SDUOSVistaOrLater() and SDUOS64bit()); +// vista64Bit := (SDUOSVistaOrLater() and SDUOS64bit()); // set test mode - if vista64Bit then - if not SetTestMode(true,true) then cmdExitCode := CMDLINE_EXIT_UNKNOWN_ERROR; + // if vista64Bit then + // if not SetTestMode(true,true) then cmdExitCode := CMDLINE_EXIT_UNKNOWN_ERROR; if driverControlObj.InstallMultipleDrivers( driverFilenames, FALSE, not(silent), - not(vista64Bit) + true// not(vista64Bit) ) then begin - // If Vista x64, we tell the user to reboot. That way, the drivers + { If Vista x64, we tell the user to reboot. That way, the drivers // will be started up on boot - and the user won't actually see // any stupid warning messages about "unsigned drivers" + apparently on vista is not necesary to set test mode - but need to start drivers on os start + test mode is set anyway for all OS's so start drivers now whatever + } if ( - vista64Bit and + // vista64Bit and not(silent) ) then begin SDUMessageDlg( - _('IMPORTANT: Please reboot before using DoxBox.'), + _('DoxBox drivers have been installed successfully.'), mtInformation ); end; end else begin - cmdExitCode := CMDLINE_EXIT_UNKNOWN_ERROR; + result := CMDLINE_EXIT_UNKNOWN_ERROR; end; end; finally driverFilenames.Free(); end; +end; +// Handle "/install" command line +// +// !! IMPORTANT !! +// NOTICE: THIS DOES NOT CARRY OUT ANY UAC ESCALATION! +// User should use "runas DoxBox.exe ..." if UAC escalation +// required +// !! IMPORTANT !! +// +// Returns: Exit code +function TfrmFreeOTFEMain.HandleCommandLineOpts_DriverControl_Install(driverControlObj: TOTFEFreeOTFEDriverControl): integer; +var + cmdExitCode: integer; + paramValue: string; + driverPathAndFilename: string; + driverFilenames: TStringList; + silent: boolean; +// vista64Bit: boolean; +begin + cmdExitCode := CMDLINE_EXIT_INVALID_CMDLINE; + + if SDUCommandLineParameter(CMDLINE_FILENAME, paramValue) then + begin + silent := SDUCommandLineSwitch(CMDLINE_SILENT); + + if (uppercase(trim(paramValue)) = uppercase(CMDLINE_ALL)) then + begin + cmdExitCode := InstallAllDrivers(driverControlObj,silent); end else begin @@ -3265,7 +3344,7 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts_DriverControl_Uninstall(driverCo cmdExitCode: integer; paramValue: string; driveUninstallResult: DWORD; - vista64Bit: boolean; +// vista64Bit: boolean; begin cmdExitCode := CMDLINE_EXIT_INVALID_CMDLINE; @@ -3275,9 +3354,9 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts_DriverControl_Uninstall(driverCo if (uppercase(trim(paramValue)) = uppercase(CMDLINE_ALL)) then begin cmdExitCode := CMDLINE_SUCCESS; - vista64Bit := (SDUOSVistaOrLater() and SDUOS64bit()); +// vista64Bit := (SDUOSVistaOrLater() and SDUOS64bit()); // set test mode off - if vista64Bit then if not SetTestMode(true,false) then cmdExitCode := CMDLINE_EXIT_UNKNOWN_ERROR; + // if vista64Bit then if not SetTestMode(true,false) then cmdExitCode := CMDLINE_EXIT_UNKNOWN_ERROR; if not driverControlObj.UninstallAllDrivers(FALSE) then begin @@ -3418,6 +3497,57 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts_Count(): integer; Result := cmdExitCode; end; +// Handle "/settestmode" command line +// Returns: Exit code +function TfrmFreeOTFEMain.HandleCommandLineOpts_SetTestMode(): integer; +var + paramValue: string; + setOn: boolean; + SigningOS,silent :boolean; +begin + Result := CMDLINE_EXIT_INVALID_CMDLINE; + + if SDUCommandLineParameter(CMDLINE_SET_TESTMODE, paramValue) then + begin + Result := CMDLINE_SUCCESS; + + setOn := false; + if (uppercase(paramValue) = uppercase(CMDLINE_ON)) then setOn := true + else if (uppercase(paramValue) <> uppercase(CMDLINE_OFF)) then Result := CMDLINE_EXIT_INVALID_CMDLINE; + + if Result = CMDLINE_SUCCESS then + begin + SigningOS := (SDUOSVistaOrLater() and SDUOS64bit()); + silent := SDUCommandLineSwitch(CMDLINE_SILENT); + if SigningOS then + begin + if not SetTestMode(silent,setOn) then Result := CMDLINE_EXIT_UNABLE_TO_SET_TESTMODE; + end + else + begin + if not silent then SDUMessageDlg(_('This version of Windows does not support test mode'), mtError, [mbOK], 0); + end; + end; + end +end; + + +// Handle "/SetInstalled" command +// Returns: Exit code +function TfrmFreeOTFEMain.HandleCommandLineOpts_SetInstalled(): integer; +var + paramValue: string; + setOn: boolean; +begin + Result := CMDLINE_EXIT_INVALID_CMDLINE; + + if SDUCommandLineSwitch(CMDLINE_SET_INSTALLED) then + begin + Result := CMDLINE_SUCCESS; + + if not SetInstalled() then Result := CMDLINE_EXIT_UNABLE_TO_SET_INSTALLED; + end; +end; // Handle "/create" command line // Returns: Exit code @@ -3495,55 +3625,75 @@ function TfrmFreeOTFEMain.HandleCommandLineOpts(out cmdExitCode: integer): boole ignoreParams: integer; settingsFile: string; begin - cmdExitCode := CMDLINE_EXIT_INVALID_CMDLINE; + cmdExitCode := CMDLINE_SUCCESS; AllowUACEsclation := not(SDUCommandLineSwitch(CMDLINE_NOUACESCALATE)); +// todo: a lot of repirition here bc HandleCommandLineOpts_ fns also call SDUCommandLineParameter +//todo: 'else' statements mean one cmd per call - allow compatible ones at same time - // Driver control dialog - if SDUCommandLineSwitch(CMDLINE_DRIVERCONTROL) then +//these cmds at least are independent of others + if SDUCommandLineParameter(CMDLINE_SET_TESTMODE, paramValue) then begin - cmdExitCode := HandleCommandLineOpts_DriverControl(); - end - // Portable mode on/off... - else if SDUCommandLineParameter(CMDLINE_PORTABLE, paramValue) then - begin - cmdExitCode := HandleCommandLineOpts_Portable(); - end - else if SDUCommandLineParameter(CMDLINE_DRIVERCONTROL, paramValue) then - begin - cmdExitCode := HandleCommandLineOpts_DriverControl(); - end - else + cmdExitCode := HandleCommandLineOpts_SetTestMode(); + end; + if cmdExitCode = CMDLINE_SUCCESS then begin - // All command line options below require FreeOTFE to be active before they - // can be used - if not(ActivateFreeOTFEComponent(TRUE)) then + if SDUCommandLineSwitch(CMDLINE_SET_INSTALLED) then + begin + cmdExitCode := HandleCommandLineOpts_SetInstalled(); + end + end ; + + +if cmdExitCode = CMDLINE_SUCCESS then + begin + + cmdExitCode := CMDLINE_EXIT_INVALID_CMDLINE; + // Driver control dialog + if SDUCommandLineSwitch(CMDLINE_DRIVERCONTROL) then + begin + cmdExitCode := HandleCommandLineOpts_DriverControl(); + end + // Portable mode on/off... + else if SDUCommandLineParameter(CMDLINE_PORTABLE, paramValue) then begin - cmdExitCode := CMDLINE_EXIT_UNABLE_TO_CONNECT; + cmdExitCode := HandleCommandLineOpts_Portable(); end + else if SDUCommandLineParameter(CMDLINE_DRIVERCONTROL, paramValue) then + begin + cmdExitCode := HandleCommandLineOpts_DriverControl(); + end else begin - if SDUCommandLineSwitch(CMDLINE_COUNT) then - begin - cmdExitCode := HandleCommandLineOpts_Count(); - end - else if SDUCommandLineSwitch(CMDLINE_CREATE) then - begin - cmdExitCode := HandleCommandLineOpts_Create(); - end - else if SDUCommandLineSwitch(CMDLINE_MOUNT) then + // All command line options below require FreeOTFE to be active before they + // can be used + if not(ActivateFreeOTFEComponent(TRUE)) then begin - cmdExitCode := HandleCommandLineOpts_Mount(); + cmdExitCode := CMDLINE_EXIT_UNABLE_TO_CONNECT; end - else if SDUCommandLineParameter(CMDLINE_DISMOUNT, paramValue) then + else begin - cmdExitCode := HandleCommandLineOpts_Dismount(); + if SDUCommandLineSwitch(CMDLINE_COUNT) then + begin + cmdExitCode := HandleCommandLineOpts_Count(); + end + else if SDUCommandLineSwitch(CMDLINE_CREATE) then + begin + cmdExitCode := HandleCommandLineOpts_Create(); + end + else if SDUCommandLineSwitch(CMDLINE_MOUNT) then + begin + cmdExitCode := HandleCommandLineOpts_Mount(); + end + else if SDUCommandLineParameter(CMDLINE_DISMOUNT, paramValue) then + begin + cmdExitCode := HandleCommandLineOpts_Dismount(); + end; + + DeactivateFreeOTFEComponent(); end; - - DeactivateFreeOTFEComponent(); end; end; - // Notice: CMDLINE_MINIMIZE handled in the .dpr // Return TRUE if there were no parameters specified on the command line @@ -3807,63 +3957,18 @@ procedure TfrmFreeOTFEMain.actInstallExecute(Sender: TObject); var driverControlObj: TOTFEFreeOTFEDriverControl; - driverFilenames: TStringList; - vista64Bit: boolean; begin inherited; + driverControlObj := TOTFEFreeOTFEDriverControl.Create(); + try + driverControlObj.Silent := SDUCommandLineSwitch(CMDLINE_SILENT); + InstallAllDrivers(driverControlObj,false); - driverFilenames:= TStringList.Create(); - try - GetAllDriversUnderCWD(driverFilenames); - - if (driverFilenames.count <= 0) then - begin - MessageDlg('DoxBox failed to install, no drivers', mtError, [mbOK], 0); - end - else - begin - - - // If under Vista x64, don't autostart the drivers after - // installing - this could cause a bunch of *bloody* *stupid* - // warning messages about "unsigned drivers" to be displayed by - // the OS - vista64Bit := (SDUOSVistaOrLater() and SDUOS64bit()); - // set test mode - if vista64Bit then - if not SetTestMode(true,true) then MessageDlg('DoxBox failed to install, can''t set test mode', mtError, [mbOK], 0); - - if driverControlObj.InstallMultipleDrivers( - driverFilenames, - FALSE, - true, - not(vista64Bit) - ) then - begin - - // If Vista x64, we tell the user to reboot. That way, the drivers - // will be started up on boot - and the user won't actually see - // any stupid warning messages about "unsigned drivers" - if ( - vista64Bit - ) then - begin - SDUMessageDlg( - _('IMPORTANT: Please reboot before using DoxBox.'), - mtInformation - ); - end; - end else - begin - MessageDlg('DoxBox failed to install, can''t install drivers', mtError, [mbOK], 0); - end; + finally + driverControlObj.Free(); end; - finally - driverFilenames.Free(); - end; - end;