当前位置:编程学习 > C#/ASP.NET >>

在WinNT及Win2000中实现读取网卡物理地址的一段C程序,熟悉C的人员可作参考改进。

#include <windows.h>
#include <wincon.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
typedef struct _ASTAT_
{
    ADAPTER_STATUS adapt;
    NAME_BUFFER    NameBuff [30];
}ASTAT, * PASTAT;
ASTAT Adapter;
void main (void)
{
    NCB ncb;
    UCHAR uRetCode;
    char NetName[50];
    memset( &ncb, 0, sizeof(ncb) );
    ncb.ncb_command = NCBRESET;
    ncb.ncb_lana_num = 0;
    uRetCode = Netbios( &ncb );
    printf( "The NCBRESET return code is: 0x%x ", uRetCode );
    memset( &ncb, 0, sizeof(ncb) );
    ncb.ncb_command = NCBASTAT;
    ncb.ncb_lana_num = 0;
    strcpy( ncb.ncb_callname,    "*            " );
    ncb.ncb_buffer = (char *) &Adapter;
    ncb.ncb_length = sizeof(Adapter);
    uRetCode = Netbios( &ncb );
    printf( "The NCBASTAT return code is: 0x%x ", uRetCode );
    if ( uRetCode == 0 )
    {
        printf( "The Ethernet Number is: %02x%02x%02x%02x%02x%02x ",
补充:asp.net教程,远程及网络应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,