惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - catlog

曲终人不散 - catlog 在Windows2000/XP的安全模式下,替换Gina 如何再Win2000/XP下,加入自己的认证? 是走的时候了 VC++ FAQ--VC和MFC的未来,还有Whidbey 如何在Win2000/xp下禁止某些硬件?比如说网卡,CD-ROM.. 明华的EKey 头晕,出个题目考考你 - catlog - 博客园 基于pkcs11的MS CSP的OpenSource实现 生活就是混下去。 用 WB Editor 连接 博客园 的全攻略 取得当前用户的权限(privileges) 一首词 令人吃惊的完成端口Copy速度! 如何订阅OSR的新闻组? Windows 2000的引导过程 1:0中国胜科威特 win98下如何控制登陆? 故土难离
如何用IPHelp取得网卡的详细信息
catlog · 2004-03-02 · via 博客园 - catlog

IPHelp在Win98以后就被Windows支持,
是MS在WinSock上的再一层封装。
请下面的代码:

得到网卡列表:
//-----------------------------------------------------------------------
// GetAdapterLists
//-----------------------------------------------------------------------
BOOL CNetcfgDlg::GetAdapterLists(CComboBox &cmdAdapter)
{
 bool bRet = false;
 DWORD Err;
 PIP_ADAPTER_INFO pAdapterInfo, pAdapt;
    DWORD AdapterInfoSize;
 CString csTmp;
 UINT nIndex = 0;

  cmdAdapter.Clear();
    //
    // Enumerate all of the adapter specific information using the IP_ADAPTER_INFO structure.
    // Note:  IP_ADAPTER_INFO contains a linked list of adapter entries.
    //
    AdapterInfoSize = 0;
    if ((Err = GetAdaptersInfo(NULL, &AdapterInfoSize)) != 0)
    {
        if (Err != ERROR_BUFFER_OVERFLOW)
        {           
            return false;
        }
    }

    // Allocate memory from sizing information
    if ((pAdapterInfo = (PIP_ADAPTER_INFO) GlobalAlloc(GPTR, AdapterInfoSize)) == NULL)
    {       
        return false;
    }

    // Get actual adapter information
    if ((Err = GetAdaptersInfo(pAdapterInfo, &AdapterInfoSize)) != 0)
    {       
        return false;
    }

    pAdapt = pAdapterInfo;

   //m_AdapterList.push_back(*pAdapt);
    while (pAdapt)
    {               
  csTmp.Format("%d\t%s",nIndex,pAdapt->Description);
  cmdAdapter.AddString(csTmp);
  //m_AdapterList.push_back(*pAdapt);
  cmdAdapter.SetItemDataPtr(nIndex,pAdapt);
  nIndex++;

  pAdapt = pAdapt->Next;
    }

 }

显示单个网卡的信息:

 csTmp.Format("适配器GUID:%s\n",pAdapt->AdapterName);
 csAdpInfo += csTmp;

 csTmp.Format("名称描述:%s\n",pAdapt->Description);
 csAdpInfo += csTmp;

 char buf[2];
 CString csBuf = "";
 for (UINT i=0; i<pAdapt->AddressLength; i++)
 {
  if (i == (pAdapt->AddressLength - 1))
   sprintf(buf,"%.2X",(int)pAdapt->Address[i]);
  else
   sprintf(buf,"%.2X-",(int)pAdapt->Address[i]);

  csBuf += buf;
 }    
 csTmp.Format("网卡物理地址(MAC):%s\n",csBuf);
 csAdpInfo += csTmp;

 csTmp.Format("DHCP: %s\n", (pAdapt->DhcpEnabled ? "允许" : "不允许")); 
 csAdpInfo += csTmp;

 pAddrStr = &(pAdapt->IpAddressList);
 while(pAddrStr)
 {
  csTmp.Format("IP地址:%s\n",pAddrStr->IpAddress.String);
  csAdpInfo += csTmp;
  csTmp.Format("子网掩码:%s\n",pAddrStr->IpMask.String);
  csAdpInfo += csTmp;  
  pAddrStr = pAddrStr->Next;
 }

 

 csTmp.Format("默认网关:%s\n",pAdapt->GatewayList.IpAddress.String);
 csAdpInfo += csTmp;

  csTmp.Format("DHCP服务器 :%s\n",pAdapt->DhcpServer.IpAddress.String);
 csAdpInfo += csTmp;

  csTmp.Format("主WINS服务器:%s\n",pAdapt->PrimaryWinsServer.IpAddress.String);
 csAdpInfo += csTmp;

 csTmp.Format("从WINS服务器:%s\n",pAdapt->SecondaryWinsServer.IpAddress.String);
 csAdpInfo += csTmp;

  SetDlgItemText(IDC_ADPINFO,csAdpInfo);