You are here: Home » Raz-Soft News » [ En ] » Files-In-Use Extension for Inno Setup

Files-In-Use Extension for Inno Setup

17 March |

Note: I’m not maintaining IssProc project anymore, all projects copyrights and feature updates will be released from now here


  First of all I would like to give a big thanks to Jordan Russell for the best freeware installer for Windows programs: Inno Setup. If you need to deploy your applications this is the best free tool you will find, trust me. If you don’t want to write script by hand you can always use ISTool to edit these scripts faster in a visual and easy environment.

Files-In-Use functionality is among the countless services that Windows Installer exposes for setup authors to leverage for their application install/maintenance. This functionality lets setup authors display the processes that hold on to files that would be updated by this install. The user would want to shut those processes before continuing with the install to ensure that the install wouldn’t require a reboot.

Now you can do the same thing with Inno Setup avoiding unnecessary reboots when installing your application exe files / plugin / shell extension / ocx etc with My Files In Use Extension for Inno Setup
Features:

  • small size (it will add less than 20KB to your setup. )
  • multi-language support (you can add or modify the language file)

100% FREE AWARD

  • multiple file search (a semicolon list with exe/dll/ocx names and path can be used)
  • wildcard file match ( * = matches any characters, zero or more times ; ? = matches any character, one time )
  • exact folder match (detect if your file is in use only from a specified folder )
  • applications exe names will be listed not just their description
  • both 32 and 64 bit applications detection (Vista & XP x64 )
  • user friendly: applications are displayed along with their icon
  • possibility to end the detected process forcedly (right click on process for more options)
  • easy to use and 100% free

How do I get it to work with Inno?
1. Download latest File In Use Extension for Inno (IssProc.dll and Inno script demo included)
2. Add the extension (IssProc.dll) in your [Files] section script :

1
2
3
4
5
6
7
8
9
[Files]
;------ add Files In Use Extension
Source: IssProc.dll; DestDir: {tmp}; Flags: dontcopy
;------ add Files In Use Extension extra language file (you don t need to add this file if you are using english only)
Source: IssProcLanguage.ini; DestDir: {tmp}; Flags: dontcopy
;------ Copy IssProc.dll in your app folder if you want to use it on unistall
Source: IssProc.dll; DestDir: {app}
Source: IssProcLanguage.ini; DestDir: {app}
;------

3. Add below code in your [Code] section script (you can modify it as you like):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
[Code]
// IssFindModule called on install
function IssFindModule(hWnd: Integer; Modulename: PChar; Language: PChar; Silent: Boolean; CanIgnore: Boolean ): Integer;
external 'IssFindModule@files:IssProc.dll stdcall setuponly';

// IssFindModule called on uninstall
function IssFindModuleU(hWnd: Integer; Modulename: PChar; Language: PChar; Silent: Boolean; CanIgnore: Boolean ): Integer;
external 'IssFindModule@{app}\IssProc.dll stdcall uninstallonly';

//********************************************************************************************************************************************
// IssFindModule function returns: 0 if no module found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured
//
//  hWnd        = main wizard window handle.
//
//  Modulename  = module name(s) to check. You can use a full path to a DLL/EXE/OCX or wildcard file name/path. Separate multiple modules with semicolon.
//                 Example1 : Modulename='*mymodule.dll';     -  will search in any path for mymodule.dll
//                 Example2 : Modulename=ExpandConstant('{app}\mymodule.dll');     -  will search for mymodule.dll only in {app} folder (the application directory)
//                 Example3 : Modulename=ExpandConstant('{app}\mymodule.dll;*myApp.exe');   - just like Example2 + search for myApp.exe regardless of his path.
//
//  Language    = files in use language dialog. Set this value to empty '' and default english will be used
//                ( see and include IssProcLanguage.ini if you need custom text or other language)
//
//  Silent      = silent mode : set this var to true if you don't want to display the files in use dialog.
//                When Silent is true IssFindModule will return 1 if it founds the Modulename or 0 if nothing found
//
//  CanIgnore   = set this var to false to Disable the Ignore button forcing the user to close those applications before continuing
//                set this var to true to Enable the Ignore button allowing the user to continue without closing those applications
//******************************************************************************************************************************************


function NextButtonClick(CurPage: Integer): Boolean;
var
  hWnd: Integer;
  sModuleName: String;
  nCode: Integer;  {IssFindModule returns: 0 if no module found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured }
begin
  Result := true;

 if CurPage = wpReady then
   begin
      Result := false;
      ExtractTemporaryFile('IssProcLanguage.ini');                          { extract extra language file - you don't need to add this line if you are using english only }
      hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));                     { get main wizard handle }
      sModuleName :=ExpandConstant('{app}\Myprog.exe');                     { searched modules. Tip: separate multiple modules with semicolon Ex: '*mymodule.dll;*mymodule2.dll;*mymodule3.dll'}

     nCode:=IssFindModule(hWnd,sModuleName,'en',false,true);                { search for module and display files-in-use window if found  }
     //sModuleName:=IntToStr(nCode);
    // MsgBox ( sModuleName, mbConfirmation, MB_YESNO or MB_DEFBUTTON2);

     if nCode=1 then  begin                                                 { cancel pressed or files-in-use window closed }
          PostMessage (WizardForm.Handle, $0010, 0, 0);                     { quit setup, $0010=WM_CLOSE }
     end else if (nCode=0) or (nCode=2) then begin                          { no module found or ignored pressed}
          Result := true;                                                   { continue setup  }
     end;

  end;

end;


function InitializeUninstall(): Boolean;
var
  sModuleName: String;
  nCode: Integer;  {IssFindModule returns: 0 if no module found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured }

begin
    Result := false;
      sModuleName := ExpandConstant('*Myprog.exe;');    { searched module. Tip: separate multiple modules with semicolon Ex: '*mymodule.dll;*mymodule2.dll;*myapp.exe'}

     nCode:=IssFindModuleU(0,sModuleName,'enu',false,false); { search for module and display files-in-use window if found  }

     if (nCode=0) or (nCode=2) then begin                    { no module found or ignored pressed}
          Result := true;                                    { continue setup  }
     end;

    // Unload the extension, otherwise it will not be deleted by the uninstaller
    UnloadDLL(ExpandConstant('{app}\IssProc.dll'));

end;

4. Set sModuleName from the above code with your own modules names (separate multiple modules with semicolon)
5. Compile and test your setup. Before Inno will begin install operation The File In Use Extension will check if your modules (DLL’s/exe’s/ocx’s names) are in use and it will popup with a window asking the user to close those applications. The user can choose to Ignore this and continue with setup rebooting at the end, or he can close those applications and click on Retry.

Notes: Starting with Inno Setup v5.3.0 Unicode script the ‘PChar’ type has been renamed to ‘PAnsiChar’. Just Replace all occurrences of ‘PChar’ type to ‘PAnsiChar’ in the above example if you are using InnoSetup v5.3 Unicode or newer.

Version History

Download

Who’s Using IssProc?

You like this post? Be the first of my friends to give me a beer! click here. Thanks!
Filed under

Raz-Soft News, [ En ]

| Tags:

56 Comments.

  1. First I would like to congratulate for this job, it work fine… but…
    Always same problem on WinXP 64 bits : When uninstall the software the {app}\IssProc.dll is not deleted.
    The last message is ‘Geoff February 1, 2011 at 5:47 pm’ that reports the same problem.
    Do you have a fix for it ?
    Your software seem to don’t have no more update. Is it a dead project ?
    Why you don’t officially release the IssProc v1.0.3.453 version ?

    • Hey, thanks for your feedback. Unfortunately I’m not maintaining IssProc project anymore, all projects copyrights and feature updates will be released from now here. The project was sold to a third-party as you can see, that’s why I don’t release any official updated anymore (that, the lack of time and people indifference -used in a lot of projects but no one bother to say thanks- pushed me to give up and not waste time with it anymore). Hope you understand.

      Good luck!

  2. where is the source package?

  3. Great addon!

    I am having an issue with it under 64-bit Windows where it leaves behind the IssProc.dll during the uninstall process.

    Is there a known fix or workaround for this?

    Thanks!

    Geoff

    • One trick is to load IssProc.dll from {tmp} folder and delete the {tmp} folder in a delayed manner with a batch file using sleep and rd. The best place to exec the batch is in DeinitializeSetup and DeinitializeUninstall.

  4. I believe that WatchGuard (www.watchguard.com) uses your software in their installation setup for their WatchGuard System Manager (WSM) application suite. Their WSM 11.3.2 suite has a problem when being installed on Windows Server 2008 R2 (64-bit) and gets an error stating “IssProc.x64 has stopped working” shortly after the installer starts to run. They have not been able to fix it in over ten months, so I started digging, which is how I found this site.

    WatchGuard says that Windows Server 2008 R2 (64-bit) is a supported OS, but they have this crash problem.

    I am not a programmer, so none of the code examples on this site mean anything to me. In case it helps, here are the details I get after a crash of the IssProc.x64 process.

    Error details:
    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: IssProc.x64
    Application Version: 0.0.0.0
    Application Timestamp: 46f55ed3
    Fault Module Name: IssProc.x64
    Fault Module Version: 0.0.0.0
    Fault Module Timestamp: 46f55ed3
    Exception Code: c0000005
    Exception Offset: 0000000000001135
    OS Version: 6.1.7600.2.0.0.305.9
    Locale ID: 1033
    Additional Information 1: b4d0
    Additional Information 2: b4d0a8d0c9f31a354f4c2193fda26dcc
    Additional Information 3: 7f77
    Additional Information 4: 7f771283980a7606b373aeb3e7f44944

    The above is from Small Business Server 2011, which has Windows Server 2008 R2 as the base OS.

    Thank you!

    Gregg Hill

  5. Just started playing with this extension.

    I adapted the example provided with the extension and made the install try to overwrite a file in the {App} folder which I hold open in MS-Word.

    When I try this, the extension does not detect anything and I get the plain old InnoSetup message box Abort-Retry-Ignore.

    Am I missing something?

    Btw: I am running on 32-bit Windows7 enterprise.

  6. Raz, thanks for great tool!

    I use with my setup ISSkin (http://isskin.codejock.com/) and IssProc dialog looks good but I can’t apply to TopBoldLabel and TopSubLabel proper background color (in my case white color). Any suggestion?

    Regards
    Mateusz

  7. Raz, perfect extension, thanks! I have Used Version 1.0.3.453 in a win7 64bit, and the retry works now. Why Don’t you release it? There are several positive reports.

  8. Unfortunately, ‘Files in use’ window causes serious condition.
    While it’s active, if you switch to any other window (if it loses focus), main window and ‘Files in use’ window becomes invisible and unresponsive.
    Looks like window messages are not processed correctly (the only response sometimes I can get is partial system menu on setup’s taskbar button).
    The only way to get it back (make it visible) is to minimize all windows and then switch to it.
    Tested on Vista and XP, with InnoSetup AND with a “loader” windows application, so I know it’s not a random condition.
    I hope you can figure it out.

    Btw, the captcha you are using is totally illegible.

  9. Me again. It looks like the new dll (1.0.3.453) doesn’t fix the problem that the file never gets deleted unter 64-bit Windows by the installer. I tried the included Demo.iss with InnoSetup5.3.8 (Ansi and Unicode Version). If you install the Demo, then {tmp}\IssProc.dll is not deleted and if you uninstall the Demo then {app}\IssProc.dll is not deleted. I tested with Vista Bussiness SP2 x64 German, if that helps. Send me an E-Mail if you need more information. Under 32-bit Windows everything seems to be OK for me.

    Thanks and regards,
    Frank

  10. Just one translation point: If you right-click on a FileInUse-item then the menu entries are always in english (‘Properties…’ and ‘End Process…’). Is there a way to change these strings to another language?

  11. Thank you for this nice extension for Inno Setup.

  12. superb add-on .. thanks !!!

  13. Hello, I haqve a problem with compilation.

    Parsing [Files] section, line 332
    Reading version info: ..\InnoS
    etup5_unicode\IssProc.dll
    Parsing [Files] section, line 334
    Reading version info: ..\InnoS
    etup5_unicode\IssProcLanguage.ini
    Parsing [Files] section, line 336
    Parsing [Files] section, line 337
    Compiling [Code] section
    Error on line 506 in .\InstallationScripts\GrpOffice2.iss:
    Column 51:
    Unknown type ‘PChar’
    Compile aborted.

    What is wrong please?

    Thanks

    Zakyn

    • Starting with Inno Setup v5.3.0 script the ‘PChar’ type has been renamed to ‘PAnsiChar’. Just Replace all occurrences of ‘PChar’ type to ‘PAnsiChar’.

      • With version 5.3.6 you will get an “Unknown type ‘PAnsiChar’” error if you do so.

        Other than that, thank you for this add-on!!

  14. I have issue with not deleting IssProc.dll after uninstalling application on Win7 x64

  15. Intenta de esta manera (Try this way):
    Var
    obj: Variant
    va: MyVariableType;
    Begin
    //Starting
    ExtractTemporaryFile(‘MyDll.dll’);
    RegisterServer(False, ExpandConstant(‘{tmp}\MyDll.dll’), False);
    obj := CreateOleObject(‘MyDll.MyClass’);
    //Using
    va := obj.MyFunction();
    //Finishing
    UnregisterServer(False, ExpandConstant(‘{tmp}\MyDll.dll’), False);
    DeleteFile(‘{tmp}\MyDll.dll’);
    End;

    Suerte (good luck)

  16. Just wanted to say thanks.
    The extension works great for me.

  17. Need some help, I would like to use this with another feature but they both use the same function function NextButtonClick(CurPage: Integer): Boolean;

    So I did this:
    function NextButtonClick(CurPage: Integer): Boolean;
    begin
    if CurPage = wpReady then
    begin
    Result := CheckAppRun() and CheckNET();
    end;
    end;

    and created function CheckAppRun(): Boolean;
    with the code from the NextButtonClick minus the if CurPage = wpReady then. But now I when I run the setup program I’m unable to get next click to work. Any help on why this is please let me know?

    • Try to simplify it, make it more readable to find the problem, do something like this:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      {....blah blah init code...}
      begin
        Result := true; {default return value }
      sModuleName:=ExpandConstant('{app}\Myprog.exe');
      nCode:=IssFindModule(hWnd,sModuleName,'en',false,true);
      if nCode=1 then  begin
             PostMessage (WizardForm.Handle, $0010,0, 0); {canceled}
      end else if (nCode=0) or (nCode=2) then begin
       Result:=CheckNET();                              
      end;
  18. The file is now being removed I guess it was an issue with the file.

    Also new problem, It is not detecting program on running on installation.

    • What do you mean by “It is not detecting program on running on installation.” are you sure you’re searching for the right one, with wildcard?

  19. Hi, sorry for the delayed response.

    @Brandon, Clark L
    Is this happening only on 64bit Windows? Because I can’t replicate. Thanks

  20. http://raz-soft.com/IssProcv1.0.3.453.rar

    this fixed the issues with the 64 bit windows, but it didn’t uninstall IssProc.dll and yes I do have this in my code:

    1
    UnloadDLL(ExpandConstant('{app}\IssProc.dll'));
  21. Hello. IssProc is great but I have a small problem. I use IssProcLanguage.ini to show instructions in Polish. It is ok in some WindowsXP and Vista but sometimes in win98 or some XPs instructions are shown in English. I guest that it is problem with including .ini and finally is shown oryginaly english instuction probably from issProc.dll.
    It is very important to display all informations in Polish… Can I ask for help? May I ask for translated issProc.dll file? Or any other ways to solve my problem? Thanks!!!

  22. Hello,

    I just came across this extension and it does exactly what I was looking for. I’m having an issue with ‘Retry’. When I click it, even though I have exited the process I was checking for, it still shows in the list and I am unable to continue with setup. If I exit setup and re-run, I can continue on fine. Is it possibly something I need to put in to my setup script that controls this behavior? I’m running this on Server 2008 64-Bit and using the latest Inno Setup version.

    Thank you,
    Clark L

    • Hi Clark,

      This is a 64bit issue, I got a beta fix here if you want to give it a try. Please let me know if it works on you and I will release it as soon as posible. I don’t have suffcient resources for full 64bit tests, sorry.

      Thanks.

  23. Hi Raz,

    This one is an excellent one. One more thing I wanted to add is can we not give one more parameter so that we can kill the exe silentely insted of the user to end the process. That might be usefull when the user knows that only one exe is being used and he has to just kill it.
    Hope you understand that iam saying. I had writen a small dll and was trying to achieve that feature but i am encountering some issues
    “Cannot Import dll:”

    Hope to see your reply soon

    Regards,
    -SG

    • Thank you. It will be usefull, but right now I’m to busy with other projects. If you really want this feature I can make a private build for you for a small donation :-)

  24. Translation brazilian portuguese for IssProcLanguage.ini:

    TopBoldLabel=Arquivos em uso
    TopSubLabel=Alguns arquivos de precisam ser removidos estão em uso
    MoreInfoLabel=As aplicações listadas estão usando arquivos que necesitam ser removidos por este desinstalador.
    Encerreas-as e clique em Tentar Novamente para continuar a desinstalação
    ;*** Buttons ***
    CancelButton=&Cancelar
    IgnoreButton=&Ignorar
    RetryButton=&Tentar Novamente

  25. Hi,

    Is there any way to disable the prompting the user for ending the running process?I need to kill the process from the setup without the intervention of user.

    Please help….

    Thanks and regards,
    Syam S

    • There is now way to do this ,you can hide the window but you can not kill the process automatically. I can add this feature in a new build…

      • I made another extension that adds that functionality. It force kills an exe/module name you give, then I run raz’s extension after mine in case it doesn’t work out. Let me know if you want it, xeek@x3software.com

  26. Hi,

    Is there a way to change the order of the Retry/Ignore/Cancel buttons? Its easy for a user who quickly hits ‘Next>’ to skip the popup dialog, because Ignore comes roughly at the same spot as ‘Next>’. I want to make Retry the middle button.

  27. I’m trying to use your Inno code with a shell extension and am not having any luck at all. It never reports that the DLL is in use so it never prompts the user to do anything. It seems so straightforward that I can’t imagine what I’m doing wrong. Does it just not work for shell extensions?

    • It works just fine for shell extensions, this is the main reason why I made this extension. Just make sure you write the searched module with wildcard to match any folder: ‘*mymodule.dll’

  28. Hi,

    Is it possible to get the name and icon of the file-in-use from the app’s main window, instead of getting it from the FileVersion info? This is what Task Manager does for the "Applications" tab, as it is generally more useful/correct than just the FileVersion info.

    The exact problem I’m having is this: when the file-in-use is a Java app, IssProc will display something like "Java (TM) 2 Platform Standard Edition binary (javaw.exe)" with the ugly default icon. Of course, most users have no idea what that is!

    I think that getting the icon and name from the FileVersion info is a good backup strategy for processes that don’t have any windows.

    Thanks for a nice utility!

    Daniel

  29. Hi Neo,

     You must modify your script and put additional checks: If the user has selected the english language then use IssProg with ‘en’ value on the language param. If it selects french then use IssProc with ‘fr’ and so on…You must have some experience with inno script (delphi/pascal) to make that work.

     I can help you out with that too, but right now time is not on my side. Send me your script (attach the language file as well) and I shall modify it for you one more time :-?

    Raz

  30. Hi,

    Yes working great with : nCode:=IssFindModule(hWnd,sModuleName,’fr’,false,true);

    and : nCode:=IssFindModule(hWnd,sModuleName,’fru’,false,true);

    But in fact I use innosetup in multi language in my case the users select english or french during the first screen !

    And right now I just can use IssProc in english or french but not the both.

    I hope you understand what I mean !

    Neo

  31. Hi Neo,
    For now caption on install/uninstall can not be set from language file but I will add that on my “to do list”.

    For your translation: in the file IssProcLanguage.ini file create a section called [fr] (used on install ) and [fru] (unsinstall) and add your translated variables just like those in english, something like this (you can copy the below code and translate):

    ;***** [French language] Install ****
    [fr]
    ; *** Labels ***
    TopBoldLabel=Files in use
    TopSubLabel=Some files that needed to be updated are currently in use.
    MoreInfoLabel=The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.
    ;*** Buttons ***
    CancelButton=&Cancel
    IgnoreButton=&Ignore
    RetryButton=&Retry

    ;**[French language] Uninstall ***********
    [fru]
    ; *** Labels ***
    TopBoldLabel=Files in use
    TopSubLabel=Some files that needed to be removed are currently in use.
    MoreInfoLabel=The following applications are using files that need to be removed by this setup. Close these applications and then click Retry to continue uninstalling or Cancel to exit it.
    ;*** Buttons ***
    CancelButton=&Cancel
    IgnoreButton=&Ignore
    RetryButton=&Retry

    After you add (and translate) the above sections use “fr” and “fru” for language param of IssProc function like this:

    nCode:=IssFindModule(hWnd,sModuleName,’fr’,false,true);

    and on uninstall like this:

    nCode:=IssFindModule(hWnd,sModuleName,’fru’,false,true);

    Please send you translation file at: razvar .at. gmail .dot. com and I will reply you with the working/modified french one.

    Thanks

  32. Hi,

    During install in english we can see on the main form ‘Setup – My Program’ and in french ‘Installation – My program’ … great !

    But during uninstall in english we can see on the main form ‘Setup’ and in french ‘setup’

    It should be great during uninstall to see in english ‘Setup – My Program’ and in french ‘Désinstallation – My Program’ like in inno setup !

    I do not really understand how to add a second language in the code (french and english). Could you give me an example please ?

    I’ve translated the IssProcLanguage.ini file in french. If you want this one email me please

    Thanks for all

    Neo

  33. Hi all,
    IssProc v1.0.2 is out: no more packer and DEP problems (i hope), support for both 32 & 64 apps, fully tested on XP and Vista x64 and more user friendly. Let me know your thoughts ;)
    Thank you

  34. Hi Raz,
    Thanks for the feedback, I’ve just needed to resolve this issue today.
    The unpacked version works very well on my Vista x64 installation.
    I’ve found that the packed version installs correctly if I turn off DEP on my Vista installation by running the following command from the command prompt with administrative privileges:

    bcdedit.exe /set {current} nx AlwaysOff

    It seems that a lot of the execiutable packers are incompatible with DEP :(

  35. I am using your unpacked version on Vista 64 Business edition as the other one wont work. If possible could you please add detection of 64 bit programs?

  36. Hi Crulex,
    It looks like Inno Setup cannot Import the DLL in Vista Enterprise x64. I guess the only thing that causes the failure is the extension packer (used to reduce the size). The only thing I can do is to send you the unpacked version of the extension, you can download it from here
    Please let me know if the unpacked version works on your installlation.

  37. My installation fails under Vista Enterprise x64, as well as the sample setup I’ve compiled from your sample.
    I’m getting the following error immediately after launching setup:
    —————————
    Runtime Error (at -1:0):

    Cannot Import dll:C:\TEMP\is-SL00G.tmp\IssProc.dll.
    —————————
    I tried changing the script to delay load your dll but it stll fails during the installation.
    On Win98/2000/WinXP anything goes fine.
    I wonder it might be smth with manifests, etc.

  38. Multi-language support added in IssProc.dll v1.0.1

  39. Hi George,
    The popup window is in English and there is no multi-language support for now, but multi-lang support is scheduled to be added in the next build.
    Thanks

  40. Hi,
    Is there a way to translate the popup window asking the user to close those applications? I need a translation for a germany setup file.
    Thanks

  41. I should say, though, that the new DLL did fix the retry problem on 64-bit Windows for me, so I appreciate you fixing that!