Could you help me with creating Serial Check Function that bases on DLL file? Unfortunately I do not have Function Prototype.
What I have is NSIS version of the function:
SetOutPath $PLUGINSDIR
File "serialtest.dll"
System::Call "serialtest::_sn_serialtest(t r1) i .r2 ?u"
${If} $2 == 0
Messagebox MB_OK|MB_ICONSTOP \
"Invalid Serial Number!"
Abort
${Endif}
t
- text, string (LPCSTR, pointer to first character)
r1-r9
- these are $1-$9 for NSIS (can be input or output). In this case r1 is $1 and $1 is Serial Number with delimiters '-'.
i
- int (includes char, byte, short, handles, pointers and so on)
.
- means no input
u
- unload DLL
Additional info: NSIS Script is written in ANSI and I am using Unicode version of Inno Setup.
If possible, Serial Number should be imported from Edit Boxes - I have asked a question regarding Custom Serial Page here: CustomPage for Serial Number in Inno Setup
I don't know NSIS at all, so the following is just an attempt of the script interpretation:
serialtest::_sn_serialtest(t r1) i .r2 ?u
I understand like this:
serialtest.dll - is the library, where the function is imported from
t - the input string typed as LPCSTR
i - integer result put into the no input variable (so just output variable)
So your prototype might looked like this:
int _sn_serialtest(
__in LPCSTR sn
);
What am I missing here is some calling convention notation, so the following prototype might not work, if you know that the library were written in C (what are most of the NSIS plugins as I've Googled), then it's probably cdecl, like below, but it's just my guess, it might be different:
function _sn_serialtest(sn: AnsiString): Integer;
external '_sn_serialtest@files:serialtest.dll cdecl';