[cw-discuss] Obtaining MAC Address while in xover office
Robert Shearman
rob at codeweavers.com
Wed Mar 7 12:02:07 CST 2007
Dan Phillips wrote:
> Ok, I know this is a wierd routine to do but I have a program that
> grabs the MAC address of a local network card. Actually, as long as
> the network card is on the same subnet, you just tell the program the
> IP of that card and it will get its MAC address.
>
> I have a vmware session running XP and the program will obtain the
> vmware's MAC address, the SuSE 9.2 Linux host eth0's MAC address, and
> it'll even get the MAC address of my laptop's wireless card as long as
> the program runs from within the vmware session. The problem comes in
> when trying to run the program from the linux host through xover
> v6.0. The SendARP command reports an error when run regardless of
> which IP address I use to lookup the MAC address.
>
> Here's a code snippet and the declaration showing where the routine is
> stored, possibly this is an API call not yet implemented in xover or
> maybe its implemented wrong or something (not trying to tell anyone
> else how to program, I'm definitely not a programmer on a day to day
> basis, just trying to get this working).
>
> Oh, I failed to mention this is done in Visual Basic 6.x (patched)
>
> Private Declare Function inet_addr Lib "wsock32.dll" _
> (ByVal s As String) As Long
>
> Private Declare Function SendARP Lib " iphlpapi.dll" _
> (ByVal DestIP As Long, _
> ByVal SrcIP As Long, _
> pMacAddr As Long, _
> PhyAddrLen As Long) As Long
>
> Here is the command that generates the error:
> If SendARP(dwRemoteIP, 0&, pMacAddr, PhyAddrLen) = NO_ERROR Then
>
> Again, no code change, the program works perfectly within the vmware
> session using XP.
>
> Hints, Ideas, Gripes, shotty comments? :)
The SendARP function isn't implemented in CrossOver.
In Linux, you can use arping command from the command line instead.
For example:
$ arping -c 1 172.16.0.12
WARNING: interface is ignored: Operation not permitted
ARPING 172.16.0.12 from 172.16.0.11 eth0
Unicast reply from 172.16.0.12 [01:FE:9B:3E:BA:AD] 50.549ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
Of course, if the program wants to do something with the MAC address
then this isn't going to help.
--
Rob Shearman
More information about the discuss
mailing list