marcel-slip
26th February 2009 09:36 UTC
Call Function from DLL witch returns True or False
Hello,
I have a library. Dll file that has the function of checking the key in the registry. Library returns the value true or false. Can this somehow be supported by NSIS?
Here is an code with InstallShield:
prototype BOOL werk.werk();
prototype NUMBER werk.WriteToReg(POINTER, POINTER, POINTER);
prototype NUMBER werk.CreateRegKey();
function BOOL VerifySerial()
STRING szFileName;
  NUMBER nResult;
  BOOL bVerified;
begin 
  szFileName = SUPPORTDIR ^ "some.dll";
  nResult = UseDLL(szFileName);
  if (nResult=0) then
   bVerified = some.some();
  else         
   bVerified = FALSE;
   MessageBox(@MSG_DLLERROR, INFORMATION);
  endif;
  nResult = UnUseDLL(szFileName);
 
  return bVerified;
end;
Afrow UK
26th February 2009 11:12 UTC
Call it with the System plug-in.
Edit: Or convert it to an NSIS plug-in.
Or write the code in NSIS.
Stu
marcel-slip
26th February 2009 12:01 UTC
Thank you for your reply.
I don't know how to do this. I do not have access to the source libraries and at the worst I have enough time to perform;)
Any example?
Afrow UK
26th February 2009 12:11 UTC
There are many many examples of the 3 options I have outlined. You will find them here, on the Wiki and with your NSIS installation.
Stu
marcel-slip
27th February 2009 09:07 UTC
Hello
I'm not as good with nsis-a. I tried to do is this:
Function some
SetOutPath c:\temp
File test.dll
System::Call 'test.dll::work() b(r0)'
DetailPrint 'Path: "$0"'
Dumpstate::debug ;test variable
FunctionEnd
Anders
27th February 2009 09:18 UTC
there is no such thing as b, you need to read the system plugin readme, you can't just make up types!
the windows BOOL type is 4 bytes, use i
the c++ bool type is 1 byte
marcel-slip
27th February 2009 10:22 UTC
Thank you very much for your help.
The following function works:
Quote:
Function werk SetOutPath c:\temp File test.dll System::Call 'test.dll::work() i() .r3' FunctionEnd The $3 is the state of 0-folse or 1-true |