windowsinno-setup32bit-64bitpascalscript

How to check with Inno Setup, if a process is running at a Windows 2008 R2 64bit?


I've read the following post. My Code looks exactly the same, but does not work:
Inno Setup Checking for running process

I copied the example from http://www.vincenzo.net/isxkb/index.php?title=PSVince

But the example doesn't work either, even if I change the code like this:

[Code]
function IsModuleLoaded(modulename: AnsiString):  Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';

The code always returns false (the program is not running, even it is running). Tested at Windows 2008 R2 and Windows 7.

In fact I want to check, if the tomcat5.exe is running or not. So I think I can't work with a AppMutex.

I have also seen https://code.google.com/p/psvince/source/detail?r=5
But I can't find any facts about compatibility of that DLL.

Complete code:

[Files]
Source: psvince.dll; Flags: dontcopy

[Code]
function IsModuleLoaded(modulename: AnsiString ):  Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';

function InitializeSetup(): Boolean;
begin
  if(IsModuleLoaded( 'notepad.exe' )) then
    begin
      MsgBox('Running', mbInformation, MB_OK);
      Result := false;
    end
  else
    begin
      MsgBox('Not running', mbInformation, MB_OK);
      Result := true;
    end
end;

Solution

  • Unfortunately psvince.dll cannot query 64 bit running processes based on my observation, and as I am not its developer, I don't know how to fix it to work on Windows x64.

    My workaround is to use a home-cooked command line utility, processviewer.exe,

    http://github.com/lextm/processviewer

    This has been tested on Windows 7 x64 in Touch Mouse Mate

    https://docs.lextudio.com/blog/new-inno-setup-installer-script-samples-version-compare-running-processes-112b407de77e