Je ne sais pas si je poste au bon endroit, donc je m'excuse d'avance si ce n'est pas le cas.
Voici mon problème...
Je fais planter violemment Domino sur un Windows 2008 64 bits (et 32 bits aussi, à priori)... Quand je dis violemment, c'est violent car c'est de l’instantané !
J'ai repéré la ligne qui génère le plantage.
En fait, c'est dans une fonction récupérant l'adresse ip de la machine courante. Elle a été récupéré sur Internet (notes.net probablement) il y a des années et n'a jamais posé de soucis.
Voici les déclarations :
- Code : Tout sélectionner
Type HOSTENT
hName As Long
hAliases As Long
hAddrType As Integer
hLen As Integer
hAddrList As Long
End Type
Type WSADATA
wVersion As Integer
wHighVersion As Integer
szDescription(0 To MAX_WSADescription) As Long
szSystemStatus(0 To MAX_WSASYSStatus) As Long
wMaxSockets As Integer
wMaxUDPDG As Integer
dwVendorInfo As Long
End Type
Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long
Declare Function WSAStartup Lib "WSOCK32.DLL" (Byval wVersionRequired As Long, lpWSADATA As WSADATA) As Long
Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
Declare Function gethostname Lib "WSOCK32.DLL" (Byval szHost As String, Byval dwHostLen As Long) As Long
Declare Function gethostbyname Lib "WSOCK32.DLL" (Byval szHost As String) As Long
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, Byval hpvSource As Long, Byval cbCopy As Long)
Const MAX_WSADescription = 256
Const MAX_WSASYSStatus = 128
Const ERROR_SUCCESS = 0
Const WS_VERSION_REQD = &H101
Const WS_VERSION_MAJOR = WS_VERSION_REQD \ &H100 And &HFF&
Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF&
Const MIN_SOCKETS_REQD = 1
Const SOCKET_ERROR = -1
Voici le code (épuré) :
- Code : Tout sélectionner
Function GetIPAddress() As String
Dim sHostName As String * 256
Dim lpHost As Long
Dim HOST As HOSTENT
Dim dwIPAddr As Long
Dim tmpIPAddr() As Long
Dim i As Integer
Dim sIPAddr As String
Dim sess As New NotesSession
Dim db As NotesDatabase
Set db = sess.currentDatabase
On Error Goto fin
If Not SocketsInitialize() Then
GetIPAddress = ""
Exit Function
End If
If gethostname(sHostName, 256) = SOCKET_ERROR Then
GetIPAddress = ""
Msgbox "Windows Sockets error " & Str$(WSAGetLastError()) & _
" has occurred. Unable to successfully get Host Name."
SocketsCleanup
Exit Function
End If
sHostName = Trim$(sHostName)
lpHost = gethostbyname(sHostName)
If lpHost = 0 Then
GetIPAddress = ""
Msgbox "Windows Sockets are not responding. " & _
"Unable to successfully get Host Name."
SocketsCleanup
Exit Function
End If
CopyMemory HOST, lpHost, Len(HOST)
CopyMemory dwIPAddr, HOST.hAddrList, 4
Redim tmpIPAddr(1 To HOST.hLen)
CopyMemory tmpIPAddr(1), dwIPAddr, 4
sIPAddr = Hex$(sIPAddr & tmpIPAddr(1))
Dim Address_IP As String
Address_IP = HextoDec(sIPAddr)
GetIPAddress = Address_IP
SocketsCleanup
Exit Function
fin :
Msgbox db.filepath + " GetIpAdress : " + Str$(Err) + " ( ligne "+ Str$(Erl) + " ):" + Error
Exit Function
End Function
Et la ligne qui provoque le plantage :
- Code : Tout sélectionner
CopyMemory dwIPAddr, HOST.hAddrList, 4
Via des msgbox, je peux dire que dwIPAddr=0 et que HOST.hAddrList=0
alors que sur Windows 2003, dwIPAddr=0 et que HOST.hAddrList=12521520 (chiffre mis au hasard).
Donc, je pense que la question est pourquoi HOST.hAddrList=0 sur un Windows 2008 64 bits (ou 32 bits)...
Est-ce que quelqu'un aurait une idée pour résoudre ce (gros) problème...
Un grand merci d'avance pour toute l'aide qui pourra nous être apportée...