Skip to content

Commit

Permalink
installer: detect more in-use files
Browse files Browse the repository at this point in the history
When any file in Git for Windows' installation is in use, an upgrade
will cause a dialog box "Access Denied ...".

Therefore, we already detect processes that use a couple of DLLs.

We detected in particular the MSYS2 processes. But we did not detect any
Git processes.

Ideally, we would detect *any* of Git for Windows' files that are in
use, but there seems to be no easy API to do that. So let's just try to
catch the most important entry points into Git for Windows (no user has
any business starting anything else in Git for Windows without going
through any of those entry points).

Pointed out by Matt Cavallari.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Sep 21, 2017
1 parent 1521d9e commit 1b93b50
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions installer/install.iss
Expand Up @@ -448,22 +448,42 @@ begin
// Use the Restart Manager API when installing the shell extension on Windows Vista and above.
if Version.Major>=6 then begin
SetArrayLength(Modules,7);
SetArrayLength(Modules,17);
Modules[0]:=ExpandConstant('{app}\usr\bin\msys-2.0.dll');
Modules[1]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl85.dll');
Modules[2]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk85.dll');
Modules[3]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl86.dll');
Modules[4]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk86.dll');
Modules[5]:=ExpandConstant('{app}\git-cheetah\git_shell_ext.dll');
Modules[6]:=ExpandConstant('{app}\git-cheetah\git_shell_ext64.dll');
Modules[7]:=ExpandConstant('{app}\git-cmd.exe');
Modules[8]:=ExpandConstant('{app}\git-bash.exe');
Modules[9]:=ExpandConstant('{app}\bin\bash.exe');
Modules[10]:=ExpandConstant('{app}\bin\git.exe');
Modules[11]:=ExpandConstant('{app}\bin\sh.exe');
Modules[12]:=ExpandConstant('{app}\cmd\git.exe');
Modules[13]:=ExpandConstant('{app}\cmd\gitk.exe');
Modules[14]:=ExpandConstant('{app}\cmd\git-gui.exe');
Modules[15]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\git.exe');
Modules[16]:=ExpandConstant('{app}\usr\bin\bash.exe');
SessionHandle:=FindProcessesUsingModules(Modules,Processes);
end else begin
SetArrayLength(Modules,5);
SetArrayLength(Modules,15);
Modules[0]:=ExpandConstant('{app}\usr\bin\msys-2.0.dll');
Modules[1]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl85.dll');
Modules[2]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk85.dll');
Modules[3]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl86.dll');
Modules[4]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk86.dll');
Modules[5]:=ExpandConstant('{app}\git-cmd.exe');
Modules[6]:=ExpandConstant('{app}\git-bash.exe');
Modules[7]:=ExpandConstant('{app}\bin\bash.exe');
Modules[8]:=ExpandConstant('{app}\bin\git.exe');
Modules[9]:=ExpandConstant('{app}\bin\sh.exe');
Modules[10]:=ExpandConstant('{app}\cmd\git.exe');
Modules[11]:=ExpandConstant('{app}\cmd\gitk.exe');
Modules[12]:=ExpandConstant('{app}\cmd\git-gui.exe');
Modules[13]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\git.exe');
Modules[14]:=ExpandConstant('{app}\usr\bin\bash.exe');
SessionHandle:=FindProcessesUsingModules(Modules,ProcsCloseRequired);
SetArrayLength(Modules,2);
Expand Down

0 comments on commit 1b93b50

Please sign in to comment.