Hello!
I need to create plugin for NSIS installer using Delphi. I can't use C/C++, because some of the code is already Delphi-written in secondary project. I used manual - NSIS\Examples\Plugin\nsis.pas. Can someone explain me this part of implementation code?
For example, I call this function: NSIS_Call('MyBestFunctionInScript').
But, "MyBestFunctionInScript" (value of "codeoffset") will be converted at 0 always (why StrToIntDef?). Maybe need to remove StrToIntDef on other function?
In C-example I find this interface (maybe it's normal working convertion string function name at codeoffset):
But, I can't find an implementation. Can anyone help me? Big thanks.
I need to create plugin for NSIS installer using Delphi. I can't use C/C++, because some of the code is already Delphi-written in secondary project. I used manual - NSIS\Examples\Plugin\nsis.pas. Can someone explain me this part of implementation code?
PHP Code:
function Call(NSIS_func : String) : Integer;
var
codeoffset: Integer; //The ID of nsis function
begin
Result := 0;
codeoffset := StrToIntDef(NSIS_func, 0);
if (codeoffset <> 0) and (g_extraparameters <> nil) then
begin
codeoffset := codeoffset - 1;
Result := g_extraparameters.exec_code_segment(codeoffset, g_hwndParent);
end;
end;
But, "MyBestFunctionInScript" (value of "codeoffset") will be converted at 0 always (why StrToIntDef?). Maybe need to remove StrToIntDef on other function?
In C-example I find this interface (maybe it's normal working convertion string function name at codeoffset):
PHP Code:
INT_PTR NSISCALL nsishelper_str_to_ptr(LPCTSTR s);
#define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer
Comment