Coder's Guild Mailing List

Re: Ethernet adress

Posted by Ulli Conrad on 1999-06-17

On 16 Jun 99, you wrote:

> I'm desperately searching for a method to find a Network Cards MAC (node)
> address without using any protocols like IPX or so. My program will be
MAC adress is protocol independent, it's burned into each network 
card.

> executed BEFORE any protocol is loaded, so it has to be protocol-less. If
> anyone has code laying around, please send it to sttd@xxxxxxxxxx.xx Thanx
> for the answers, but it'll need to work in Dos/Win95, so no linux please..
Code is code, wether for linux or not, more important is the 
question: What language???

Here is a Delphi example for Windows 95:

Type
 TGUID=record
  A,B:word;
  D,M,S:word;
  MAC:array[1..6] of byte;
 end;
function CoCreateGuid(var guid: TGUID): HResult; stdcall; far external
'ole32.dll';

procedure TForm1.FormCreate(Sender: TObject);
var
 g:TGUID;
 s:string;
 i:integer;
begin
 CoCreateGUID(g);
 s:=''; for i:=1 to 6 do s:=s+IntToHex(g.MAC[i],2);
 Label1.Caption:=s; // this is the network card MAC address
end;

- Ulli -

===
The Coder's Knowledge Base
http://www.netalive.org/ckb