Archive: Call Function from DLL witch returns True or False


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;

Call it with the System plug-in.

Edit: Or convert it to an NSIS plug-in.
Or write the code in NSIS.

Stu


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?


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


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


I do not see any effect, the variable 0 has no value assigned

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


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