Old 29th July 2012, 22:20   #1
sepp2012
Junior Member
 
Join Date: Jul 2012
Posts: 2
Plugin-DLL keeps Crashing

Hello all,

I am trying to write a DLL with PureBasic :-)
I can call the DLL-function and I can even pass a parameter, but when the DLL-function ends the exe is crashing everytime with the error-code 0xc0000005. Does anyone have an idea?

Thanks,
Sepp

dlltest.nsi
PHP Code:
!addplugindir "."

Name "DLL-Test"
OutFile "dlltest.exe"
RequestExecutionLevel user
SilentInstall silent

Section
  MessageBox MB_OK 
"This is an internal MessageBox"
  
dlltest::testprocedure "This is an DLL MessageBox with NSI-parameter"
  
MessageBox MB_OK "This is the last Message"
SectionEnd 
dlltest.pb
PHP Code:
Structure TCHAR
 char
.i
EndStructure

Structure stack_t
  
*Next.stack_t
  text
.s{1024}
EndStructure

ProcedureDLL testprocedure
(hwndParent.istring_size.i, *variables.TCHAR, *stacktop_pointer, *extra)
  *
stacktop.stack_t PeekI(*stacktop_pointer)
  *
stacktop_pointer = *stacktop\Next Decrease Stack
  MessageRequester
("testprocedure", *stacktop\text)
EndProcedure 
sepp2012 is offline   Reply With Quote
Old 29th July 2012, 23:45   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
Try ProcedureCDLL

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 30th July 2012, 06:22   #3
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 554
Send a message via ICQ to T.Slappy
What about dlltest::testprocedure /NOUNLOAD "This is an DLL MessageBox with NSI-parameter" ??

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 30th July 2012, 08:59   #4
sepp2012
Junior Member
 
Join Date: Jul 2012
Posts: 2
Quote:
Originally Posted by T.Slappy View Post
What about dlltest::testprocedure /NOUNLOAD "This is an DLL MessageBox with NSI-parameter" ??
I tried that, but it is still crashing.
Also /NOUNLOAD was deprecated in NSIS 2.42 (but still works).

Quote:
Originally Posted by Anders View Post
Try ProcedureCDLL
Yes, that's it
Thank you very very much! I tried it for several hours, but did not got it.

I researched a little bit more, for all who are interested: NSIS-DLL's must use the cdecl calling convention (Windows-default is stdcall) whereas the calling function cleans the stack (at stdcall the callee cleans the stack).
sepp2012 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