Old 17th May 2004, 18:48   #1
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
Plugin Creation

Hello,

I'm trying to create a new nsis plugin to check a serial number and return a true or false value, I have made the DLL as a pluging, copied to the plugin dir, the function is being executed, but the parameters passed are not arriving to the dll.

I'm not using VC++ or even c++, so I guess that I need to access the stack in some other way, but I can't find any info about this.

Thanks
jherrera1976 is offline   Reply With Quote
Old 17th May 2004, 23:12   #2
Vytautas
Major Dude
 
Vytautas's Avatar
 
Join Date: May 2003
Location: Victoria, Australia
Posts: 643
Send a message via ICQ to Vytautas
There is an example of how to create NSIS plugins including functions for accessing the stack in the NSIS distribution, see ExDLL folder.

If the language you are using is not found there you should still have a look at the functions there and try to convert them to your programming language.

Vytautas
Vytautas is offline   Reply With Quote
Old 18th May 2004, 15:14   #3
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
What language are you working on? Did you try using system plugin for this?


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 19th May 2004, 02:44   #4
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Lobo Lunar, System plugin can do much but we (people from forums) don't know every trick inside it. Its readme has information but not as clear as it should be to be totally understood. I think brainsucker HAS to make a new readme for it. This request has been made since System plugin has been created, however he didn't work on it until now.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 20th May 2004, 14:01   #5
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
I'm using a language called Clarion, is a 4gl language. The main problem is how should I access the stack, somebody at the IRC told me to read about System::Store, that's what I should use? And if that is ok, once I have a result on my dll, where do I store that result? On which stack?

Another question is, I want to use that DLL to validate a Serial Number, If NSIS is using the assembler stack is pretty easy for any programmer to run a debugger on the installer and check for the return value (no matter how complicated is the algorithm for the serial number) and return the correct number, is there any one out there how has solved this in a very secure way?

Thank you all for your answers
jherrera1976 is offline   Reply With Quote
Old 20th May 2004, 18:56   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
As specified in ExDLL.c and ExDLL.h, the fourth and last parameter for the plug-in function, on the stack, is a pointer to the NSIS stack head. The NSIS stack head is a pointer to stack_t structure which is defined in ExDLL.h. Translate that into your programming language and you'll be able to play with the NSIS stack.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 21st May 2004, 12:27   #7
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
Ok, just one question, I can't fully understand the following structure:

typedef struct _stack_t {
struct _stack_t *next;
char text[1]; // this should be the length of string_size
} stack_t;

the char part is ok, but I don't know what is the _stack_t, what is *next?

It is a pointer to something else? It is a pointer to another structure?

Thank you very much
jherrera1976 is offline   Reply With Quote
Old 21st May 2004, 12:32   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
next is a pointer to another stack_t. _stack_t is the name of the structure. See the popstring and pushstring functions for examples of how to use this structure.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 21st May 2004, 12:33   #9
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
I think I have it know, it is a pointer to the same structure to get the following value, right?

thx, I will post my code when I finish to everyone else in case is helpfull to others in the same situation.
jherrera1976 is offline   Reply With Quote
Old 21st May 2004, 12:38   #10
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
thx man, your help and the rest of the people here is tremendous, I thougth that our community (clarion news groups) was the only one with helping people

again, thx
jherrera1976 is offline   Reply With Quote
Old 24th May 2004, 13:02   #11
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
Well, I have the plugin working now, do you want me to post the use of the stack an all the necessary stuff directly here? Or should I put the files on other places?

The generated plugin with all the runtimes linked in is, at least 270Kb, I know, it is big but there is no way to make it smaller

Just le me know what do you want me to do.
jherrera1976 is offline   Reply With Quote
Old 24th May 2004, 13:44   #12
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Well... is a DLL; you can try UPX


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 24th May 2004, 14:07   #13
jherrera1976
Junior Member
 
Join Date: May 2004
Posts: 7
very good! it is 112kb now, not so small as the ones made with vc++ but...
jherrera1976 is offline   Reply With Quote
Old 24th May 2004, 21:23   #14
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
You can get rid of Debug stuff, and you can include LIBCTINY.LIB in your project (you can search for it on the net).

My Wiki Pages

Working now on:
New projects. (language: any)
deguix 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