Seite 3 von 3

Verfasst: 05.09.2006 23:50
von Andre
ts-soft hat geschrieben:Im engl. wurde bestätigt, läuft fehlerfrei unter PB4. Hoffentlich braucht Andrè
den noch (ist ja auch im CodeArchiv) und findet ihn hier :mrgreen:
Hab grad den aktualisierten Code in der entsprechenden Source-Datei gespeichert. Danke!

Ansonsten verweise ich einfach nochmal auf meinen Hilfeaufruf: PB Codearchiv - Übersetzer gesucht (nach PB 4)

Verfasst: 06.09.2006 00:06
von ts-soft
@André
Ich wußte, das Du es finden würdest :wink:
Entweder hier oder im engl.

Verfasst: 06.09.2006 08:39
von pws32
Hi,

habe im int. Forum noch einen Code entdeckt und etwas erweitert, läuft sogar stabil unter meinem Problemcomputer und ist sogar stabil mit der Aussage ob die IP statisch ist oder per DHCP bezogen wird

Code: Alles auswählen

; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getadaptersinfo.asp
; with the help of IPHlpAPI.inc from the Powerbasic include-file for the structures
; Microsoft isn´t quite a help here :-)

DHCPServerEnabled.s

Structure IP_ADDR_STRING
  pNext.l
  IpAddress.b[16]
  IpMask.b[16]
  Context.l
EndStructure

Structure IP_ADAPTER_INFO
Next.l
ComboIndex.l
AdapterName.b[260] ; MAX_ADAPTER_NAME_LENGTH + 4
Description.b[132] ; MAX_ADAPTER_DESCRIPTION_LENGTH + 4
AdressLength.l
Address.b[8] ; MAX_ADAPTER_ADDRESS_LENGTH
Index.l
Type.l
DhcpEnabled.l
CurrentIpAddressPTR.l
IpAddressList.IP_ADDR_STRING
GatewayList.IP_ADDR_STRING
DhcpServer.IP_ADDR_STRING
HaveWins.l
PrimaryWinsServer.IP_ADDR_STRING
SecondaryWinsServer.IP_ADDR_STRING
LeaseObtained.l
LeaseExpires.l
EndStructure

length.l=0
Result=GetAdaptersInfo_(0,@length) ; Get the length for Buffer
If Result=#ERROR_BUFFER_OVERFLOW
  *Buffer=AllocateMemory(length)
  Result=GetAdaptersInfo_(*Buffer,@length)
  If Result=#ERROR_SUCCESS
    adapters=length/SizeOf(IP_ADAPTER_INFO)
    For x=0 To adapters-1
      Debug "AdapterNr : "+Str(x+1)
      tempipinfo.IP_ADAPTER_INFO
      For i=0 To SizeOf(IP_ADAPTER_INFO)-1
        byte.b=PeekB(*Buffer+(x*640)+i)
        PokeB(tempipinfo+i,byte)
      Next
      Debug "Adapter : "+PeekS(@tempipinfo\Description)
      Debug "IP-Adress : "+PeekS(@tempipinfo\IpAddressList+4)
      Debug "Gateway : "+PeekS(@tempipinfo\GatewayList+4)
     
      Debug "P-Wins : "+PeekS(@tempipinfo\PrimaryWinsServer+4)
      Debug "S-Wins : "+PeekS(@tempipinfo\SecondaryWinsServer+4)
      
      
      ;Debug "DHCP-Server : "+PeekS(@tempipinfo\DhcpServer+4)
      If PeekS(@tempipinfo\DhcpServer+4) = "255.255.255.255"
        Debug "STATIC IP Configuration"
       Else
        Debug "DHCP Server Adress : " +PeekS(@tempipinfo\DhcpServer+4)
      EndIf
      
      
      mac$=""
      For i=0 To 5
        byte.b=PeekB(@tempipinfo\Address+i)
        If byte>=0
          mac$+RSet(Hex(byte),2,"0")
        Else
          mac$+RSet(Hex(byte+256),2,"0")
        EndIf
        If i<5
          mac$+":"
        EndIf
      Next
      Debug "MAC-Address "+mac$
    Next
  Else
    Debug "Error : "+Str(Result)
  EndIf
EndIf