View Single Post
Old 4th September 2008, 17:36   #33
Junior Member
rbchasetfb's Avatar
Join Date: Sep 2008
Posts: 15
claesabrandt, I think I fixed the need for passing the number of parameters. In the Call function in your code, replace the num params and params sections with the following code and add the itreplace function above the Call function in the code.
Here's the code to replace in the Call function:
PHP Code:
    // params
string sargs string(buf);
string separator string(",");
std::string::size_type start 0
std::string::size_type end 0
    while ((
end=sargs.find (separatorstart)) != std::string::npos
string tmp sargs.substr(startend-start);
start end+separator.size(); 
string tmp sargs.substr (start);
Basically, this code performs a split function on the string popped of the stack and adds each split-off element to the args vector, performing a replace of the single quotes along the way.

Here's the itreplace function:
PHP Code:
void itreplace(string &source, const string findstring replace
size_t j;    
    for ( ; (
source.findfind )) != string::npos ; ) 
source.replacejfind.length(), replace );    

Then, in the NSIS project, do the plugin call this way:
PHP Code:
CLR::Call "Somedotnet.dll" "namespace.class" "TestFunction" "Testing String, 35.56, true" 
OR...the code has the provision to do it this way with single quotes around strings to be visually clean:
PHP Code:
CLR::Call "Somedotnet.dll" "namespace.class" "TestFunction" "'Testing String', 35.56, true" 
You can also leave the spaces out after the commas in the parameter list if you like.

On the issue of the strange results from my test scenario's I wrote about earlier, I've even tried the tests on other machines and get the same results. My last test runthrough was on a Windows 2003 Server with only .net 2.0 installed. For now, I'll live with the stay-behind dll file and use the VS2005 compiled one with the changes above.

Thanks again. Let me know if you find any bugs in the above code.
rbchasetfb is offline   Reply With Quote