Re: How to set SSID programaticaly
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 29 Jan 2008 08:18:42 -0700
Does the unit maintain the preferred list if you just set it manually with
WZC and then warm boot? Every time I've modified the preferred list myself
before, it persisted in the registry on our devices (they store the master
keys database, where things like WEP key values are stored, in the
registry). I guess you could be sure that you're flushing the registry, but
that should happen automatically any time the device suspends; maybe you're
just making the change and then pressing the reset button?
Paul T.
"Rahul P. Shukla" <RahulPShukla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E7886D6F-B7B2-4E40-B666-00B9EA370993@xxxxxxxxxxxxxxxx
Hi,
Currently, I am able to set SSID. Procedure is as:
1. Empty the WZC preferred list.
2. Add the configuration structure with desired ssid in the preferred
list.
3. Since there is only one entry in preferred list, it will connect to
that
one only.
So this way I am able to set the desired ssid.
But ???? Device is losing connection with this ssid as I warm boot the
device. After warm boot device is not connected with any ssid. It seems
that
new configuration settings are not being saved.
Can anybody tell me where I am lagging behind? I tool the help from
wzctool.cpp code.
- Rahul
"Paul G. Tobey [eMVP]" wrote:
Well, my first reaction is, "You're screwed.", but maybe that's not the
case
in your specific situation.
Some wireless cards, when they are configured for using a specific
configuration program, rather than WZC, stop looking like wireless cards
at
all to Windows CE. If that's the case, I think you're screwed unless you
know something about how the card is reconfigured to make that happen.
It
would probably be a registry setting on the card's driver, but it might
easily be different for every card.
The other way to disable WZC is to uncheck the checkbox in the network
settings that says something like "Use Windows to configure my wireless
settings." When that is unchecked,
a setting is made in the registry. I don't have a device at my current
location that I can use to find that, but you could easily export the
registry using Remote Registry Editor with the setting checked and then
again after unchecking it and difference the two files to find the
setting.
If that's how the state is being changed, which is more likely than not,
then all you'd need to do is make the suitable registry change, then
rebind
the adapter (you know how to do that, right?), causing it to reconnect to
the network using the latest registry settings. I think that should do
it.
Paul T.
<rahul.prashant.shukla@xxxxxxxxx> wrote in message
news:3cafcd3e-7dd2-4752-a4fc-cb7d5acb9eab@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
My target device is having a 3rd party XXXX Security manager (same as
microsoft WZC).
At a time one will be enable either XXXX or WZC...
So before my app run to configure SSID, I need to enable WZC (if it's
disabled ...)
How can I check whether WZC is enabled or not, if its not How can I
enable it ??
Thanks a lot ..
- Rahul
On Jan 24, 8:36 pm, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
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" <RahulPShu...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
messagenews: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" <RahulPShu...@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 ..- Hide quoted text -
- Show quoted text -
.
- References:
- How to set SSID programaticaly
- From: Rahul P. Shukla
- Re: How to set SSID programaticaly
- From: Paul G. Tobey [eMVP]
- Re: How to set SSID programaticaly
- From: Rahul P. Shukla
- Re: How to set SSID programaticaly
- From: Paul G. Tobey [eMVP]
- Re: How to set SSID programaticaly
- From: rahul . prashant . shukla
- Re: How to set SSID programaticaly
- From: Paul G. Tobey [eMVP]
- Re: How to set SSID programaticaly
- From: Rahul P. Shukla
- How to set SSID programaticaly
- Prev by Date: Re: Windows CE and Printboy
- Next by Date: Re: Need a good starting point for Windows CE
- Previous by thread: Re: How to set SSID programaticaly
- Next by thread: GWES_MGPRINT problem with SDK generation
- Index(es):
Loading