Re: NIC Hardware Address

new topic     » goto parent     » topic index » view thread      » older message » newer message

its real easy in dos
here goes and excerpt from my pkt_drv.e
first load a packet driver with interrupt like 0x60 maybe
then PKT_DRV_INTERRUPT=#60
then do the below
good hunting


global function driver_info(atom handle)--1
        sequence regs,al,name
        atom AL,address
        regs=REGS
        regs[REG_AX]=#01FF
        regs[REG_BX]=handle
        regs=dos_interrupt(PKT_DRV_INTERRUPT,regs)
        if and_bits(regs[REG_FLAGS],1) then return Get_Error(regs) end if
        address=(regs[REG_DS]*16)+regs[REG_SI]
        name={}
        for i = 0 to 255 do
                name&=peek(address+i)
                if name[length(name)]=0 or name[length(name)]='$' then
                        name=name[1..length(name)-1]
                        exit
                end if
        end for
        AL=and_bits(regs[REG_AX],255)
        if Debug_Mode then
                if AL=1 then al="Basic"
                elsif AL=2 then al="Basic & Extended"
                elsif AL=5 then al="Basic & High-Performance"
                elsif AL=6 then al="Basic, High-performance & Extended"
                else al="NOT INSTALLED"
                end if
                printf(1,
                        "%s ver %d, %d, %d, %d\n\t%s\n",
                        {name,
                        regs[REG_BX],
                        floor(regs[REG_CX]/256),
                        regs[REG_DX],
                        and_bits(regs[REG_CX],255),
                        al})
        end if
        Version=regs[REG_BX]
        Class=floor(regs[REG_CX]/256)
        Type=regs[REG_DX]
        Number=and_bits(regs[REG_CX],255)
        Name=name
        Functionality=AL
        return 0
end function

global function access_type(atom if_class,atom if_type,atom
if_number,sequence p_type,atom receiver)--2
        sequence regs
        atom type_ptr
        type_ptr=0
        if length(p_type)>0 then
                type_ptr=allocate_low(length(p_type))
        end if
--        poke(type_ptr,p_type)
        regs=REGS
        regs[REG_AX]=#0200+if_class
        regs[REG_BX]=if_type
        regs[REG_DX]=if_number
        regs[REG_DS]=floor(type_ptr/16)
        regs[REG_SI]=and_bits(type_ptr,15)
        regs[REG_CX]=length(p_type)
        regs[REG_ES]=floor(receiver/16)
        regs[REG_DI]=0
        regs=dos_interrupt(PKT_DRV_INTERRUPT,regs)
        if and_bits(regs[REG_FLAGS],1) then return Get_Error(regs) end if
        if length(p_type)>0 then
                free_low(type_ptr)
        end if
        return regs[REG_AX]
end function

global function get_address(atom handle)--6
        sequence regs,address
        atom address_ptr
        address_ptr=allocate_low(256)
        regs=REGS
        regs[REG_AX]=#0600
        regs[REG_BX]=handle
        regs[REG_ES]=floor(address_ptr/16)
        regs[REG_DI]=remainder(address_ptr,16)
        regs[REG_CX]=256
        regs=dos_interrupt(PKT_DRV_INTERRUPT,regs)
        if and_bits(regs[REG_FLAGS],1) then return Get_Error(regs) end if
        address=peek({address_ptr,regs[REG_CX]})
        free_low(address_ptr)
        if Debug_Mode then
printf(1,"Address=%02x:%02x:%02x:%02x:%02x:%02x\n",address) end if
        Address=address
        return address
end function
                        error=driver_info(10)
                        handle=access_type(Class,Type,Number,{},0)
                        ? get_address(handle)


----- Original Message ----- 
From: "C. K. Lester" <euphoric at cklester.com>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, September 30, 2003 8:21 AM
Subject: NIC Hardware Address


>
>
> How do I get a PC's unique NIC hardware address using EUPHORIA?
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu