void GetMac(TStrings* pslStrings)
{
int ilRetVal = 0;
NCB stNetCtrlBlock;
LPVOID pASTAT;
ASTAT stAdapterStatus;
LANA_ENUM stLanEnum;
if(pslStrings != NULL) pslStrings->Clear();
memset(&stNetCtrlBlock, 0, sizeof(stNetCtrlBlock));
stNetCtrlBlock.ncb_command = NCBENUM;
stNetCtrlBlock.ncb_buffer = (UCHAR *)&stLanEnum;
stNetCtrlBlock.ncb_length = sizeof(stLanEnum);
Netbios(&stNetCtrlBlock);
ilRetVal = stLanEnum.length;
if(pslStrings != NULL)
{
for(int ilAdapter=0; ilAdapter < ilRetVal; ilAdapter++)
{
memset(&stNetCtrlBlock, 0, sizeof(stNetCtrlBlock));
stNetCtrlBlock.ncb_command = NCBRESET;
stNetCtrlBlock.ncb_lana_num = stLanEnum.lana[ilAdapter];
Netbios(&stNetCtrlBlock);
memset( &stNetCtrlBlock, 0, sizeof(stNetCtrlBlock) );
stNetCtrlBlock.ncb_command = NCBASTAT;
stNetCtrlBlock.ncb_lana_num = stLanEnum.lana[ilAdapter];
strcpy(stNetCtrlBlock.ncb_callname,"* ");
stNetCtrlBlock.ncb_length = sizeof(stAdapterStatus);
pASTAT=HeapAlloc(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|
HEAP_ZERO_MEMORY, stNetCtrlBlock.ncb_length);
if(pASTAT != NULL)
{
stNetCtrlBlock.ncb_buffer=(UCHAR *)pASTAT;
Netbios(&stNetCtrlBlock);
CopyMemory(&stAdapterStatus,stNetCtrlBlock.ncb_buffer,
sizeof(stAdapterStatus));
AnsiString slMacAddress;
for(int i =0; i < 6; i++)
{
slMacAddress +=IntToHex(stAdapterStatus.
adapt.adapter_address[i],2);
if(i<5) slMacAddress+="-";
}
HeapFree(GetProcessHeap(),0,pASTAT);
pslStrings->Add(slMacAddress);
}
else ilRetVal = 0;
}
}
}