MojoPack NSIS plugin project written in Delphi
Hello,
I am using NSIS now for nearly 1,5 years. NSIS is the installer technology of my choice. So I decide to write own plugins to enhance the functionality of NSIS. Like a convinced Delphi programmer, the goal for me was to write NSIS plugins in Delphi. To give the NSIS community some more information about writing NSIS plugins using Delphi, I decide to provide the source code as well. Now, writing NSIS plugins should be very easy, because I have spent a lot of time to comment my source code well. Feel free to use the source for your own plugin project or just help to enhance my MojoPack NSIS plugin project (MNPP).
MojoPack provides a view useful functions and should be enhanced with more functions in the near future. Currently the following functions are implemented:
- SetAttributes: Set file system attributes to entire directories
- ReplaceInFile: Replace a string with another string in a given file
- ReplaceInFileEx: Replace two strings at the same time in a given file
- TerminateTask: Terminate a running application
- CheckTask: Check if task is currently running
- IsUserLocalAdmin: Check if current user is a member of the local administrator group
See the MojoPack_Readme.txt for more information about the usage of each function and what you have to do if you decide to help enhancing MojoPack.
At least let me give you some useful information how to write plugin functions (procedures) in Delphi.
-------------------------------------------------------------------------------------------
- Always use NSIS.pas for the interface to NSIS
- Each exported dll procedure must call the INIT() function of NSIS.pas first.
- The return value must always be of type string
- Each call of PopString() will catch the next parameter of the function. Note: all parameters
are passed as strings.
- The last call of PushString() fills $0
MNPP is developed with BDS2006/CRS2007 but you should be able to open the .dpr file in previous versions of Delphi.
To compile the Mojopack make sure you have the Jedi Code Library installed.
Special thanks to Bernhard Mayer, Peter Windridge, Brett Dever and Rainer Budde. Great job guys.
Use UPX to shrink the size of the output dll file. Thanks to the upx developper team Markus Oberhumer, Laszlo Molnar and John Reiser.
I hope, you find the provided stuff useful.
Candu