Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>GetAdaptersInfo</code> function only returns the addresses of the adapters attached to the local computer. You should take a look to <a href="http://msdn.microsoft.com/es-es/library/windows/desktop/aa366358%28v=vs.85%29.aspx" rel="nofollow">SendARP</a>.</p> <p>EDIT: Try this:</p> <pre><code>void CmfcServerDlg::PrintMACFromIP(const CString &amp;selected_ip_adr) { DWORD dwRetVal; IPAddr DestIp = 0; IPAddr SrcIp = 0; /* default for src ip */ ULONG MacAddr[2]; /* for 6-byte hardware addresses */ ULONG PhysAddrLen = 6; /* default to length of six bytes */ char *SrcIpString = NULL; BYTE *bPhysAddr; DestIp = inet_addr(CT2A(selected_ip_adr)); memset(&amp;MacAddr, 0xff, sizeof (MacAddr)); dwRetVal = SendARP(DestIp, SrcIp, &amp;MacAddr, &amp;PhysAddrLen); if (dwRetVal == NO_ERROR) { bPhysAddr = (BYTE *) &amp; MacAddr; if (PhysAddrLen) { CString theMac; theMac.Format(_T("%.2X-%.2X-%.2X-%.2X-%.2X-%.2X"), (int) bPhysAddr[0], (int) bPhysAddr[1],(int) bPhysAddr[2],(int) bPhysAddr[3],(int) bPhysAddr[4], (int) bPhysAddr[5]); PrintMACaddress(theMac); } else printf ("Warning: SendArp completed successfully, but returned length=0\n"); } else { printf("Error: SendArp failed with error: %d", dwRetVal); switch (dwRetVal) { case ERROR_GEN_FAILURE: printf(" (ERROR_GEN_FAILURE)\n"); break; case ERROR_INVALID_PARAMETER: printf(" (ERROR_INVALID_PARAMETER)\n"); break; case ERROR_INVALID_USER_BUFFER: printf(" (ERROR_INVALID_USER_BUFFER)\n"); break; case ERROR_BAD_NET_NAME: printf(" (ERROR_GEN_FAILURE)\n"); break; case ERROR_BUFFER_OVERFLOW: printf(" (ERROR_BUFFER_OVERFLOW)\n"); break; case ERROR_NOT_FOUND: printf(" (ERROR_NOT_FOUND)\n"); break; default: printf("\n"); break; } } } void CmfcServerDlg::PrintMACaddress(CString&amp; strText) { m_ClientIdList.AddString(strText); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload