Solved

How to find out the MAC Address ?

Posted on 1998-06-02
3
402 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
stack 22 174
XCode crashes while uploading to app store. 5 270
Problem in finding output of a program 11 108
How to copy documents folder to network folder automatically as backup? 15 95
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 opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

685 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