Old 8th April 2012, 11:30   #1
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
calling DLL - help needed

I have a code fragment like this
PHP Code:
StrCpy $"removetray"
StrCpy $""
StrCpy $"" 
then a dll-call of "install.dll"
$1 contains the result

this dll knows what to do. i need a hint to (re)build this call
http://nsis.sourceforge.net/Docs/System/System.html
http://nsis.sourceforge.net/Calling_...tem.dll_plugin

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 8th April 2012, 12:31   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
That DLL you are going to call, is it a NSIS plugin-DLL or some other kind of DLL?

If it's a NSIS plug-in DLL, i.e. a DLL that implements the NSIS plug-in API, you would call it simple with a:
SomePlugin::SomeFunction [Arg_1 Arg_2 ... Arg_N]

If it is not a NSIS plug-in DLL, you can still call it by using the NSIS System plug-in. Though this will be more complex!

(The System plug-in has a manual. See 'NSIS\Docs\System\System.html' for details!)

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 8th April 2012, 12:53   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
If you look closer, you'll see he already linked to the system plugin readme himself. I think he needs help with the system::call syntax.

What is the syntax of the dll function you're trying to call?
MSG is offline   Reply With Quote
Old 8th April 2012, 13:45   #4
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
a) no nsis dll - external found. there is an install.exe for 64bit buit 32bit has only the dll

b) i have neither nor a clue - for EXE it would be 'install.exe "removetray"'

and each time i dig in i get more and more confused
could be like this
Quote:
System::Call 'YourDllName::YourDllFunction(i, *i, t) i(.r0, r1, .r2) .r1'
but
YourDllFunction = unknown
t = unknown

#

i found a "public nsisfunc" which handles the command line parameters, maybe my "YourDllFunction"?
Brummelchen is offline   Reply With Quote
Old 8th April 2012, 14:01   #5
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
1) It will be impossible to call a Non-NSIS DLL, unless you know the exact definition of the exported function you want to call! Only if you know the exact definition of the function you want to call, preferably in C notation, you may use the System plug-in to call it.

A proper description of a function exported from some DLL looks like this:
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx


2) Just in case you are not aware of this yet: It is NOT possible to call any 64-Bit DLL's from NSIS. That's NOT a limitation of NSIS, but a limitation of the operating systems. 32-Bit processes can't load/use 64-Bit DLL's. There is NO way around that.

(Creating 64-Bit processes from a 32-Bit process works perfectly fine though)

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 8th April 2012, 14:31   #6
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
2) i mentioned for 64bit an exe-file, same purpos as dll/32bit but exe

1) i work on this

i created some code with the system plugin and the result here is, that the install.dll must be called directly
RegisterDLL $PLUGINSDIR\System.dll Call 0
RegisterDLL $PLUGINSDIR\install.dll nsisfunc 0

so the next questzion - again: what ist YourDllName::YourDllFunction
Quote:
System::Call 'install::nsisfunc(i, *i, t) i(.r0) .r1'
returns "1" with correct parameter in $0
other tests returned "-1"

install.dll is extracted on runtime, not as a plugin
Brummelchen is offline   Reply With Quote
Old 8th April 2012, 14:44   #7
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
That "install.dll", is that a DLL you created yourself or is it some 3rd-party DLL ???

(1) If it's your own DLL, then please show us some code. The code (C/C++) inside the DLL you want to call!

(2) If it's a 3rd-party DLL, then please show as the API specification provided by whoever created the DLL.

Note: If that is a 3rd-party DLL, but no API specification is publicly available, forget about calling it from NSIS!

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 8th April 2012, 17:36   #8
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
that is some of the main problem - 3rd party and no doc.
its used to install a printer driver - and its older and noone available for support (gave up).

the other solution is to wrap that installation with my code and files - quick and dirty.
the major problem around is that the installer creates a failure message - but install
files correctly and need reboot. i can uninstall all files without a reboot but i dont have
knowledge how to install this driver so i try the original routines.

oh, this is suprising
PHP Code:
  StrCpy $"in"
  
StrCpy $""
  
StrCpy $""
  
install::nsisfunc 'install::nsisfunc(i, *i, t) i(.r0, r1, .r2) .r1' 
  
Messagebox mb_ok "install1: '$0' '$1' '$2'"

  
StrCpy $"in"
  
StrCpy $""
  
StrCpy $""
  
install::nsisfunc '(i, *i, t) i(.r0, r1, .r2) .r1' 
  
Messagebox mb_ok "install2: '$0' '$1' '$2'" 
both return same (error) message as i know similar from the installer.
but i had to copy the dll to nsis plugins, strange
Brummelchen is offline   Reply With Quote
Old 8th April 2012, 18:09   #9
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally Posted by Brummelchen View Post
that is some of the main problem - 3rd party and no doc.
Then this is a lost case. Unless are able to reverse engineer the existing DLL

Currently you are calling a function names "nsisfunc" from the DLL "install.dll". Does that DLL really export a function of that name?

Also you are using this function like nsisfunc(int X, int *Y, char* Z). Is that how the function is defined?

If so, how do you know that the function is defined like this? You said no Docs are available for the DLL, so where is that info from?

[EDIT]

Sorry, my first comment was wrong.

Now I noticed that you are not calling the DLL via System plug-in. You calling it as if it was a NSIS plug-in DLL.

And you are passing a single String argument to it, which appears to be formated in a System-plugin-like syntax

Previously you said that your DLL is not a NSIS plug-in DLL. So you are contradicting yourself. I give up...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 8th April 2012, 21:23   #10
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
reverse engineering aint really possible - its possible to showup assembler but not the source code.
"nsisfunc" is given by the installer made in nsis - and there is a name in this file.
Quote:
RegisterDLL $PLUGINSDIR\install.dll nsisfunc 0
nsis code aint possible to reverse too, creates some crap, only hints.
i can only rewrite it from my experience and investigations with google and nsis wiki.

so i put some code with system-plugin and reversed that file to compare if i am wrong.
first i was wrong but the structur of any plugin dll is close to dllname::command so i
tried install.dll as a plugin. it works this way but i still think it was not written for this purpose.

easter is close to end and my spare time too. keep fingers crossed.
Brummelchen is offline   Reply With Quote
Old 8th April 2012, 23:56   #11
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
The 'RegisterDLL' command is used to register COM DLL's. That's yet another completely different thing

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 9th April 2012, 12:32   #12
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
maybe - but its the reversed command from any nsis package using dll:function
its not documented in the online help
Brummelchen 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