StdUtils plug-in: Difference between revisions
LoRd MuldeR (talk | contribs) No edit summary |
LoRd MuldeR (talk | contribs) |
||
Line 38: | Line 38: | ||
== Acknowledgment == | == Acknowledgment == | ||
This plug-in has partly been inspired by the [[ShellExecAsUser_plug-in]], created by ''installer32''. | * This plug-in has partly been inspired by the [[ShellExecAsUser_plug-in]], created by ''installer32''. | ||
This plug-in has partly been inspired by the [[InvokeShellVerb plug-in]], created by ''Robert Strong''. | * This plug-in has partly been inspired by the [[InvokeShellVerb plug-in]], created by ''Robert Strong''. | ||
== Download == | == Download == |
Revision as of 17:16, 21 October 2012
Author: LoRd MuldeR (talk, contrib) |
This plug-in provides access to a number of "standard" functions from the C Standard Library, which programmers are used to from their C/C++ compilers (and other languages), but which are not available in NSIS by default. In order to keep the plug-in size as small as possible (~15 KB) and for maximum compatibility, the Visual C++ Run-Time v6.0 (MSVCRT.DLL), which is included with all versions of Windows (since Windows 2000), is used - instead of linking the Visual C++ Run-Time library into the plug-in DLL.
Many additional functions, not directly related to the C Standard Library, have sneaked in over the years. For example, this plug-in provides a wrapper for the SHFileOperation function. Moreover it provides a method for launching programs in a non-elevated way (user context) from an elevated installer (admin mode) on UAC-enabled systems (Vista and later) - see below for details! Last but not least, a version of ExecShell with "wait for process termination" feature (based on ShellExecuteEx) as well as a function to invoke "shell verbs" (e.g. for pinning items to the Taskbar in Windows 7) are provided. Overall I use this plug-in as my "Swiss army Army knife" for all the small things I needed in my NSIS-based installers but NSIS didn't provide out-of-the-box.
ANSI and Unicode builds available. Support operating systems: Windows 2000 and later.
Available Functions
!define StdUtils.Time '!insertmacro _StdUtils_Time' #time() !define StdUtils.Rand '!insertmacro _StdUtils_Rand' #rand() !define StdUtils.RandMax '!insertmacro _StdUtils_RandMax' #rand() with maximum !define StdUtils.RandMinMax '!insertmacro _StdUtils_RandMinMax' #rand() with minimum/maximum !define StdUtils.RandList '!insertmacro _StdUtils_RandList' #rand() with list support !define StdUtils.FormatStr '!insertmacro _StdUtils_FormatStr' #sprintf() with one format tag (only %d supported!) !define StdUtils.FormatStr2 '!insertmacro _StdUtils_FormatStr2' #sprintf() with two format tags (only %d supported!) !define StdUtils.FormatStr3 '!insertmacro _StdUtils_FormatStr3' #sprintf() with three format tags (only %d supported!) !define StdUtils.ScanStr '!insertmacro _StdUtils_ScanStr' #sscanf() with one format tag (only %d supported!) !define StdUtils.ScanStr2 '!insertmacro _StdUtils_ScanStr2' #sscanf() with two format tags (only %d supported!) !define StdUtils.ScanStr3 '!insertmacro _StdUtils_ScanStr3' #sscanf() with three format tags (only %d supported!) !define StdUtils.TrimStr '!insertmacro _StdUtils_TrimStr' #Remove whitspaces from string (left and right) !define StdUtils.TrimStrLeft '!insertmacro _StdUtils_TrimStrLeft' #Remove whitspaces from string (left side only) !define StdUtils.TrimStrRight '!insertmacro _StdUtils_TrimStrRight' #Remove whitspaces from string (right side only) !define StdUtils.RevStr '!insertmacro _StdUtils_RevStr' #Reverse a string !define StdUtils.SHFileMove '!insertmacro _StdUtils_SHFileMove' #SHFileOperation with FO_MOVE !define StdUtils.SHFileCopy '!insertmacro _StdUtils_SHFileCopy' #SHFileOperation with FO_COPY !define StdUtils.ExecShellAsUser '!insertmacro _StdUtils_ExecShlUser' #ShellExecute() with user context (for elevated installers) !define StdUtils.InvokeShellVerb '!insertmacro _StdUtils_InvkeShlVrb' #Invokes a Shell Verb on the specified item !define StdUtils.ExecShellWait '!insertmacro _StdUtils_ExecShlWait' #ShellExecuteEx() with process handle to wait for !define StdUtils.WaitForProc '!insertmacro _StdUtils_WaitForProc' #WaitForSingleObject() to wait for process termination !define StdUtils.GetParameter '!insertmacro _StdUtils_GetParameter' #Get the value of a specific commandline paramater !define StdUtils.GetAllParameters '!insertmacro _StdUtils_GetAllParams' #Get complete command-line, but without executable name !define StdUtils.SetVerbose '!insertmacro _StdUtils_SetVerbose' #Verbose mode (for debugging)
For details please see "Docs\StdUtils\StdUtils.html" included in the download!
Acknowledgment
- This plug-in has partly been inspired by the ShellExecAsUser_plug-in, created by installer32.
- This plug-in has partly been inspired by the InvokeShellVerb plug-in, created by Robert Strong.
Download
Download: StdUtils.2011-10-18.zip (105 KB)
SVN Repository:
http://code.google.com/p/mulder/source/browse/trunk/Utils/nsis_stdutils/
Support
Discussion thread at NSIS Forums:
http://forums.winamp.com/showthread.php?t=335435
E-Mail:
MuldeR2 (at) gmx (dot) de