Solved

How to find out the MAC Address ?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now