Re: How to set SSID programaticaly



NO. I seriously doubt that anyone is going to figure this out for you. How
is your target access point configured? What authentication and encryption
options does it require? You're sure that it's completely open? No MAC
address filtering? I'm afraid that I'm not up to reading your code looking
for a byte out of place. Do you have the source code for Windows CE? You
could compare what you're doing to what WZC itself actually does when you
click Connect in the WZC dialog. If it were me, that's what I would do. I
suppose that, if you want another tangent to run with, you could get
OpenNETCF's Smart Device Framework, in which there is a set of classes and I
and others have written for WZC control, and see if it will connect you (and
if so, read the source and figure out what you're doing wrong).

What do you mean by enable/disable WZC? For what purpose would you want to
do that?

Paul T.

"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:685678F9-7E13-430E-B9F2-F73C17020631@xxxxxxxxxxxxxxxx
1). I tried to do it with the help of WZC. below is the complete code. but
when I run this code, it dissociate the current SSID, but don't set the
newly
given SSID. Can anybody please figure out the problem here .

//********************

DWORD dwInFlags = 0;
//Set SSID in ssid struct
NDIS_802_11_SSID ssid;
TCHAR* pSSId=_T("ASSET");
ULONG lSSIdLength = _tcslen(pSSId);
ssid.SsidLength = lSSIdLength;
wcstombs( (char*)ssid.Ssid , pSSId, lSSIdLength );

RAW_DATA RawData;
RawData.pData = (LPBYTE)&ssid;

INTF_ENTRY *Intf = new INTF_ENTRY();
Intf->wszGuid = _T("PRISMA021");//(LPWSTR)pAdapter->AdapterName;
Intf->rdSSID = RawData;

DWORD dwOutFlags;
uint uret = WZCQueryInterface(NULL, INTF_ALL, Intf, &dwOutFlags);
if ( uret == ERROR_SUCCESS )
{
WZC_WLAN_CONFIG *thisConfig = new WZC_WLAN_CONFIG();
thisConfig->KeyLength = 0;

thisConfig->AuthenticationMode = Ndis802_11AuthModeOpen;

// If we have no key, we should probably set this to WEP Off.
thisConfig->Privacy = Ndis802_11WEPDisabled;
thisConfig->InfrastructureMode = Ndis802_11Infrastructure;

DWORD result = WZCSetInterface(NULL, INTF_PREFLIST, Intf, &dwInFlags);
if(ERROR_SUCCESS != result)
{
CString pp;
pp.Format(_T("WZCSetInterface() failed: %d"), GetLastError());
AfxMessageBox(pp);
}
else
AfxMessageBox(_T("Done"));

delete(thisConfig);
}
else
AfxMessageBox(_T("WZCQueryInterface failed"));
delete(Intf);

//*************************

2). Another Question that how can I enable/disable the WZC from my
application? I got some blogs saying "Use "DeactivateDevice" function. The
handle of WZC you can get from
registry into HKLM\Driver\Active\XX\Hnd" but it dint work as:

HANDLE rtn = ActivateDevice(_T("4970496"), 0);

Is there any other way to enable/disable WZC???



"Paul G. Tobey [eMVP]" wrote:

2. and *is* it an open access point? They're pretty hard to find any
more.

WZC is the right way to attach to a new network. There have been
previous
posts in various Windows CE newsgroups on this topic. You can search
microsoft.public.windowsce.* using GoogleGroups advanced search:

http://groups.google.com/advanced_search?q=&hl=en&;

Paul T.

"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:8657FB65-B545-4A98-B3D9-1BC86730A325@xxxxxxxxxxxxxxxx
Hi all,
Currently I am working on a WM5/PPC 2003/WinCE5 device based
application
in
which I am using NDISUIO driver to set the SSID. I am able to scan the
SSID
list as well as Disassociate to currently associated SSID.
But I am not able to associate to SSID. It's returning always true but
not
setting the SSID. Below is the code.

Way 1: This is the first way I tried.

HANDLE hDevice = CreateFile(NDISUIO_DEVICE_NAME, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);

LPCTSTR pszSsid = L"Dev";//SSID

BYTE pBuffer[sizeof(NDISUIO_SET_OID) + sizeof(NDIS_802_11_SSID)];
PNDISUIO_SET_OID pNDISUIOSetOid = (PNDISUIO_SET_OID) pBuffer;
PNDIS_802_11_SSID pSsid = (PNDIS_802_11_SSID) pNDISUIOSetOid->Data;

pNDISUIOSetOid->ptcDeviceName = (PTCHAR) pszAdapter;
pNDISUIOSetOid->Oid = OID_802_11_SSID;

CTtoA ssid(pszSsid);
pSsid->SsidLength = min(ssid.GetLength(), sizeof(pSsid->Ssid));
memset(pSsid->Ssid, 0, sizeof(pSsid->Ssid));
memcpy(pSsid->Ssid, (LPCSTR) ssid, pSsid->SsidLength);

// DWORD dwBytesReturned = 0;

if (!DeviceIoControl(
hDevice, IOCTL_NDISUIO_SET_OID_VALUE,
pBuffer, sizeof(pBuffer),
NULL, 0,
&dwBytesReturned, NULL))
{
DWORD dwError = GetLastError();

printf("FAILED\n");
printf(" Function \"DeviceIoControl\" failed (0x%08x).\n",
dwError);
return FALSE;
}


Way 2: I got another way to do the same .
http://geekswithblogs.net/dastblog/archive/2006/12/23/101954.aspx
(please look into this option too.)
But also this way SSID couldn't be changed.

A. Can anybody tell me where I am lacking in Way 1 and Way 2?
B. Is there another way to set SSID?
C. Which one is the preferred way to do this task, using NDIS or using
WZC?

Please let me know if U knows something ..

Thanks a lot ..







.



Relevant Pages

  • Re: How to set SSID programaticaly
    ... WZC must be enabled (I have to get the way for the this ... I am setting the open key, no WEP key SSID. ... it persisted in the registry on our devices (they store the master ... Add the configuration structure with desired ssid in the preferred ...
    (microsoft.public.windowsce.embedded)
  • Re: How to set SSID programaticaly
    ... it persisted in the registry on our devices (they store the master ... I am able to set SSID. ... Empty the WZC preferred list. ... Add the configuration structure with desired ssid in the preferred ...
    (microsoft.public.windowsce.embedded)
  • Re: How to set SSID programaticaly
    ... Some wireless cards, when they are configured for using a specific ... The other way to disable WZC is to uncheck the checkbox in the network ... a setting is made in the registry. ... So before my app run to configure SSID, I need to enable WZC (if it's ...
    (microsoft.public.windowsce.embedded)
  • Re: How to set SSID programaticaly
    ... My target device is having a 3rd party ... So before my app run to configure SSID, I need to enable WZC (if it's ... ULONG lSSIdLength = _tcslen; ...
    (microsoft.public.windowsce.embedded)
  • Re: turning off wzc (zero config for 802.11)
    ... SSID value is when it comes. ... still in development so the driver is likely the problem. ... service or ndis sends the bogus ssid to disconnect. ... to a given SSID value and it just does, regardless of whether WZC is ...
    (microsoft.public.windowsce.embedded)