Currently we are using "Internet::GetLocalHostIP ${ip_addr}" to get the local host IP and using the IP for registering the application.
But to handle hosts with multiple NIC card, we are planing to use the FQDN(Fully Qualified Domain Name) instead of the ip address.
Is there any way to get the FQDN of the localhost using NSI script? Any other known workaround?
- Bhupen
How to get FQDN using NSIS Script
7 posts
may be we can get the fqdn by appending domain name after hostname. how to get the hostname? any available plugin?
I believe you want to use the getnameinfo win32 api call for this.
http://msdn.microsoft.com/en-us/library/ms738532%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms738532%28VS.85%29.aspx
... Ignore the Other Zinthose he is a newb.. use this instead.
!ifndef GetFQDN
!ifmacrondef _GetFQDN
!define GetFQDN "!insertmacro _GetFQDN"
!macro _GetFQDN _RetVar
!ifdef __UNINSTALL__
Call un.GetFQDN
!else
Call GetFQDN
!endif
!if ${_RetVar} != s
Pop ${_RetVar}
!endif
!macroend
!ifdef __UNINSTALL__
!define Uninst_ "un."
!else
!define Uninst_ ""
!endif
Function ${Uninst_}GetFQDN
!undef Uninst_
## This Function uses the GetNetworkParams Win32 API function.
## Additional details are available at:
## http://msdn.microsoft.com/en-us/library/aa365968%28VS.85%29.aspx
ClearErrors
Push $1
Push $0
Push $2
## Get the required buffer size
System::Call "*(&i4 0)i .r0"
System::Call 'Iphlpapi::GetNetworkParams(i 0, i r0)i.r1'
StrCmp $1 111 BufferOkay
SetErrors
StrCpy $1 ""
Goto CleanUp_End
BufferOkay:
## Allocate Buffer
System::Call '*$0(i .r1)'
System::Alloc $1
Pop $2
## Populate Buffer with Data
System::Call 'Iphlpapi::GetNetworkParams(i $2, *i $1)i.r1'
StrCmp $1 0 DataOkay
SetErrors
StrCpy $1 ""
Goto CleanUp
DataOkay:
## Success, lets build the FQDN from the data
System::Call '*$2(&t132 .r3,&t132 .r4)'
StrCpy $1 "$3.$4"
CleanUp:
System::Free $2
CleanUp_End:
System::Free $0
Pop $2
Pop $0
Exch $1
FunctionEnd
!endif
!endif
Section
${GetFQDN} $0
DetailPrint $0
SectionEnd Thanks Zinthose. The wiki was of great help.
I need to use few of the IpConfig plugin APIs(like GetHostName, GetPrimaryDNSSuffix, GetAllNetworkAdaptersIDs, GetEnabledNetworkAdaptersIDs, GetNetworkAdapterIPAddresses etc.). But looks like IpConfig plugin is not working properly(I am trying with windows XP).
Please help.
I need to use few of the IpConfig plugin APIs(like GetHostName, GetPrimaryDNSSuffix, GetAllNetworkAdaptersIDs, GetEnabledNetworkAdaptersIDs, GetNetworkAdapterIPAddresses etc.). But looks like IpConfig plugin is not working properly(I am trying with windows XP).
Please help.
Looks like you already found the IPConfig Plugin Forum Topic
Listen To MSG he has the answer ;-)
Listen To MSG he has the answer ;-)
Just to clarify that is the NSIS\Plugins dir were you have NSIS installed.Originally Posted by MSG View PostThe dll should be in NSIS\Plugins, not $INSTDIR\plugin.