(Co-Admin)
Registriert seit: 29. Mai 2002
Ort: Hamburg
11.116 Beiträge
Delphi 11 Alexandria
|
11. Sep 2002, 13:27
Moin Thurgen,
hier mal ein wenig Übersetzung:
Code:
const
MAX_ADAPTER_DESCRIPTION_LENGTH = 128; // arb.
MAX_ADAPTER_NAME_LENGTH = 256; // arb.
MAX_ADAPTER_ADDRESS_LENGTH = 8; // arb.
DEFAULT_MINIMUM_ENTITIES = 32; // arb.
MAX_HOSTNAME_LEN = 128; // arb.
MAX_DOMAIN_NAME_LEN = 128; // arb.
MAX_SCOPE_ID_LEN = 256; // arb.
// aus ipifcons
MIB_IF_TYPE_OTHER = 1;
MIB_IF_TYPE_ETHERNET = 6;
MIB_IF_TYPE_TOKENRING = 9;
MIB_IF_TYPE_FDDI = 15;
MIB_IF_TYPE_PPP = 23;
MIB_IF_TYPE_LOOPBACK = 24;
MIB_IF_TYPE_SLIP = 28;
type
PIP_ADDRESS_STRING = ^IP_ADDRESS_STRING;
IP_ADDRESS_STRING =
packed record
acString : array [1..16] of Char;
end;
PIP_MASK_STRING = ^PIP_MASK_STRING;
IP_MASK_STRING = IP_ADDRESS_STRING;
PIP_ADDR_STRING = ^IP_ADDR_STRING;
IP_ADDR_STRING =
packed record
Next : PIP_ADDR_STRING;
IpAddress : IP_ADDRESS_STRING;
IpMask : IP_MASK_STRING;
Context : DWORD;
end;
time_t = int64;
PIP_ADAPTER_INFO = ^IP_ADAPTER_INFO;
IP_ADAPTER_INFO =
packed record
Next : PIP_ADAPTER_INFO;
ComboIndex : DWORD;
AdapterName : array [1..MAX_ADAPTER_NAME_LENGTH+4] of Char ;
Description : array [1..MAX_ADAPTER_DESCRIPTION_LENGTH+4] of Char;
AddressLength : UINT;
Address : array [1..MAX_ADAPTER_ADDRESS_LENGTH] of Byte;
Index : DWORD;
dwType : UINT;
DhcpEnabled : UINT;
CurrentIpAddress : PIP_ADDR_STRING;
IpAddressList : IP_ADDR_STRING;
GatewayList : IP_ADDR_STRING;
DhcpServer : IP_ADDR_STRING;
HaveWins : Boolean;
PrimaryWinsServer : IP_ADDR_STRING;
SecondaryWinsServer : IP_ADDR_STRING;
LeaseObtained : time_t;
LeaseExpires : time_t;
end;
type
TcsGetAdaptersInfo = function(const pAdapterInfo : PIP_ADAPTER_INFO;const pOutBufLen : PULONG) : DWORD; stdcall;
var
fDLLLoaded : Boolean = false;
hDLL : DWORD = 0;
GetAdaptersInfo : TcsGetAdaptersInfo = nil;
pAdapterList : PIP_ADAPTER_INFO = nil;
dwLen : DWORD = 0;
aaiAdapters : array of PIP_ADAPTER_INFO;
iAdapterIndex : integer = 0;
fFatalError : Boolean = false;
initialization
begin
hDLL := GetModuleHandle('IPHLPAPI.DLL');
if hDLL = 0 then
begin
fDLLLoaded := true;
hDLL := LoadLibrary('IPHLPAPI.DLL');
if hDLL <> 0 then
begin
@GetAdaptersInfo := GetProcAddress(hDLL,'GetAdaptersInfo');
if @GetAdaptersInfo = nil then
begin
MessageBox(0,'GetAdaptersInfo nicht gefunden','FEHLER',MB_ICONERROR or MB_OK);
fFatalError := true;
end;
end
else
begin
MessageBox(0,PChar('IPHLPAPI.DLL konnte nicht geladen werden.'+#13#10+SysErrorMessage(GetLastError)+#13#10+IntToStr(GetLastError)),'FEHLER',MB_ICONERROR or MB_OK);
fFatalError := true;
end;
end;
if fFatalError then
begin
exit;
end;
end;
finalization
begin
if hDLL <> 0 then
begin
if fDLLLoaded then
begin
FreeLibrary(hDLL);
end;
end;
if Assigned(pAdapterList) then
begin
FreeMem(pAdapterList,dwLen);
end;
end;
Tschüss Chris
Die drei Feinde des Programmierers: Sonne, Frischluft und dieses unerträgliche Gebrüll der Vögel.
Der Klügere gibt solange nach bis er der Dumme ist
|
|
Zitat
|