Detect if an instance is running with kernel32::CreateMutexA

Posted by moz on Stack Overflow See other posts from Stack Overflow or by moz
Published on 2010-01-06T16:40:53Z Indexed on 2010/06/09 15:22 UTC
Read the original article Hit count: 169

Filed under:

Hello.

I'm working on an NSIS installer, and trying to check if a certain application is running before uninstalling. So, I use kernel32::CreateMutexA call. Here is the chunk:

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "cmd.exe") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
    MessageBox MB_USERICON "The application is already running."
Abort

I put it into un.onInit. Trouble is, the process (cmd.exe here) is never detected.

Did I miss something?

Tx.

© Stack Overflow or respective owner

Related posts about nsis