Archive: NSIS Plugin documentation


NSIS Plugin documentation
Hello,

I am trying to build an NSIS plugin but there is not much documentation on how to proceed. Nevertheless, I've found Jim Parks example and started from there: http://nsis.svn.sourceforge.net/view...n=&view=markup.

With Eclipse CDT, I succeded to build my dll using as source files: MySourceFile.c, pluginapi.c and as include files: api.h, nsis_tchar.h and pluginapi.h.

From EclipsesNSIS, I am able to access the exported functions of the dll.

First weird thing is that when I decide to upgrade my dll with a new function, build it and copy back the dll in the NSIS plugins directory, when I restart EclipseNSIS, the autocompletion will not detect the new functions added, though, when compiling the nsi script, it will detect it.

Second thing is that I am not able to push and pop the stack correctly, here follows my plugin code:

#include <windows.h>
#include <string.h>
#include "pluginapi.h" // nsis plugin

HINSTANCE g_hInstance;

HWND g_hwndParent;

void __declspec(dllexport) test(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
{
const TCHAR* result = "Yes";
pushstring(result);
}
}

void __declspec(dllexport) test2(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
{
const TCHAR* result = "Yes";
pushstring(result);
}
}

BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
g_hInstance = hInst;
return TRUE;
}

I call it from my nsi script as follows:

Quote:

MySourceFile::test
pop $0
MessagBox MB_OK "$0" And I don't get back my string "Yes" but a value: 512.

I've tried calling it as follows:
MySourceFile::test /NOUNLOAD "test"
but I get back always the first parameter passed.

Please help

Hello guyz,

finally I switched to Visual Studio Express 2010 and followed this tutorial: http://clseto.mysinablog.com/index.p...icleId=1910084 and it worked directly. I stil don't see why it didn't work with the Eclipse CDT environment.

Kind regards,

Tanguy Mezzano


Also look at this: http://nsis.sourceforge.net/Building...%29_dependency

Stu


Originally posted by Wonderketchup
Hello guyz,

finally I switched to Visual Studio Express 2010 and followed this tutorial: http://clseto.mysinablog.com/index.p...icleId=1910084 and it worked directly. I stil don't see why it didn't work with the Eclipse CDT environment.

Kind regards,

Tanguy Mezzano
When I was creating my very first plugin for NSIS (but I cant remember what it was :p) I was totally desperated about it.
So I took working plugin and created my own from it's sources.
As time had passed I found what to do.
MySourceFile::test /NOUNLOAD "test"
NOUNLOAD is actually a parameter for dll, but it cannot be popped from stack!

The nounload plugin parameter was deprecated a couple of NSIS versions ago. The new plugin model doesn't use the parameter.


Originally posted by MSG
The nounload plugin parameter was deprecated a couple of NSIS versions ago. The new plugin model doesn't use the parameter.
The new plugin model is optional, and so is /NOUNLOAD