Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Plugin not Recognized by NSIS (http://forums.winamp.com/showthread.php?t=379771)

parasoul 14th November 2014 19:28

Plugin not Recognized by NSIS
 
Hello,
I'm compiling a NSIS plugin in Watcom using C++. I'm exporting a simple NSIS function:

PHP Code:

#define NSISFUNC(name) extern "C" void __declspec(dllexport) name(HWND hWndParent, int string_size, int* variables, stack_t** stacktop, extra_parameters* extra)
NSISFUNC(Test)
{
MessageBox(0,"test",0,0);


The export is showing in CFF Explorer:
http://i.gyazo.com/af29352caf9ab10d58a55c630cb4ca9b.png

The file is being built as a DLL:
http://i.gyazo.com/bfb0566d76a126c6d060e06a9bcc931e.png

when I try to compile:
Quote:

Name: "Memento"
OutFile: "Memento.exe"
XPStyle: on
ShowInstDetails: show
Section: ""
Invalid command: Test::Test
I'm 100% positive Test.dll is in the correct directory

I'm not sure exactly how NSIS's compiler resolves a plugin function, but I assume that it looks for the presence of the DLL -> make sure that it's a DLL -> presence of an export matching the function name -> done

Any idea what the problem is here?

Here's a download to Test.dll:
https://www.sendspace.com/file/4kz9ip

Many thanks

Anders 14th November 2014 20:48

The VirtualSize field in the IMAGE_SECTION_HEADER for IMAGE_DIRECTORY_ENTRY_EXPORT is zero which is why makensis fails to find the export.

I don't know if your compiler/linker fails to follow the PE spec or if it is OK to set it to zero even though it contains initialized data, if that is the case then it is a bug in makensis.

Edit: I changed the way makensis looks for the exports section, should be fixed in the next release...

parasoul 15th November 2014 00:40

Sounds great, Anders. Where can I acquire this new makensis?

Many thanks

Anders 15th November 2014 02:03

Unless you compile it yourself you have to wait until the next release, next year probably. It is also probably possible to patch v2.46 with a hex editor if you can figure out which bytes to change or patch your dll after linking. Your final option is to use a different linker. Mingw and Visual Studio can both be used for free...

parasoul 15th November 2014 03:43

Ok I see. Can you please just tell me what source file needs to be changed? I'll go ahead and compile it myself

edit:

I assume this is the line that needs to be changed:
http://i.gyazo.com/25f0611ed45e8bdc40802f0ecc7cd133.png

?

Thanks again

JasonFriday13 15th November 2014 06:22

It's been committed in svn: http://sourceforge.net/p/nsis/code/6569/.

parasoul 15th November 2014 07:11

Thanks very much Jason and Anders. All settled now.

Anders 15th November 2014 18:40

Patch for v3.0b1: 8B 52 08 8B --> 8B 52 10 8B (sort of untested) I believe the code in 2.46 is @ 00019EA6 but I'm not sure if it is possible to patch it.

Your plugin crashed on exit when I tested it, make sure the function is cdecl and not stdcall.


All times are GMT. The time now is 17:19.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.