MAC Address
-
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.
-
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.
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