![]() |
.Net DLL and System.Call
1 Attachment(s)
I have a .net VB dll containing a function that returns a list of sql servers as a string but i cant get nsis to return the value from it although i know the function works having tested it in a .net windows application. Below is my NSI code and my DLL code. Any help would be appreciated.
NSI ################################# Name "SQLServerCheck" OutFile "SQLServerCheck.exe" !include "${NSISDIR}\Examples\System\System.nsh" Section "dummy" System::Call 'Utils::GetServerList()' Pop $0 Pop $1 DetailPrint $0 DetailPrint $1 SectionEnd VB .Net Code ############################# Public Class Utils Public Shared Function GetServerList() As String Dim oApp As New SQLDMO.Application Dim i As Integer Dim s As String s = "" For i = 0 To oApp.ListAvailableSQLServers.Count If Not oApp.ListAvailableSQLServers.Item(i) Is Nothing Then s += oApp.ListAvailableSQLServers.Item(i).ToString & " " End If Next s = Trim(s) oApp = Nothing Return s End Function Public Shared Function GetDatabaseList(ByVal server As String, ByVal username As String, ByVal password As String) Dim oServer As New SQLDMO.SQLServer Try oServer.Connect(server, username, password) Dim i As Integer Dim s As String s = "" For i = 1 To oServer.Databases.Count s += oServer.Databases.Item(i).Name & " " Next s = Trim(s) oServer.DisConnect() oServer = Nothing Catch oServer = Nothing End Try End Function End Class |
You can't call .NET exported functions, only non-managed functions. That is, only functions that are shown with Dependency Walker.
|
| All times are GMT. The time now is 04:58. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.