← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~smpettit/openlp/inno-uninstall into lp:openlp

 

Stevan Pettit has proposed merging lp:~smpettit/openlp/inno-uninstall into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #871522 in OpenLP: "OpenLP uninstall with OpenLP running only removes shortcuts"
  https://bugs.launchpad.net/openlp/+bug/871522

For more details, see:
https://code.launchpad.net/~smpettit/openlp/inno-uninstall/+merge/79121

Bug #871522

Added code to inno setup control file to check if OpenLP is running and user attempts an uninstall.

A message is displayed and uninstall waits until OpenLP is closed or the uninstall is canceled.


-- 
https://code.launchpad.net/~smpettit/openlp/inno-uninstall/+merge/79121
Your team OpenLP Core is requested to review the proposed merge of lp:~smpettit/openlp/inno-uninstall into lp:openlp.
=== modified file 'resources/windows/OpenLP-2.0.iss'
--- resources/windows/OpenLP-2.0.iss	2011-10-08 22:21:23 +0000
+++ resources/windows/OpenLP-2.0.iss	2011-10-12 13:13:26 +0000
@@ -65,8 +65,11 @@
 
 [Files]
 Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
-Source: psvince.dll; Flags: dontcopy
-; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+; DLL used to check if the target program is running at install time
+Source: psvince.dll; flags: dontcopy
+; psvince is installed in {app} folder, so it will be loaded at 
+; uninstall time to check if the target program is running
+Source: psvince.dll; DestDir: {app}
 
 [Icons]
 Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
@@ -87,8 +90,13 @@
 Root: HKCR; Subkey: "OpenLP\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\OpenLP.exe"" ""%1"""
 
 [Code]
-function IsModuleLoaded(modulename: AnsiString ):  Boolean;
-external 'IsModuleLoaded@files:psvince.dll stdcall';
+// Function to call psvince.dll at install time
+function IsModuleLoadedInstall(modulename: AnsiString ):  Boolean;
+external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';
+
+// Function to call psvince.dll at uninstall time
+function IsModuleLoadedUninstall(modulename: AnsiString ):  Boolean;
+external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly' ;
 
 function GetUninstallString(): String;
 var
@@ -133,7 +141,7 @@
 function InitializeSetup(): Boolean;
 begin
   Result := true;
-  while IsModuleLoaded( 'OpenLP.exe' ) and Result do
+  while IsModuleLoadedInstall( 'OpenLP.exe' ) and Result do
   begin
     if MsgBox( 'Openlp is currently running, please close it to continue the install.',
       mbError, MB_OKCANCEL ) =  IDCANCEL then
@@ -153,3 +161,16 @@
     end;
   end;
 end;
+
+function InitializeUninstall(): Boolean;
+begin
+  Result := true;
+  while IsModuleLoadedUninstall( 'OpenLP.exe' ) and Result do
+  begin
+    if MsgBox( 'Openlp is currently running, please close it to continue the uninstall.',
+      mbError, MB_OKCANCEL ) =  IDCANCEL then
+	begin
+	  Result := false;
+	end;
+  end;
+end;
\ No newline at end of file


Follow ups