Beispiel #1
0
std::string GetNetBiosMacAddresses()
{
	NCB ncb; 
	UCHAR uRetCode; 
	LANA_ENUM lana_enum; 
	memset( &ncb, 0, sizeof( ncb ) ); 
	ncb.ncb_command = NCBENUM; 

	ncb.ncb_buffer = (unsigned char *) &lana_enum; 
	ncb.ncb_length = sizeof( lana_enum ); 

	uRetCode = Netbios( &ncb ); 
	//printf( "The NCBENUM return code is:0x%x \n", uRetCode );
	std::string vAdd;
	if ( uRetCode == 0 ) 
	{ 
		//printf( "Ethernet Count is : %d\n\n", lana_enum.length); 
		for ( int i=0; i < lana_enum.length; ++i )
		{
			std::string s = getmac_one( lana_enum.lana[i] ); 
			if( ! s.empty() )
			{
				vAdd.append( s );
			}
		}
	}
	return vAdd;
}
Beispiel #2
0
bool CFile::GetMacAddress(char sMac[7], bool bWalk)
{
	sMac[6] = '\0';
	for(int i=0; i<100; ++i)
	{
		if(!getmac_one(i, sMac))
			return true;
		if(!bWalk)
			break;
	}
	return false;
}