/ / -------------------------------------------------------------------------------------------- ---------------------------
#include
#include
/ / -------------------------------------------------------------------------------------------- ---------------------------
/ / -------------------------------------------------------------------------------------------- ---------------------------
TypedEf struct _astat_ {adapter_status adapt; name_buffer namebuff [30];} astat, * pastet;
Astat adapter; // --------------------------------------------- ------------------------------ Void getMac_one (int LANA_NUM) {NCB NCB; uchar uretcode;
MEMSET (& NCB, 0, SIZEOF (NCB)); ncb.ncb_command = ncbreset; ncb.ncb_lana_num = lana_num; // Specify network card number
// First send a ncbreset command on the selected network card to initialize uretcode = netbios (& NCB); Printf ("THE NCBRESET RETURN CODE IS: 0x% X / N", URetcode; MEMSET (& NCB, 0, Sizeof) NCB)); ncb.ncb_command = ncbastat; ncb.ncb_lana_num = lana_num; // Specify NIC number
STRCPY ((char *) ncb.ncb_callname, "*"); ncb.ncb_buffer = (unsigned char *) & adapter;
/ / Specify the variables stored in the returned information ncb.ncb_length = sizeof (adapter);
/ / Next, the ncbastat command can be sent to obtain information uretcode = netbios (& NCB); Printf ("THE NCBASTAT RETURN CODE IS: 0x% x / n", uretcode); if (uretcode == 0) {
// Storm the network card MAC address into a commonly used 16-in-law, such as 0010-a4E4-5802 Printf ("The Ethernet Number [% D] IS: 02x-% 02x-% 02x-% 02x-% 02x-% 02x / n ", lana_num, Adapter.adapt.adapter_address [0], Adapter.adapt.adapter_address [1], Adapter.adapt.adapter_address [2], Adapter.adapt.adapter_address [3], Adapter.adapt.adapter_address [4] Adapter.adapt.adapter_address [5]);}} // --------------------------------- ----------------------------------------- # pragma argsusedint main (int Argc, char * argv []) {NCB NCB; uchar uretcode; lana_enum lana_enum
MEMSET (& NCB, 0, SIZEOF (NCB)); ncb.ncb_command = ncbenum;
Ncb.ncb_buffer = (unsigned char *) & lana_enum; ncb.ncb_length = sizeof (LANA_ENUM);
/ / Send the ncbenum command to the network card to get the network card information of the current machine, if there is a network card, each NIC number and other uretcode = netbios (& NCB); Printf ("The ncbenum return code is: 0x% x / n" URETCODE); if (uretcode == 0) {Printf ("Ethernet Count IS:% D / N / N", LANA_ENUM.LENGTH); for (int i = 0; i