WINAMP.COM | Forums > Developer Center > NSIS Discussion > CustomLicense plug-in |
Last Thread
Next Thread
|
| Author |
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
CustomLicense plug-in
Introducing my new plugin. It loads a text file into a static buffer, then can set that text into a text or label control that has a HWND. I have already made a wiki page, the link is below. __________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
Found out last week I have 3 weeks holiday, not 2 __________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
I will take a look at it. I used the first method I found which was malloc and free, because that what the system plugin uses. __________________ |
||
|
|
|
SuperPat Senior Member
Registered: Mar 2006 |
Very Good. |
||
|
|
|
Joel Debian user (Forum King)
Registered: Jan 2003 |
Well... I saw your source code. Is nice and clean, but I found some things that you might want to check: According to msdn, when CreateFile fails, it returns INVALID_HANDLE_VALUE and as I remember is not zero. I don't think that's possible, you loose data and always will be true , maybe lstrcmp.
__________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
Yeah, I will change it to say: __________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
I have modified the plugin again, and now it has just one function called 'LoadFile'. Usage: code: The actual plugin will probably be out on Monday next week. @Joel: I had a go at the EM_STREAMIN, but I had no idea on how it is supposed to work. I kept getting errors when I ran the test installer, and it is because it can't understand '->'. I first tried '.', but it gave me an error and told me to use '->'. It crashed at (example): struct->structmember = FileName. So I stayed with my current configuration. __________________ |
||
|
|
|
Afrow UK Moderator
Registered: Nov 2002 |
Shouldn't: __________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
True. I just have used installoptions passively with MUI and ISUI. Updated version is out. Go to the wiki page above to download. __________________ |
||
|
|
|
Takhir Major Dude
Registered: Feb 2004 |
Your dll still depends on msvcrt.dll. You can easy change malloc-free to kernel.dll GloballAlloc-GlobalFree (Requires Windows 95 or later). |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
I suppose that is an innocent change to make. I will change it tonight. New version out tomorrow. __________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
Well, I shouldn't get ahead of myself. I now have a small problem. There are now four weird characters at the end of the string after the text has been set in the control. If I take one byte off the number of bytes to read, it gets rid of the weird characters and chops off one byte off the string (a fullstop in my case). __________________ |
||
|
|
|
Afrow UK Moderator
Registered: Nov 2002 |
Yep, always make sure you put one on yourself: \0 __________________ |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
OK, will do. New version due out on Monday (really). __________________ |
||
|
|
|
Takhir Major Dude
Registered: Feb 2004 |
The only comment in the script sample I wrote long ago is about terminating zero |
||
|
|
|
JasonFriday13 Senior Member
Registered: May 2005 |
Surprisingly, that example is almost exactly the same as the internals of my plugin __________________ |
||
|
|
|
kfank Junior Member
Registered: Jan 2008 |
It appears that if the file path argument is >= 64 characters then the function does not work. Initial debugging of DLL seemed to show that the file argument was in fact getting passed in and parsed (the correct file was opened and read) but perhaps return from DLL is failing? |
||
|
|
|
kfank Junior Member
Registered: Jan 2008 |
Well, it's quite obvious that the stack variables are only allocated 64 bytes in the DLL. This length is too short if the file passed in is in the $PLUGINSDIR. I will post a DLL with larger buffer unless JasonFriday13 wants to. |
||
|
|
|
Afrow UK Moderator
Registered: Nov 2002 |
You are given the buffer length as one of the NSIS plug-in function arguments which you can use to allocate memory with LocalAlloc or GlobalAlloc. __________________ |
||
|
|
|
Last Thread Next Thread
|
WINAMP.COM | Forums > Developer Center > NSIS Discussion > CustomLicense plug-in |
Forum Rules:
|