1. NIC Hardware Address

How do I get a PC's unique NIC hardware address using EUPHORIA?

new topic     » topic index » view message » categorize

2. Re: NIC Hardware Address

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 message » categorize

3. Re: NIC Hardware Address

Good stuff... 'cept I need it for Windows! getlost

----- Original Message ----- 
From: <codepilot at netzero.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re: NIC Hardware Address


> 
> 
> its real easy in dos

<snippage occurred>

new topic     » goto parent     » topic index » view message » categorize

4. Re: NIC Hardware Address

When I run MAC on my P3 with 98 2nd I get error 111..(I have 2 nics if that
makes any diff)

george

----- Original Message -----
From: "Brian Broker" <bkb at cnw.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: NIC Hardware Address


>
>
> I discovered that I needed to make this a bit more dynamic when I got
> home because of my bad assumption about having only one NIC.  I just
> wanted to release a quick demo before I ran out of time earlier this
> evening.  I'll let this evolve a bit more then release it to the
> archive...
>
> http://cnw.com/~bkb/Eu/MAC2.zip  -- now with more comments!
>
> This will enumerate and give info for each adapter:
>   -- adapter name (the long number in squiggle brackets)
>   -- adapter description
>   -- MAC/physical address
>
> Still waiting to hear if this helps (C.K.?),
>
> -- Brian
>
> Earlier I wrote:
> >
> >
> > Hi C.K.
> >
> > I tried the 'GetAdaptersInfo' function and got a working demo.
> >
> > Get it from http://cnw.com/~bkb/Eu/MAC.zip (case sensitive)
> >
> > Let me know if that works for you...
> > -- Brian
> >
> > > C. K. Lester wrote:
> > > >
> > > >
> > > > Good stuff... 'cept I need it for Windows! getlost
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: NIC Hardware Address

Brian Broker wrote:

>I discovered that I needed to make this a bit more dynamic when I got 
>home because of my bad assumption about having only one NIC.  I just 
>wanted to release a quick demo before I ran out of time earlier this 
>evening.  I'll let this evolve a bit more then release it to the 
>archive...
>
>Still waiting to hear if this helps (C.K.?),

It's wonderful!!! However, I'm having to stay home from work today with
a sick child, so I won't be able to apply it to the relative code till
later today or tomorrow... I'll probably run some tests from home today,
though, so we'll see.

I think somebody made the comment about using this for licensing
purposes, and that's correct. I've got a client with multiple desktops,
but after each reboot, the PC's hard drive serial number changes. I was
basing the license on that number, so after each change the license was
voided. I'm hoping that using one of the hard wired NIC numbers will fix
it up nicely.

Thanks!
-ck

new topic     » goto parent     » topic index » view message » categorize

6. Re: NIC Hardware Address

Brian, I get the same result...device manager shows 3 nics...2 real cards
and one "dialup adapter" which is a modem i guess. Could that be the
problem?

george
----- Original Message -----
From: "Brian Broker" <bkb at cnw.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: NIC Hardware Address


>
>
> Hi George,
>
> Yes, the first version was released quickly and only supports having one
> NIC.  The error 111 is a buffer overflow error because you have two
> NICs.  The demo in the MAC2 package should handle multiple NICs.  Try it
> and let me know if that works.
>
> -- Brian
>
> George Walters wrote:
> >
> >
> > When I run MAC on my P3 with 98 2nd I get error 111..(I have 2 nics if
> > that
> > makes any diff)
> >
> > george
> >
> > ----- Original Message -----
> > From: "Brian Broker" <bkb at cnw.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Wednesday, October 01, 2003 5:29 AM
> > Subject: RE: NIC Hardware Address
> >
> >
> > > I discovered that I needed to make this a bit more dynamic when I got
> > > home because of my bad assumption about having only one NIC.  I just
> > > wanted to release a quick demo before I ran out of time earlier this
> > > evening.  I'll let this evolve a bit more then release it to the
> > > archive...
> > >
> > > http://cnw.com/~bkb/Eu/MAC2.zip  -- now with more comments!
> > >
> > > This will enumerate and give info for each adapter:
> > >   -- adapter name (the long number in squiggle brackets)
> > >   -- adapter description
> > >   -- MAC/physical address
> > >
> > > Still waiting to hear if this helps (C.K.?),
> > >
> > > -- Brian
> > >
> > > Earlier I wrote:
> > > >
> > > >
> > > > Hi C.K.
> > > >
> > > > I tried the 'GetAdaptersInfo' function and got a working demo.
> > > >
> > > > Get it from http://cnw.com/~bkb/Eu/MAC.zip (case sensitive)
> > > >
> > > > Let me know if that works for you...
> > > > -- Brian
> > > >
> > > > > C. K. Lester wrote:
> > > > > >
> > > > > >
> > > > > > Good stuff... 'cept I need it for Windows! getlost
> > >
> > >
> > > TOPICA - Start your own email discussion group. FREE!
> > >
> > >
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu