Setting up Ad-hoc connection on WinCE device using Network Driver IOCTLs and OIDs


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Setting up Ad-hoc connection on WinCE device using Network Driver IOCTLs and OIDs

  1. #1
    Join Date
    Oct 2006
    Posts
    2

    Question Setting up Ad-hoc connection on WinCE device using Network Driver IOCTLs and OIDs

    Hello.

    I am creating a library for Win CE 5.0 in eVC++ 4.0. This library will allow application developers to programmatically set up wireless connection.

    I have decided to use DeviceIoControl function to communicate with network driver using Network Driver IOCTLs and OIDs ( for reference see Network Driver Reference ).

    To set up wireless connection using infrastructure mode I do following operations:

    1. Set OID_802_11_INFRASTRUCTURE_MODE to value Ndis802_11Infrastructure
    2. Set OID_802_11_AUTHENTICATION_MODE to value Ndis802_11AuthModeOpen or Ndis802_11AuthModeShared
    3. Set OID_802_11_WEP_STATUS to value Ndis802_11WEPDisabled or Ndis802_11WEPEnabled
    4. If WEP is enabled, set OID_802_11_ADD_WEP to value of specified WEP key and index
    5. Set OID_802_11_SSID to value of specified network name

    This works for me.

    Now, what is my problem:
    I am trying to set up Ad-hoc (IBSS mode) connection, so I simply tried to change Ndis802_11Infrastructure to Ndis802_11IBSS in the first step. But it does not work (connection is not successfully set-up).

    I also set up static addresses on both devices which I was trying to interconnect and I have switched off WZCTOOL in "Advanced Wireless Settings" dialog. (I think that WZC service cannot be disabled on my device, because it is not listed in "services list" command output.)

    I think I am missing some operations to be done or I am using incorrect order of operations which I have stated above.

    I will appreciate your help. Thanks.

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    what is the error message you're getting? It could be an authrozation problem, unsupported mode, and just about a dozen more causes?
    Danny Kalev

  3. #3
    Join Date
    Oct 2006
    Posts
    2
    Quote Originally Posted by Danny
    what is the error message you're getting? It could be an authrozation problem, unsupported mode, and just about a dozen more causes?
    Danny, thank you for your reply.

    About error message:
    As I wrote, I use DeviceIoControl function. To set those settings I use 'IOCTL_NDISUIO_SET_OID_VALUE' as a dwIoControlCode parameter.
    Now, this DeviceIoControl function is successful in all calls I have listed previously. So I am getting no error message.

    I have no clue what I am doing wrong.

    I have made a test to interconnect two wireless devices (WinCE 5.0 platform) using Ad-hoc mode:
    1. I set appropriate static IP addresses on both devices (when device is disconnected, 'ipconfig' command will show '0.0.0.0' IP address);
    2. On 1st device I added new Ad-hoc network using WZCTOOL (No WEP, Open auth.);
    3a. On 2nd device, when that new network had shown on available network list, I chose it from the list and instructed WZCTOOL to connect to it. Then 'ipconfig' shown static IP address which I had previously set in step 1 and systray icon of the wireless interface indicated connected state. So, it worked when I used only WZCTOOL.
    3b. As an alternative to the step (3a), I tried to use 'DeviceIoControl' function and IOCTLs and OIDs (on 2nd device) which I have described in my first post (I had disabled WZCTOOL on 2nd device first). All DeviceIoControl calls were successful, but neither 'ipconfig' shown non-zero IP address nor systray icon indicated connected state.

    Maybe this would clarify my problem.

  4. #4
    Join Date
    Dec 2006
    Posts
    1
    Hi,
    As per ur steps for wireless connection using Infrastructure Mode is not working for me:

    Could please check out the below code for any problems:

    I am working on WM5.0 + PocketPC + Visual studio 2005

    Code:

    HRESULT Cap_listDlg::SetNetworkMode(int *pnNetworkMode)
    {
    UCHAR SetBuffer[sizeof(NDIS_OID) + sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)];
    PNDISUIO_SET_OID pSetOid;

    if (!pnNetworkMode)
    {
    m_hRes = E_POINTER;
    }

    else
    {
    pSetOid = (PNDISUIO_SET_OID) &SetBuffer[0];
    pSetOid->ptcDeviceName = _T("TIACXWLN1");//m_DeviceName;
    pSetOid->Oid = OID_802_11_INFRASTRUCTURE_MODE;

    memcpy(&pSetOid->Data[0], pnNetworkMode, sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE));

    if (!DeviceIoControl(m_ndis_driver_hndl,
    IOCTL_NDISUIO_SET_OID_VALUE,
    (LPVOID) &SetBuffer[0],
    sizeof(SetBuffer),
    (LPVOID) &SetBuffer[0],
    0,
    &m_dwBytesReturned,
    NULL))
    {
    m_dwError = GetLastError();
    fprintf(ap_fp,"IOCTL SET_NETWORK_MODE failed: %d\n", m_dwError);
    m_hRes = E_FAIL;
    }
    }

    return m_hRes;
    }

    The same case for Authentication case also.

    But I am able to set SSID.

    Could please send me ur code for wireless connection in infrastructure mode or just send what's problem in the above code

    thanks
    Phani

  5. #5
    Join Date
    Jan 2008
    Posts
    1
    Quote Originally Posted by phani.dv
    Hi,
    As per ur steps for wireless connection using Infrastructure Mode is not working for me:

    Could please check out the below code for any problems:

    I am working on WM5.0 + PocketPC + Visual studio 2005

    Code:

    HRESULT Cap_listDlg::SetNetworkMode(int *pnNetworkMode)
    {
    UCHAR SetBuffer[sizeof(NDIS_OID) + sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)];
    PNDISUIO_SET_OID pSetOid;

    if (!pnNetworkMode)
    {
    m_hRes = E_POINTER;
    }

    else
    {
    pSetOid = (PNDISUIO_SET_OID) &SetBuffer[0];
    pSetOid->ptcDeviceName = _T("TIACXWLN1");//m_DeviceName;
    pSetOid->Oid = OID_802_11_INFRASTRUCTURE_MODE;

    memcpy(&pSetOid->Data[0], pnNetworkMode, sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE));

    if (!DeviceIoControl(m_ndis_driver_hndl,
    IOCTL_NDISUIO_SET_OID_VALUE,
    (LPVOID) &SetBuffer[0],
    sizeof(SetBuffer),
    (LPVOID) &SetBuffer[0],
    0,
    &m_dwBytesReturned,
    NULL))
    {
    m_dwError = GetLastError();
    fprintf(ap_fp,"IOCTL SET_NETWORK_MODE failed: %d\n", m_dwError);
    m_hRes = E_FAIL;
    }
    }

    return m_hRes;
    }

    The same case for Authentication case also.

    But I am able to set SSID.

    Could please send me ur code for wireless connection in infrastructure mode or just send what's problem in the above code

    thanks
    Phani
    I am facing the same problem of setting the oid
    my deviceiocontrol returns 0 but value is not set
    please help
    were you able to solve this problem

  6. #6
    Join Date
    Jul 2014
    Posts
    1
    Quote Originally Posted by vasudhaverma View Post
    I am facing the same problem of setting the oid
    my deviceiocontrol returns 0 but value is not set
    please help
    were you able to solve this problem
    Did you resolve the problem? I would like to do the same

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center