CreateMutex plug-in

From NSIS Wiki
Jump to navigationJump to search

Links

Download link:
Zip.gif nsapicreatemutex.zip (2 KB)

Forum thread (where discussions about the contribution should be posted)

Also see: Allow only one installer instance (uses System plug-in instead of a separate plug-in)

Description

Version: 1.0.

This plug-in has ability to create a mutex (also called as a mutual exclusion), allowing the installer to restrict its number of instances allowed in the system.

How to use

CreateMutex::nsCreateMutex ["MutexName" ["OptionalParameter"]]
Pop "ResultVar"

Creates a mutex for the installer.
MutexName
Specifies a mutex name. If it's "?", it returns instructions of how to use the plug-in.
OptionalParameter
Can specify one of the options below relating to the return value:
  • "1": Returns the Windows error code number if there is errors, or 0 otherwise.
  • "2": Returns the message "MUTEX_EXISTS" if there is errors, or "MUTEX_SET" otherwise.
  • "3": Returns the Windows error message for the operation.
Default is "2".
ResultVar
Variable where the result indicated by the parameter OptionalParameter is returned. If MutextName is "?", then the result returned is a blank value.

Versions History

1.0 - 02/Jan/2004
  • First version of the plug-in.

Credits

Plug-in created by billym.

License

Copyright (C) 2004 billym

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgment in the product documentation would be
   appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.