Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MAC Address

MAC Address

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmintutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cobyjone
    wrote on last edited by
    #1

    I am writing an application that needs the mac address of a remote computer. I have tried the SendArp function, but it does not return the whole mac address when I try to retrieve it for any computer other than my own local ip. For example, I use the SendArp function with my local computer ip and it returns 00-00-83-44-60-79. If I use it with a remote computer on the domain, it returns 10-40-00-00-83-44, which 00-00-83-44 is the correct start of the mac address, but it is missing the end of it. I think that might have to do with the fact that it is a token-ring network. However, if I run nbtstat -a {Computer Name} at the command prompt, I get the correct mac address. I have also tried the following: LPSTR cmp_name = {Computer Name}; WKSTA_TRANSPORT_INFO_0 *pwkti; DWORD dwEntriesRead; DWORD dwTotalEntries; LPWKSTA_USER_INFO_0 pbBuffer; NET_API_STATUS dwStatus = NetWkstaTransportEnum(cmp_name, 0, (LPBYTE *)&pbBuffer, buffer, MAX_PREFERRED_LENGTH, &dwEntriesRead, &dwTotalEntries, NULL); If I set cmp_name = NULL, it returns the correct mac address for my local computer. But if I set cmp_name to a valid computer name, pbBuffer becomes an invalid pointer. Does anyone know how I can get the correct mac address on a token-ring network? Thanks a lot.

    D 1 Reply Last reply
    0
    • C cobyjone

      I am writing an application that needs the mac address of a remote computer. I have tried the SendArp function, but it does not return the whole mac address when I try to retrieve it for any computer other than my own local ip. For example, I use the SendArp function with my local computer ip and it returns 00-00-83-44-60-79. If I use it with a remote computer on the domain, it returns 10-40-00-00-83-44, which 00-00-83-44 is the correct start of the mac address, but it is missing the end of it. I think that might have to do with the fact that it is a token-ring network. However, if I run nbtstat -a {Computer Name} at the command prompt, I get the correct mac address. I have also tried the following: LPSTR cmp_name = {Computer Name}; WKSTA_TRANSPORT_INFO_0 *pwkti; DWORD dwEntriesRead; DWORD dwTotalEntries; LPWKSTA_USER_INFO_0 pbBuffer; NET_API_STATUS dwStatus = NetWkstaTransportEnum(cmp_name, 0, (LPBYTE *)&pbBuffer, buffer, MAX_PREFERRED_LENGTH, &dwEntriesRead, &dwTotalEntries, NULL); If I set cmp_name = NULL, it returns the correct mac address for my local computer. But if I set cmp_name to a valid computer name, pbBuffer becomes an invalid pointer. Does anyone know how I can get the correct mac address on a token-ring network? Thanks a lot.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      See my reply here. smbecker wrote: But if I set cmp_name to a valid computer name, pbBuffer becomes an invalid pointer. And the return value is what?


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups