Archive: MojoPack NSIS plugin project written in Delphi


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


Hello again,

I have updated the MojoPack with two additional functions:

WReplaceInFile and WReplaceInFileEx.

The functions are working similar to ReplaceInfile and ReplaceInFileEx, but using unicode files.

The version of MojoPack.dll has been increased to 1.0.0.1.

See MojoPack_ReleaseNotes.txt for some more details on this release.

The attached file only contains the dll, the readme and the release notes. The source code could not be included because of the file size limitation.

@board admins: do I have the chance to upload the whole MojoPack project somewhere? (211 KB).

Regards
Candu


OK, attached you will find the Source code of version 1.0.0.1.

For Delphians:
--------------
To compile the project, you must have the Jedi Code Library and the TMS Unicode Component Pack installed.


Regards
Candu


do I have the chance to upload the whole MojoPack project somewhere? (211 KB).
NSIS wiki http://nsis.sf.net is the place.

Hello,

Your plugin unfortunately cannot work with the Unicode version of NSIS. I have the same issue.

Do you know if there is an existing version of the NSIS.pas that manages unicode for the string parameters passed ?

Thanks & Regards,
F!o