Announcement

Collapse
No announcement yet.

Discover Workstation IP Address from PBDOS?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Thomas Gohel
    replied

    On 22 Jun 05, Deon Judkins wrote:

    Hello Deon,

    > Anybody know how I can do this?

    The following source do this job with my POP3/IMAP/SMTP & NEWS-
    Clients for DOS:

    Code:
    $DIM ALL
    
    DECLARE FUNCTION Get_Ip_Adress(BYVAL PktVec AS INTEGER) AS STRING
    
    CLS
    PRINT
    PRINT
    PRINT "Ip: "; Get_Ip_Adress$(&h60)
    
    FUNCTION Get_Ip_Adress(BYVAL PktVec AS INTEGER) AS STRING
    
            DIM MacAddr AS LOCAL STRING * 17
            DIM IpAddr1 AS LOCAL STRING * 17
            DIM IpAddr2 AS LOCAL STRING * 17
            DIM PktAddr AS LOCAL LONG
            DIM PktBuff AS LOCAL STRING * 16
            DIM PktSign AS LOCAL STRING PTR * 8
            DIM pBuff   AS LOCAL LONG PTR
    
            ! push ds                        ; Call-Far Adresse des jeweiligen
            ! mov ah, &h35                   ; Interruptvektors holen
            ! mov al, PktVec                 ; Interruptvektor des Paketdrivers
            ! int &h21
            ! pop ds
            ! mov PktAddr[02], es            ; Call-Far Adresse eintragen
            ! mov PktAddr[00], bx
            ! mov PktSign[02], es            ; Signatur für "PKT DRVR" ein-
            ! add bx, 3                      ; tragen
            ! mov PktSign[00], bx
            ' Checken ob Paketdriver auch installiert ist
            IF @PktSign = "PKT DRVR" THEN
                pBuff = VARPTR32(PktBuff)    ' Pointer holen und eintragen
                ! mov es, pBuff[02]          ;
                ! mov di, pBuff[00]          ;
                ! mov ah, 6
                ! mov bx, 0
                ! mov cx, 12
                ! pushf                      ; "! int" vorbereiten
                ! call dword PktAddr         ; und ab ...
                MacAddr = HEX$(ASC(MID$(PktBuff,  1,1))) + ":" + _
                          HEX$(ASC(MID$(PktBuff,  2,1))) + ":" + _
                          HEX$(ASC(MID$(PktBuff,  3,1))) + ":" + _
                          HEX$(ASC(MID$(PktBuff,  4,1))) + ":" + _
                          HEX$(ASC(MID$(PktBuff,  5,1))) + ":" + _
                          HEX$(ASC(MID$(PktBuff,  6,1)))
                IpAddr1 = STR$(ASC(MID$(PktBuff,  7,1))) + "." + _
                          STR$(ASC(MID$(PktBuff,  8,1))) + "." + _
                          STR$(ASC(MID$(PktBuff,  9,1))) + "." + _
                          STR$(ASC(MID$(PktBuff, 10,1)))
                IpAddr2 = STR$(ASC(MID$(PktBuff, 11,1))) + "." + _
                          STR$(ASC(MID$(PktBuff, 12,1))) + "." + _
                          STR$(ASC(MID$(PktBuff, 13,1))) + "." + _
                          STR$(ASC(MID$(PktBuff, 14,1)))
                IPAddr1  = REMOVE$(IpAddr1, " ")
                IPAddr2  = REMOVE$(IpAddr2, " ")
                FUNCTION = IpAddr1
            ELSE
                FUNCTION = "0.0.0.0"
            END IF
    
    END FUNCTION
    Regards,

    --------------
    / h o m a s
    ------------------
    email : [email protected] / mailto:[email protected][email protected]</A> (PGP-Key available)
    www : http://www.gohel.de / http://www.pbhq.de (PowerBASIC)
    fax/bbs: +49-30-47300910 (VFC, V34+, X75, ISDN, CCB, 9600-128000bps)
    ## CrossPoint/Agent R/C2478, via PBNEWS v0.64g (news.pbhq.de)

    Leave a comment:


  • Marco Pontello
    replied
    A "not so refined" way could be something like SHELL "ipconfig > myfile.txt" and then parse myfile.txt.

    Bye!


    ------------------
    Try Online TrID file identifier! Recognize over 1.600 filetypes and counting...
    Give a powerfull scriptable Lua interface to your application with PowerBLua
    PBTracer - Tracer / Profiler for PowerBASIC (soon!) - Cell news links

    Leave a comment:


  • Deon Judkins
    started a topic Discover Workstation IP Address from PBDOS?

    Discover Workstation IP Address from PBDOS?

    Anybody know how I can do this?
    Thanks,
    Deon



    ------------------
    Deon
Working...
X