Solved

How to find out the MAC Address ?

Posted on 1998-06-02
3
404 Views
Last Modified: 2010-04-15
I'd like to know how to find out the MAC Address of a ethernet card in a programatically way.
Does anybody have a C algorithm to do that ?
The program will run in MS-DOS(!!!) environment.
0
Comment
Question by:edsont
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:lekshmikr
ID: 1251100
To get the Media Access Control (MAC) address for an ethernet adapter
programmatically, you can use NetBIOS if your card is bound to NetBIOS. Use
the Netbios() NCBASTAT command and provide a "*" as the name in the
NCB.ncb_CallName field. This is demonstrated in the sample code below.
 
With the NetBEUI and IPX transports, the same information can be obtained
at a command prompt by using:
 
   net config workstation

0
 

Author Comment

by:edsont
ID: 1251101
The problem is that my application won't have access to any protocols, so I can't use those APIs.

I think I've omitted that the ethernet card that my application will work with is NE2000 compatible.

What I really would like is a routine that could use hardware I/O to get the MAC address of the card.

Maybe I've posted this question in a wrong section . . .

0
 

Accepted Solution

by:
knappbl earned 20 total points
ID: 1251102
You can use the GUIDGEN utility (or the corresponding API call - CoCreateGuid.)  The last section of the GUID that is returned is actually the physical address of your ethernet card.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question