Old 8th June 2011, 09:52   #1
Wonderketchup
Junior Member
 
Join Date: May 2011
Posts: 2
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:

Quote:
#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:
Quote:
MySourceFile::test /NOUNLOAD "test"
but I get back always the first parameter passed.

Please help
Wonderketchup is offline   Reply With Quote
Old 9th June 2011, 16:39   #2
Wonderketchup
Junior Member
 
Join Date: May 2011
Posts: 2
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
Wonderketchup is offline   Reply With Quote
Old 9th June 2011, 16:55   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Also look at this: http://nsis.sourceforge.net/Building...%29_dependency

Stu
Afrow UK is offline   Reply With Quote
Old 10th June 2011, 05:43   #4
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 562
Send a message via ICQ to T.Slappy
Quote:
Originally Posted by Wonderketchup View Post
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 ) 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.
Quote:
MySourceFile::test /NOUNLOAD "test"
NOUNLOAD is actually a parameter for dll, but it cannot be popped from stack!

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2022: www.visual-installer.com
or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 10th June 2011, 06:03   #5
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
The nounload plugin parameter was deprecated a couple of NSIS versions ago. The new plugin model doesn't use the parameter.
MSG is offline   Reply With Quote
Old 10th June 2011, 09:56   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
Quote:
Originally Posted by MSG View Post
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump