Changeset 11 for trunk/SunriseChatNetworkCoreUnit.pas
- Timestamp:
- Feb 11, 2008, 11:18:05 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SunriseChatNetworkCoreUnit.pas
r9 r11 7 7 Forms, StdCtrls, ExtCtrls, SunriseChatCoreUtils, DateUtils, SunriseChatCoreUnit, 8 8 cWindows, cSockets, cSocketsUDP, cTCPClient, cTCPServer, cUtils, WinSock, 9 cWinSock, Registry ;9 cWinSock, Registry, UEthernetAddress; 10 10 11 11 const … … 192 192 var 193 193 I, II: Integer; 194 PnpInstanceID: string; 195 Buf: string; 194 Status: Cardinal; 195 AdaptersList : array of IP_ADAPTER_INFO; 196 BufSize: Cardinal; 196 197 IPParts: TArrayOfString; 197 198 SubnetParts: TArrayOfString; 198 199 NewNetworkInterface: TNetworkInterface; 199 Status: Cardinal; 200 AdaptersList : array of IP_ADAPTER_INFO; 201 BufSize: Cardinal; 202 begin 203 // Clear list 204 for I := 0 to NetworkInterfaces.Count-1 do 200 201 function IpListToStr(pIpAddr : PIP_ADDR_STRING) : String; 202 begin 203 Result := ''; 204 repeat 205 Result := Result + ', ' + Pchar(Addr(pIpAddr^.IpAddress)); 206 pIpAddr := pIpAddr.Next; 207 until pIpAddr = nil; 208 Delete(Result, 1, 2); 209 if Result = '' then Result := 'none'; 210 end; 211 212 begin 213 for I := 0 to NetworkInterfaces.Count - 1 do 205 214 TNetworkInterface(NetworkInterfaces[I]).Free; 206 215 NetworkInterfaces.Clear; 216 207 217 if Win32Platform > 1 then begin 218 // Windows NT/2000/XP/Vista 208 219 BufSize := 0; 209 220 Status := GetAdaptersInfo(@AdaptersList[0], BufSize); … … 213 224 NewNetworkInterface := TNetworkInterface.Create(Self); 214 225 with NewNetworkInterface do begin 215 // IPAddress := CurrentIpAddress^.IpAddress.s;216 // SubNetMask := CurrentIpAddress^.IpMask.s;217 226 IPAddress := IpAddressList.IPAddress.S; 218 227 SubNetMask := IpAddressList.IPMask.s; 219 228 GUID := AdapterName; 220 (*221 II := MAX_ADAPTER_DESCRIPTION_LENGTH;222 while Description[II] = #0 do Dec(II);223 SetLength(Name, II);224 Move(Description[0], Name[1], Length(Name));225 *)226 229 Name := Description; 227 230 SubnetParts := Explode('.', SubNetMask); … … 233 236 NetworkInterfaces.Add(NewNetworkInterface); 234 237 end; 235 end else begin236 // For Windows 9x compatibility238 end else begin 239 // Windows 95/98/Me 237 240 for I := 0 to High(LocalIPAddressesStr) do begin 238 241 NewNetworkInterface := TNetworkInterface.Create(Self);
Note:
See TracChangeset
for help on using the changeset viewer.