FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour mac address
Posts: 3
Joined: Tue Oct 11, 2005 02:10 AM
mac address
Posted: Tue Oct 11, 2005 02:52 AM

Can any please help me how to find mac address of the PC ?
Thanks in advance

NageswaraRao

NageswaraRao, G.
India
email: nagesh_g@yahoo.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Tue Oct 11, 2005 07:54 AM

You may use GETNETCARDID()

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3
Joined: Tue Oct 11, 2005 02:10 AM
mac address
Posted: Tue Oct 11, 2005 09:42 PM

Thanks Mr. Antonio.
But I am getting unlinked external "GetAdapetersInfo" referenced by function "NETCRDID"
I am using xHarbour with FWH.
Can you help me with this please?
Regards
Nageswararao

NageswaraRao, G.
India
email: nagesh_g@yahoo.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Tue Oct 11, 2005 10:28 PM

NageswaraRao,

Are you using xHarbour commercial ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10
Joined: Sat Oct 08, 2005 04:24 AM
GetNetCardID
Posted: Wed Oct 12, 2005 06:01 AM

Add IPHLPAPI.LIB from bcc55 into your script if your are using bcc

Posts: 3
Joined: Tue Oct 11, 2005 02:10 AM
mac address
Posted: Wed Oct 12, 2005 06:51 AM

I am using xharbour with bcc55. not the commercial version. i included the lib iphlpapi.lib as advised by srrao and now its working fine. thanks mr. antonio and mr. sanjay

NageswaraRao, G.
India
email: nagesh_g@yahoo.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Wed Oct 12, 2005 07:34 AM

NageswaraRao,

Yes, right, that library is needed. We already provided it included in samples\buildh.bat. I guess you are using an older version of buildh.bat.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
GetNetCardID under xhb Commercial
Posted: Thu Jun 07, 2007 07:18 AM

Hi,

I'm getting a unresolved external __chkstk when I try to use this

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Thu Jun 07, 2007 07:21 AM

Alex,

Try linking Borland cw32.lib

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
mac address
Posted: Thu Jun 07, 2007 07:25 AM

A borland library with commercial xharbour?

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Thu Jun 07, 2007 07:31 AM

ops, my mistake :-)

Then you should require it to xHB guys.

If I am not wrong, __chkstk stands for check stack, so you could safely create a dummy C function with such name

void _chkstk( void ) { }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
GetNetCardID
Posted: Thu Jun 07, 2007 07:39 AM

If I add that dummy function, GetNetCardID kills my app.

Will ask on xhb newsgroup

Alex

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Thu Jun 07, 2007 08:19 AM

Alex,

> Will ask on xhb newsgroup

Yes, its the right way :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
mac address
Posted: Thu Jun 07, 2007 08:32 AM

Alex,

Just out of curiosity, please try it this way:

BOOL _chkstk( void ) { return TRUE; }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
mac address
Posted: Thu Jun 07, 2007 09:06 AM
No luck :-)

Busy trying to get following code to work. It compiles. I just need to figure out how to return an array of adapter names and addresses

#include <iphlpapi.h>

// Fetches the MAC address and prints it
static void GetMACaddress(void)
{
  IP_ADAPTER_INFO AdapterInfo[16];       // Allocate information
                                         // for up to 16 NICs
  DWORD dwBufLen = sizeof(AdapterInfo);  // Save memory size of buffer

  DWORD dwStatus = GetAdaptersInfo(      // Call GetAdapterInfo
    AdapterInfo,                 // [out] buffer to receive data
    &dwBufLen);                  // [in] size of receive data buffer
//  assert(dwStatus == ERROR_SUCCESS);  // Verify return value is
                                      // valid, no buffer overflow

  PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to
                                               // current adapter info
  do {
//    PrintMACaddress(pAdapterInfo->Address); // Print MAC address

    pAdapterInfo = pAdapterInfo->Next;    // Progress through
                                          // linked list
  }
  while(pAdapterInfo);                    // Terminate if last adapter
}