NDISUIO - Switch between Ad-Hoc and Infrastructure mode

Discussion in 'Windows Vista Drivers' started by Marc-Aurèle Brothier, Aug 18, 2003.

  1. Hi,

    I try to switch between Ad-hoc and infrastructure mode since one week on
    my iPAQ 5550 with the NDISUIO queries but it does not want to work. I
    can only set the SSID.
    I disable the Zero Configuration service, but it doesn't help.

    To set the network mode, here is my code:

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

    if(!pnNetworkMode || !ptcDeviceName) {
    m_hRes = E_POINTER;
    }
    else {
    pSetOid = (PNDISUIO_SET_OID)&SetBuffer[0];
    pSetOid->ptcDeviceName = ptcDeviceName;
    pSetOid->Oid = OID_802_11_INFRASTRUCTURE_MODE;

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


    if(!DeviceIoControl(m_hFileHandle,IOCTL_NDISUIO_SET_OID_VALUE,(LPVOID)&SetBuffer[0],sizeof(SetBuffer),(LPVOID)&SetBuffer[0],0,
    &m_dwBytesReturned,NULL)) {
    m_hRes = E_FAIL;
    m_dwError = GetLastError();
    }
    else
    m_hRes = NOERROR;
    }

    return m_hRes;
    }


    (*pnNetworkMode = 0 for Ad-Hoc and 1 for infrastructure mode)


    I got the error 87: The parameter is incorrect, and I don't get why
    since NDIS_802_11_NETWORK_INFRASTRUCTURE is an enumeration.

    Did someone manage to switch modes with NDISUIO calls??

    Regards,
    Marc-Aurèle
     
    Marc-Aurèle Brothier, Aug 18, 2003
    #1
    1. Advertisements

  2. Just an error in the code... really sorry!
     
    Marc-Aurèle Brothier, Aug 18, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.