Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wireless SSID - Is it Stored on Windows CE Device?

Status
Not open for further replies.

mbrodsky

Programmer
Mar 13, 2006
1
0
0
US
I am in need of being able to programmatically detect the SSID of the router my Windows CE device is currently connected to.

Does anyone know if the SSID is stored either in the registry, or in a text file, or somewhere I can access (other than the built-in CE wireless application?)

Or, if you know how to programmatically access it with VB.net (for Compact Framework), that would be great too!

Thank you very much!!!

-Mark
 
I already generated the SSID using this any one of this two method, try to modifie it in order to obtain exactly the string represinting the SSID and not only checking it's existing.
Sorry this source code is in c and not in vb. you can hide them in a dll as it was and call it from your vb application
you can visit this link to get further details the building of the dll and others informations which can be obtained about the device.


extern "C" __declspec(dllexport) bool _stdcall getMAC(unsigned char bMac[6])
{/*======*/
wchar_t NameDev[256];
HANDLE hAdapter= NULL;
const unsigned short LENGHT_MAC = 6;
/*======*/

bool bRet = false;
const unsigned int iDim = (sizeof(NDISUIO_QUERY_OID) + (sizeof(unsigned char) * LENGHT_MAC));

UCHAR QueryBuffer[iDim];
memset(QueryBuffer, 0x00, iDim);

PNDISUIO_QUERY_OID pQueryOid;
pQueryOid = reinterpret_cast<PNDISUIO_QUERY_OID>(QueryBuffer);

pQueryOid->ptcDeviceName = NameDev;
pQueryOid->Oid = OID_802_3_CURRENT_ADDRESS;
DWORD dwBytesReturned = 0;

int iRetVal = 0;
iRetVal = DeviceIoControl( hAdapter,
IOCTL_NDISUIO_QUERY_OID_VALUE,
(LPVOID) pQueryOid,
sizeof(QueryBuffer),//1024, //sizeof(NDISUIO_QUERY_OID) + sizeof(DWORD),
(LPVOID) pQueryOid,
sizeof(QueryBuffer),//1024,
&dwBytesReturned,
NULL
);
//iRetVal: non-zero indica successo -- zero indica failure
if (bRet = (iRetVal != 0))
{
for (int i =0; i< LENGHT_MAC; i++)
bMac = pQueryOid->Data;
}
return bRet;
}




/*********************/
extern "C" __declspec(dllexport) bool _stdcall getCurrentBSSID(unsigned char bMac[6])
{ /*======*/
wchar_t NameDev[256];
HANDLE hAdapter= NULL;
const unsigned short LENGHT_MAC = 6;
/*======*/

bool bRet = false;
const unsigned int iDim = (sizeof(NDISUIO_QUERY_OID) + (sizeof(unsigned char) * LENGHT_MAC));

UCHAR QueryBuffer[iDim];
memset(QueryBuffer, 0x00, iDim);
memset(bMac, 0x00, LENGHT_MAC);

PNDISUIO_QUERY_OID pQueryOid;
pQueryOid = reinterpret_cast<PNDISUIO_QUERY_OID>(QueryBuffer);

pQueryOid->ptcDeviceName = NameDev;
pQueryOid->Oid = OID_802_11_BSSID;
DWORD dwBytesReturned = 0;

int iRetVal = 0;
iRetVal = DeviceIoControl( hAdapter,
IOCTL_NDISUIO_QUERY_OID_VALUE,
(LPVOID) pQueryOid,
sizeof(QueryBuffer),//1024, //sizeof(NDISUIO_QUERY_OID) + sizeof(DWORD),
(LPVOID) pQueryOid,
sizeof(QueryBuffer),//1024,
&dwBytesReturned,
NULL
);
//iRetVal: non-zero indica successo -- zero indica failure
if (bRet = (iRetVal != 0))
{
memcpy(bMac, pQueryOid->Data, LENGHT_MAC);
/*
for (int i =0; i< LENGHT_MAC; i++)
bMac = pQueryOid->Data;
*/
}
return bRet;
}

regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top