Netbios return code

本文列举了所有可能的网络控制块(NCB)返回代码及其在Windows for Workgroups中的含义。这些代码涵盖了从正常返回到各种错误状态的情况,有助于理解网络通信中的不同场景。
下表列出了所有可能网络控制块 (NCB) 返回代码和在 Windows for Workgroups 使用注释。 
更多信息
   NRC_GOODRET     
0x00   good return
   NRC_BUFLEN      
0x01   illegal buffer length
   NRC_BFULL       
0x02   buffers full, no receive issued
   NRC_ILLCMD      
0x03   illegal command
   NRC_CMDTMO      
0x05   command timed out
   NRC_INCOMP      
0x06   message incomplete, issue another command
   NRC_BADDR       
0x07   illegal buffer address
   NRC_SNUMOUT     
0x08   session number out of range
   NRC_NORES       
0x09   no resource available
   NRC_SCLOSED     
0x0a   session closed
   NRC_CMDCAN      
0x0b   command canceled
   NRC_DMAFAIL     
0x0c   PC DMA failed
   NRC_DUPNAME     
0x0d   duplicate name
   NRC_NAMTFUL     
0x0e   name table full
   NRC_ACTSES      
0x0f   no deletions, name has active sessions
   NRC_INVALID     
0x10   name not found or no valid name
   NRC_LOCTFUL     
0x11   local session table full
   NRC_REMTFUL     
0x12   remote session table full
   NRC_ILLNN       
0x13   illegal name number
   NRC_NOCALL      
0x14   no callname
   NRC_NOWILD      
0x15   cannot put * in NCB_NAME
   NRC_INUSE       
0x16   name in use on remote adapter
   NRC_NAMERR      
0x17   called name cannot == name or name #
   NRC_SABORT      
0x18   session ended abnormally
   NRC_NAMCONF     
0x19   name conflict detected
   NRC_IFBUSY      
0x21   interface busy, IRET before retrying
   NRC_TOOMANY     
0x22   too many commands outstanding, retry later
   NRC_BRIDGE      
0x23   ncb_bridge field not 00 or 01
   NRC_CANOCCR     
0x24   command completed while cancel occurring
   NRC_RESNAME     
0x25   reserved name specified
   NRC_CANCEL      
0x26   command not valid to cancel
   NRC_MULT        
0x33   multiple requests for same session
   NRC_MAXAPPS     
0x36   max number of applications exceeded
   NRC_NORESOURCES 
0x38   requested resources are not available
   NRC_SYSTEM      
0x40   system error
   NRC_ROM         
0x41   ROM checksum failure
   NRC_RAM         
0x42   RAM test failure
   NRC_DLF         
0x43   digital loopback failure
   NRC_ALF         
0x44   analog loopback failure
   NRC_IFAIL       
0x45   interface failure
   NRC_ADPTMALFN   
0x50   network adapter malfunction
   NRC_PENDING     
0xff   asynchronous command is not yet finished
// GetMacAddress.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <windows.h> #include <stdlib.h> #include <Nb30.h> #include <stdio.h> #pragma comment(lib, "netapi32.lib") typedef struct _ASTAT_ { ADAPTER_STATUS adapt; NAME_BUFFER NameBuff [30]; }ASTAT, * PASTAT; ASTAT Adapter; int _tmain(int argc, _TCHAR* argv[]) { NCB ncb; // NCB结构体,用于设置执行的NetBIOS命令和参数 LANA_ENUM lana_enum; //包含当前LAN适配器的数量 memset(&lana_enum, 0, sizeof(lana_enum)); UCHAR uRetCode; // 执行Netbios()函数的返回值 memset(&ncb, 0, sizeof(ncb)); // 初始化ncb结构体 // 统计系统中网卡的数量,指定指令为NCBENUM ncb.ncb_command = NCBENUM; // 补充:设置NCB命令为NCBENUM(枚举LANA编号) ncb.ncb_buffer = (unsigned char*)&lana_enum; ncb.ncb_length = sizeof(LANA_ENUM); uRetCode = Netbios(&ncb); // 补充:执行NetBIOS操作,获取网卡枚举信息 if (uRetCode != NRC_GOODRET) exit(-1); printf("lana_enum.length=%d\n", lana_enum.length); for (int i = 0; i < lana_enum.length; i++) { printf("lana_enum.lana=%d\n",lana_enum.lana[i]); //输出适配器的编号值 } printf("MAC :\n"); // NCBREST:重置LAN适配器 for (int lana = 0; lana < lana_enum.length; lana++) { // 初始化逻辑网卡(重置) ncb.ncb_command = NCBRESET; // 补充:设置命令为NCBRESET(重置适配器) ncb.ncb_lana_num = lana_enum.lana[lana]; uRetCode = Netbios(&ncb); memset(&ncb, 0, sizeof(ncb)); // 初始化ncb // 执行NCBASTAT命令(获取适配器状态) ncb.ncb_command = NCBASTAT; // 补充:设置命令为NCBASTAT(获取适配器信息) ncb.ncb_lana_num = lana_enum.lana[lana]; // 设置LANA编号 // 设置执行NCBASTAT命令的参数,将获取到的网络适配器数据保存到Adapter结构体中 strcpy((char*)ncb.ncb_callname, "*"); //memcpy(&ncb.ncb_callname, "* ", 16); ncb.ncb_buffer = (UCHAR*)&Adapter; ncb.ncb_length = sizeof(Adapter); // 调用Netbios()函数,执行NCBASTAT命令 uRetCode = Netbios(&ncb); //printf("The NCBASTAT return code is: 0x%x \n", uRetCode); if (uRetCode == 0) { // 输出MAC地址 printf(" %02x-%02x-%02x-%02x-%02x-%02x\n", 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]); } printf("name=%s,name_num=%d\n", Adapter.NameBuff->name, Adapter.NameBuff->name_num); } system("pause"); return 0; }解释代码,我是小白需要知道所有函数功能调用功能
10-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值