Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 8th September 2008, 10:50   #41
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Hmm, I now even tried compiling a C++ Win32 DLL without any .NET. This is only code from exdll.c and exdll.h. It does not run on the machine that my .NET plugin could not run on. Anyony any ideas?
claesabrandt is offline   Reply With Quote
Old 9th September 2008, 08:42   #42
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
I finally found the problem! My CLR.dll must be compiled in release mode and the system onto which the installer is going to run must have the MS Visual C++ 2008 Redist package installed, which can be included in the installer.

I will release a new version of the zip file (v0.4). Could you test it for me rbchasetfb, so we can verify that the problem is fixed? If you want to use the 2005 edition of the redist, you can just compile the CLR.dll with VS2005 instead.

Would there be a greater wish for having it use the 2005 redist as default instead?

Last edited by claesabrandt; 9th September 2008 at 09:01.
claesabrandt is offline   Reply With Quote
Old 9th September 2008, 09:55   #43
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Just uploaded version 0.5 which is compiled with Visual Studio 2005, release mode. The need for MS Visual C++ 2008 Redist is now eliminated, in fact, it seems the 2005 redist is not needed either - just the .NET 2.0 framework. Thanks goes to rbchasetfb for great input.
claesabrandt is offline   Reply With Quote
Old 10th September 2008, 20:22   #44
rbchasetfb
Junior Member
 
rbchasetfb's Avatar
 
Join Date: Sep 2008
Posts: 15
claesabrandt, very cool that we got through that one. Thanks for sticking with it too. As a thanks, I thought I would post some code that I use in my .NET dll that CLR.dll is calling. It allows the functions in the .NET dll to update the Details list during the install without have to wait to return to the installer and then do a DetailPrint call with some funky string work. The code is in VB.NET, but could easily be converted to C#. The error handling is a little brute force in the MakeLogEntry function, it just ignores the error and returns, potentially writing nothing to the Details list. Non-the-less, very useful I think.

VB.NET Code Required:
PHP Code:
Imports System
Imports System
.Runtime.InteropServices
Imports System
.Threading
Imports System
.IO
Imports System
.Windows.Forms

Namespace NSIS

    
Public Class TestClass

        
//LVITEM Structure Declaration.
        
<StructLayout(LayoutKind.Sequential)> _
        
Public Structure LVITEM
            
Public mask As Int32
            
Public iItem As Int32
            
Public iSubItem As Int32
            
Public state As Int32
            
Public stateMask As Int32
            
Public pszText As String
            
Public cchTextMax As Int32
            
Public iImage As Int32
            
Public lParam As IntPtr
        End Structure

        
//SendMessage API declarations.
        
Public Declare Function SendMessageLV Lib "user32" Alias _
          
"SendMessageA"(ByVal hwnd As IntPtr_
                         ByVal wMsg 
As Int32_
                         ByVal wParam 
As Integer_
                         ByRef lParam 
As LVITEM) As Integer
        
Public Declare Function SendMessage Lib "user32" Alias _
          
"SendMessageA"(ByVal hwnd As IntPtr_
                         ByVal wMsg 
As Int32_
                         ByVal wParam 
As Integer_
                         ByRef lParam 
As Integer) As Integer                

        
//Constants used by LVITEM and SendMessage
        
Public Const LVM_FIRST as Integer = &H1000 
        
Public Const LVM_GETITEMCOUNT as Integer LVM_FIRST 4
        
Public Const LVM_GETITEM as Integer LVM_FIRST 5
        
Public Const LVM_INSERTITEM as Integer LVM_FIRST 7
        
Public Const LVM_SCROLL as Integer LVM_FIRST 20
        
Public Const LVIF_TEXT as Integer = &H0001
        
Public Const LVIS_FOCUSED as Integer = &H0001

        
//Test function for calling from an NSIS installer using CLR.dll
        
Public Function ChopString_
                ByVal hwnd 
as IntPtr_
                ByVal stringToChop 
as String_
                ByVal chopToLength 
as Integer) As String
            Dim ret 
as String ""
            
If stringToChop.Length chopToLength Then
                MakeLogEntry
(hwnd"Chopping String '" stringToChop "'.")
                
ret stringToChop.SubString(0,chopToLength)
                
MakeLogEntry(hwnd"String chopped to '" ret "'.")
            Else
                
MakeLogEntry(hwnd"String '" _
                    stringToChop 
_
                    
"' to short to chop to length '" _
                    chopToLength 
"'.")
            
End If
            Return 
ret
        End 
Function

        
//Here's the key function that writes to the Details list.
        
Public Sub MakeLogEntry(ByVal hwnd As IntPtrentry as String)
            Try
                
//Get current list count
                
Dim c as Integer SendMessage(hwnd,LVM_GETITEMCOUNT,0,0)+1
                
//Setup a LVITEM structure for the Insert message
                
Dim lv As New LVITEM
                lv
.iItem c
                lv
.pszText entry
                lv
.mask LVIF_TEXT
                lv
.stateMask LVIS_FOCUSED
                lv
.state LVIS_FOCUSED
                
//Insert the LVITEM into the list
                
SendMessageLV(hwndLVM_INSERTITEM0lv)
                
//Scroll the list so the item is visible
                
SendMessage(hwnd,LVM_SCROLL,0,12)
            Catch 
ex As Exception
                
'Do Nothing, just return
            End Try
        End Sub

    End Class

End NameSpace 
NSIS Code with CLR.dll call to test with:
PHP Code:
Name "Test CLRDLL MakeLogEntry"
OutFile "TestCLRDLL.exe"
ShowInstDetails show
Var DetailsHWND
Page instfiles

Section
    DetailPrint 
"Starting Test"
    
InitPluginsDir
    SetOutPath $PLUGINSDIR
    File 
"TestCLRDLL.dll"
    
FindWindow $"#32770" "" $HWNDPARENT
    GetDlgItem $DetailsHWND 
$0 1016
    CLR
::Call "TestCLRDLL.dll" \
        
"NSIS.TestClass" \
        
"ChopString" \
        
\
        
$DetailsHWND "Testing Make Log Entry" 9
    Pop 
$0
    DetailPrint 
"ChopString Result = $0"
    
DetailPrint "Test Complete"
SectionEnd 
Lastly, I've attached a zip file of the TestCLRDLL.dll project for VS2005 and included the TESTCLRDLL.nsi as will. Enjoy. I hope it's as useful for use as it is for me.
Attached Files
File Type: zip testclrdll.zip (75.8 KB, 588 views)
rbchasetfb is offline   Reply With Quote
Old 10th September 2008, 20:44   #45
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Weeeeeee I cannot say how enthusiastic I am that you post this sample. I really need this too. Cool stuff. Thanks so much

You should make a nsis wiki sample page with this. Would be very beneficial.
claesabrandt is offline   Reply With Quote
Old 10th September 2008, 20:57   #46
rbchasetfb
Junior Member
 
rbchasetfb's Avatar
 
Join Date: Sep 2008
Posts: 15
Glad you needed it...thought it would be handy. Will work on the wiki page over the next couple of days.
rbchasetfb is offline   Reply With Quote
Old 11th September 2008, 07:28   #47
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
You can use my old wiki page on the subject. The code in it is not valid anymore, and the explanation on how to make the CLR.dll is outdated and users should look in the source code for the CLR.dll plugin instead. It is located here: http://nsis.sourceforge.net/Calling_Managed_.Net_DLL_From_NSIS

You can just change the author and move the page to another name, that fits with your purpose. If you want I can make the initial posting for you. Or you can make a brand new page if you want to.
claesabrandt is offline   Reply With Quote
Old 11th September 2008, 08:31   #48
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
If anyone needs to convert that VB.NET code to C#, here is a useful link: http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx. When converted some minor ajustments needs to be made. I guess I could post the C# version when I get home tonight.

Btw rbchasetfb, I noticed in your sample that you call CLR::Call without /NOUNLOAD. I found that if you attempt to call CLR:Call again after that, the installer hangs. You must specify the /NOUNLOAD each time. Then when done, call CLR:: Destroy, for instance in .onGUIEnd (without the space but smileys are attacking me). For instance:
PHP Code:
CLR::Call /NOUNLOAD parameters...
CLR:: Destroy 
I will update the plugin wiki with this information.

Last edited by claesabrandt; 11th September 2008 at 08:56.
claesabrandt is offline   Reply With Quote
Old 11th September 2008, 15:36   #49
rbchasetfb
Junior Member
 
rbchasetfb's Avatar
 
Join Date: Sep 2008
Posts: 15
Thanks, claesabrandt, I'll get that page setup to on the wiki. I've also made the changes to the example. It is the way I'm using CLR.dll, just forgot to put it in the example. I've uploaded the new zip here until I get the wiki page done.
Attached Files
File Type: zip testclrdll.zip (75.7 KB, 563 views)
rbchasetfb is offline   Reply With Quote
Old 12th September 2008, 15:21   #50
rbchasetfb
Junior Member
 
rbchasetfb's Avatar
 
Join Date: Sep 2008
Posts: 15
Wiki Page For DetailPrint from Inside .NET DLL

The wiki page for DetailPrint from Inside .NET DLL is finally up. I've posted some modified source code and some other things of value along with it, including the complete VS2005 project for the TestCLRDLL.

http://nsis.sourceforge.net/DetailPrint_From_Inside_.NET_DLL

claesabrandt, maybe you can put a link to it on your NSIS wiki page as I've posted it to the Code Examples category since it's not really a plugin.

Enjoy.
rbchasetfb is offline   Reply With Quote
Old 13th September 2008, 01:45   #51
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Really nice article. I made a link to it from the plugin page.
claesabrandt is offline   Reply With Quote
Old 19th September 2008, 22:49   #52
indimini
Junior Member
 
Join Date: Sep 2008
Posts: 1
Clasesabrandt, thanks for putting this plugin together. It's turning into a life saver for me as I migrate from the Installer projects in VS 2008.

I've got my install actions from my VS 2008 installer ported over to use your plugin, but I'm stuck trying to figure out how to run a .NET method during uninstall. It seems like the DLL file used during installation is not available. Any thoughts or suggestions?
indimini is offline   Reply With Quote
Old 20th September 2008, 01:16   #53
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
If you need to perform some .NET call on uninstallation, I would keep a copy of the dll file in $INSTDIR, then when uninstalling I would copy that dll file to $PLUGINSDIR.
claesabrandt is offline   Reply With Quote
Old 24th September 2008, 17:27   #54
rbchasetfb
Junior Member
 
rbchasetfb's Avatar
 
Join Date: Sep 2008
Posts: 15
Improved Tokenizer

claesabrandt,

I found a solution to the need for passing the parameter count. When we talked before, I had implemented a parameter parser that didn't take into account commas in string parameters, well, I found the fix for that. Found a string tokenizer code module that allows you to spec the delimiters, constraining quotes that will cause delimiter to be ignored and a couple other cool options. To use this, replace the following code in NSIS_CLR_Loader.cpp:
PHP Code:
    // num params
    
popstring(buf);
    
int numparams atoi(buf);

    
// params
    
vector<stringargs;
    for (
int i=0i<numparamsi++)
    {
        
popstring(buf);
        
string tmp string(buf);
        
args.push_back(tmp);
    } 
With the following code:
PHP Code:
    // params
    
popstring(buf);
    
string sargs string(buf);
    
vector<stringargs;
    
    
tokenize (sargs,args,",","","\\\\'","\\\"); 
Add the following include directive:
PHP Code:
#include "tokenizer.h" 
Then add the code and header files from the attached zip file.

Lastly, the only catch I found is that when passing file paths, they need to have double backslashes. I'm sure there's a fix in the c++ code somewhere, just haven't found it yet. So I just modified my NSIS macro that calls CLR::Call to do a string replace of single backslashes with double backslashes.

Here's the CodeProject website that I found this tokenizer at.

http://www.codeproject.com/KB/stl/tokenizer.aspx

Enjoy.
Attached Files
File Type: zip tokenizer code.zip (3.5 KB, 489 views)
rbchasetfb is offline   Reply With Quote
Old 25th September 2008, 10:47   #55
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Very nice code you found there. However I prefer the current method as it keeps the parameter list cleaner and easier to read. Having them inside a single string is harder to read.

What do you think? Is it better to have all parameters in one string, or is it better to have them seperated?

Actually, I could just make an additional function with the tokenizer, so people can choose themselves Should I do that?
claesabrandt is offline   Reply With Quote
Old 27th October 2008, 07:27   #56
PeanutMocha
Junior Member
 
Join Date: Oct 2007
Posts: 3
I'm trying to use this plugin for the first time and get an error message:

Error calling .NET DLL method
Number of parameters does not match

I'm trying to call my C# method:

PHP Code:
public static bool LogTest(string eventSource
with a line of code like this:

PHP Code:
CLR::Call /NOUNLOAD Util.dll Util LogTest "Sample" 
and also tried this variant (unsure if I need to specify the number of parameters):

PHP Code:
CLR::Call /NOUNLOAD Util.dll Util LogTest "Sample" 
What am I doing wrong?

Thanks!
PeanutMocha is offline   Reply With Quote
Old 27th October 2008, 07:42   #57
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
You have to put the 1 before the parameter and it seems you are missing the namespace, should be something like this:
PHP Code:
CLR::Call /NOUNLOAD Util.dll SomeNamespace.Util LogTest 1 "Sample" 
claesabrandt is offline   Reply With Quote
Old 27th October 2008, 15:50   #58
PeanutMocha
Junior Member
 
Join Date: Oct 2007
Posts: 3
Thanks, putting the number of parameters first did the trick :-)

It might be worth updating the Wiki a bit to make the parameter passing scheme clearer. Reading through this thread, there have been a few iterations on how to pass parameters so something in the Wiki like:

CLR::Call /NOUNLOAD MyModule.dll My.Name.Space MyMethod [NumberOfParameters] [Parameter List]

Where [NumberOfParameters] is the integer number of parameters present

[Parameter List] is a list of string, float or integer parameters separated by space. String parameters must be enclosed in quotes.

Would make things a bit clearer to those new to NSIS and this plugin.
PeanutMocha is offline   Reply With Quote
Old 27th October 2008, 16:45   #59
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Did you read the wiki here: http://nsis.sourceforge.net/Call_.NET_DLL_methods_plug-in.
claesabrandt is offline   Reply With Quote
Old 28th October 2008, 19:06   #60
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
Could not load ...\CLR.dll

I am running into a situation where I am unable to load the CLR.dll on 3 out of 5 machines. I have checked the .Net Framework versions and have concluded that although there are some discrepancies, at least two of the failing machines match the Framework version of one of the machine which does work.

Is there an enhanced logging mechanism I can invoke to obtain more information relating to the inability to load the library?

When it works, I am in love with plugin. Thank you VERY much!

- SlyW

P.S. If you want my .nsi and .Net DLL, please ask.
SlyW is offline   Reply With Quote
Old 28th October 2008, 19:59   #61
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Hi SlyW. From your .NET dll, are you calling further into other .NET dlls?
claesabrandt is offline   Reply With Quote
Old 28th October 2008, 20:29   #62
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
None of my writing...

It is calling the System.Cryptography classes, but no other .NET DLLs of my creation.

I have attached complete source code to this message including the source of my encryption library.

Thanks!

-SlyW
Attached Files
File Type: zip nsis_source.zip (8.1 KB, 519 views)
SlyW is offline   Reply With Quote
Old 28th October 2008, 21:43   #63
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
SlyW, I am looking into it, but at the moment I am a bit clueless about it, as it sounds like NSIS can't load the plugin. I guess you don't have problems with other plugins on those machines? I am thinking of if you could try installing the Visual C++ 2005 redist on those machines. That should not be needed, but maybe you have found a scenario where it is needed. It is the CLR.dll it cannot find, right? Not your crypto dll.
claesabrandt is offline   Reply With Quote
Old 29th October 2008, 04:07   #64
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
I will try...

I will install the VC++ redist on one of the machines upon which the installer fails and let you know the progress. I would have done it already had I not been required to attend parent-teacher conferences.

Thanks for your excellent responses so far!
SlyW is offline   Reply With Quote
Old 29th October 2008, 17:30   #65
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
No luck. Installed the VC++ 2005 Redist on one of the XP machines with the same results. Could not load CLR.dll and the value popped was the name of the encryption DLL.
SlyW is offline   Reply With Quote
Old 30th October 2008, 11:28   #66
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Thanks for the testing. This sounds like a problem rbchasetfb encountered back in the beginning of september. Back then we fixed it by making sure the DLL was compiled using Visual Studio 2005 and not 2008, as it seems it fixed it then. But I will have to look further into why NSIS fails to load the DLL in some cases. My first tasks is to reproduce the error myself. I might ask additional questions of you, to reproduce your scenario.
claesabrandt is offline   Reply With Quote
Old 30th October 2008, 13:46   #67
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
Ask away! And I will see if I can get VS.NET C++ installed locally. I might try installing VS.NET C++ on one of the machines where it fails and see if it helps. I know that VS.NET is installed on all three failing machines, however, only the VB.NET and Web Developer components are installed.

If there are debug flags you want me to use, please do not hesitate to ask.
SlyW is offline   Reply With Quote
Old 30th October 2008, 21:43   #68
teiles
Junior Member
 
Join Date: Oct 2008
Posts: 2
My CLR.exe based DLL works on some machines and not others.

What I know:

Win XP SP2 w/.NET 2/3/3.5 works
Vista SP1 w/.NET 2/3/3.5 works
Win 2003 w/.NET 2/3/3.5 works
Win 2003 w/.NET 2 DOES NOT WORK
teiles is offline   Reply With Quote
Old 31st October 2008, 13:40   #69
rbchasetfb
Junior Member
 
rbchasetfb's Avatar
 
Join Date: Sep 2008
Posts: 15
I'll add some other successful test environments:

Win 2003 w/SP1 or SP2 and a minimum of .NET 2.0 SP1
Win XP SP2 with a minimum of .NET 2.0 SP1

The catch is the SP1 version of .NET 2.0. The CLR plugin on DotNET 2.0 without SP1 will not work on any of these environments. The reason your .NET 2/3/3.5 works is the .NET 3 and 3.5 installers install the .NET 2.0 SP1 patches. claesabrandt, that's why the VS2005 compiled CLR only works on this .NET 2.0 SP1 setup...because you have installed .NET 3 and/3.5.

To overcome this, I've added a prerequisites custom page to my installers, right after my license page, that checks for and downloads, installs/upgrades .NET 2.0 SP1 before any calls to the CLR plugin. I use the CLR plugin in custom pages after the components selection page. If this sequence doesn't work for you, you can put a .NET check-download-and-install into the .onInit. A recommended .onInit would do some conformance checks anyway, so here's a good order:

1. Check if installer is already running, if so abort
2. Check for local admin rights, if not, abort
3. Check for and Install IIS (if installing a web site on IIS)
4. Check for and Install .NET 2.0 SP1

It took me some time to figure this one out - and lots of VirtualMachine undo drive wipes - so I hope this saves you all some time.
rbchasetfb is offline   Reply With Quote
Old 31st October 2008, 14:08   #70
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
rbchasetfb, very very good. SlyW, could you please try installing .NET 2.0 SP1 on the machines that fail?
claesabrandt is offline   Reply With Quote
Old 31st October 2008, 15:50   #71
teiles
Junior Member
 
Join Date: Oct 2008
Posts: 2
I just installed the .NET 2.0 SP1 on the Win 2003 .NET 2.0 that was failing.

CLR.exe now WORKS!!!

Thanks --- Ted
teiles is offline   Reply With Quote
Old 31st October 2008, 17:39   #72
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Great! Thanks for the excellent testing SlyW and teiles. rbchasetfb, you are my hero again I have updated the wiki with the SP1 prerequisite. I assume that this is the solution to the problem. Let me know if not.
claesabrandt is offline   Reply With Quote
Old 1st November 2008, 19:12   #73
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
I will install SP1 on one or more of the failing machines and let you know the success/failure of each.

Thank you _all_ for making this a useful forum and an even more useful plugin!
SlyW is offline   Reply With Quote
Old 6th November 2008, 07:46   #74
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Now that we are at the issues. I have encountered an annoying thing and have a workaround for it. If you call a second custom .NET DLL from your first custom .NET DLL, you will run into an issue about the .NET framework cannot find the second DLL, even if you have placed both DLLs in the $PLUGINSDIR. Your second DLL is referenced in your first DLLs Visual Studio project.

The reason the second DLL cannot be found is that .NET looks for the DLL in the same directory as the calling process, which in this is case is the installer exe. You can make .NET look in a subdirectory of the calling process, but here comes the issue. Your installer will run from some location, and then it unpacks everything into a temp directory. From that directory it loads the first DLL by loading it into memory and then using reflection to scan the methods and properties, so the process does not have to look for the DLL. The second DLL is not loaded this way as it is referenced from the first DLL's project. Here I rely on that the .NET framework can find it, and as it was not unpacked in the installer's directory or subdirectory, I have not found a way to make .NET find it.

My workaround has been to make a second NSIS script that wraps my installer script and wraps the .NET DLLs needed in my installer script. These are unpacked to the temp directory together and when the second script is executed using Exec, the second installer will be the executing process and thus it can find the DLLs. When the second installer finishes, I delete the files again.

Although this works, it would be nice to have a "real" solution, where the .NET framework can actually find the second DLL. I have tried all kinds of things, googled for it etc. I have not yet found a solution to make .NET look for a DLL in another directory other than where the calling process is run from or subdirectories of that. If anyone have ideas, let's see if we can find a better solution.

A note: One should not unpack the DLLs in the same directory as the installer, as the installer might be run from a CD-Rom or other readonly media.

A second note: One could use reflection, like how the first DLL is loaded, to load the second DLL. But this as two drawbacks: 1) Using reflection, there will be a weak binding between your DLLs and you will not have code completion in your project when trying to call things in the second DLL. 2) You would have to use reflection again if trying to call a third or fourth DLL.

Regards Claes
claesabrandt is offline   Reply With Quote
Old 10th November 2008, 03:54   #75
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
Success! I have successfully run the sample installer on a machine _after_ installing SP1. Now, to make SP1 a pre-req for installing our app.

Thanks again for all your help (to everyone)!

BTW: Do we dare ask what SP1 brings to the table that suddenly enables this functionality?
SlyW is offline   Reply With Quote
Old 17th November 2008, 16:34   #76
SlyW
Junior Member
 
Join Date: Apr 2004
Posts: 9
Found additional error messages

I just happened to be perusing the Event Viewer on a machine where the CLR.dll failed to load and discovered the following three entries:

Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced assembly is not installed on your system.

Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The referenced assembly is not installed on your system.

Generate Activation Context failed for C:\DOCUME~1\USERSL~1\LOCALS~1\Temp\nsy57D.tmp\CLR.dll. Reference error message: The operation completed successfully.

So, apparently SP1 somehow brings Microsoft.VB80.CRT into the fold?
SlyW is offline   Reply With Quote
Old 28th March 2009, 05:54   #77
AuGuS666
Junior Member
 
Join Date: Jun 2008
Posts: 6
Class Property

Hi and thx for watching this:

Calling the method "SayHi" from my c# dll works fine, but the set_MyProperty method to setting the public property "name" dont work for me, here is my simple C# class:
PHP Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace 
DllTest{

    public class 
greeting{

      private 
string m_strname;

      public 
greeting() {
      }

      public 
string SayHi(){
        return 
"hi " name;

      }

        public 
string name{
            
get { return m_strname; }
            
set m_strname value; }
        }
    }

And this is my nsis source:

PHP Code:
Section 
SetOutPath $PLUGINSDIR
File 
"DllTest.dll"
        
CLR::Call /NOUNLOAD DllTest.dll DllTest.greeting set_name 1 "augus666"
        
CLR::Call /NOUNLOAD DllTest.dll DllTest.greeting SayHi 0
        pop 
$0
        detailprint 
$0
        CLR
:: Destroy

SectionEnd 
I did compilated my DllTest.dll on DEBUG, RELEASE, with Framework 2 SP1, i did try with VS Net 2005 and VS Net 2008 classes, Windows Xp SP3 Pc's and nothing yet (btw the get_ method works).

Thx for replays
AuGuS666 is offline   Reply With Quote
Old 28th March 2009, 06:24   #78
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
What error do you experience?
claesabrandt is offline   Reply With Quote
Old 28th March 2009, 15:56   #79
AuGuS666
Junior Member
 
Join Date: Jun 2008
Posts: 6
Re: Class Property

I cant change the value of the property with the _setMyProperty method
AuGuS666 is offline   Reply With Quote
Old 24th June 2009, 09:11   #80
claesabrandt
Member
 
claesabrandt's Avatar
 
Join Date: Aug 2008
Location: Denmark
Posts: 54
Sry for the delay. I have to look into this. I suspect it could have something to do with the internal variable not keeping the value between the calls. I am not sure how NSIS manages the memory when using NOUNLOAD on the calls. I thought the variables would keep their values. However, for now you must keep values in the NSIS script and pass them to the methods when needed.
claesabrandt is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump