Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$ ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.0.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
namespace {
const char compname[] = "System\\CurrentControlSet\\Control\\ComputerName\\ComputerName";
}
bool GetCompName()
{
HKEY hk = 0;
char name[MAX_COMPUTERNAME_LENGTH + 1];
DWORD psz = sizeof name;
if (RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
compname,
0,
KEY_READ,
&hk) == ERROR_SUCCESS)
{
if (RegQueryValueEx(
hk,
"ComputerName",
0, 0,
(LPBYTE)name,
&psz
) == ERROR_SUCCESS)
{
Info::printf("Computer Name",name);
}
else
{
Info::printf(0,"*** Can\'t get %s value.",compname);
return false;
}
if (RegCloseKey(hk) != ERROR_SUCCESS)
{
Info::printf(0,"*** Can\t close %s Registry key.",compname);
// Info::print();
// exit(3);
}
}
else
{
Info::printf("Computer Name",""); // Unknown computer name.
}
/*
if (GetComputerName(name,&psz))
printf("=== GetComputername %.40s\n",name);
else
printf("*** GetComputerName failed.\n");
*/
return true;
}
namespace { // Locals
typedef struct _ASTAT_
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
}ASTAT, * PASTAT;
ASTAT Adapter;
char MAC_addr[16]; // static MAC addr string (12 hexas).
int errCnt = 0; // call errors count.
} // End of locals.
int errMAC()
{
return errCnt;
}
/**
* Using internal static storage area.
*/
const char* GetMAC()
{
NCB Ncb;
UCHAR uRetCode;
unsigned char NetName[50];
LANA_ENUM lenum;
int i;
errCnt = 0;
memset(NetName,0,sizeof NetName);
memset( &Ncb, 0, sizeof(Ncb) );
Ncb.ncb_command = NCBENUM;
Ncb.ncb_buffer = (UCHAR *)&lenum;
Ncb.ncb_length = sizeof(lenum);
uRetCode = Netbios( &Ncb );
if (uRetCode)
{
++errCnt;
return MAC_addr;
//printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
}
for (i = 0; i < lenum.length ;i++)
{
memset( &Ncb, 0, sizeof(Ncb) );
Ncb.ncb_command = NCBRESET;
Ncb.ncb_lana_num = lenum.lana[i];
uRetCode = Netbios( &Ncb );
if (uRetCode)
{
// printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
// lenum.lana[i], uRetCode );
++errCnt;
continue;
}
memset( &Ncb, 0, sizeof (Ncb) );
Ncb.ncb_command = NCBASTAT;
Ncb.ncb_lana_num = lenum.lana[i];
strcpy( (char*)Ncb.ncb_callname, "* " );
Ncb.ncb_buffer = (BYTE *) &Adapter;
Ncb.ncb_length = sizeof(Adapter);
uRetCode = Netbios( &Ncb );
if (uRetCode)
{
++errCnt;
continue;
// printf("The NCBASTAT on LANA %d return code is: 0x%x \n",
// lenum.lana[i], uRetCode );
}
else// ( uRetCode == 0 )
{
if (i && memcmp(NetName,Adapter.adapt.adapter_address,6) == 0)
continue;
else
memcpy(NetName,Adapter.adapt.adapter_address,6);
/*
printf("The Ethernet Number on LANA %d is:"
"%02x%02x%02x%02x%02x%02x\n",
lenum.lana[i],
*/
sprintf(MAC_addr,"%02X%02X%02X%02X%02X%02X",
NetName[0],
NetName[1],
NetName[2],
NetName[3],
NetName[4],
NetName[5]);
}
}
return MAC_addr;
}