Ejemplo n.º 1
0
NDIS_STATUS
Sta11InitializeStation(
    __in  PSTATION        pStation,
    __in  PADAPTER        pAdapter,
    __in  PNIC            pNic
    )
{
    NDIS_STATUS     ndisStatus = NDIS_STATUS_SUCCESS;
    BOOLEAN         bFreeAdhoc = FALSE;

    do
    {
        pStation->pAdapter = pAdapter;
        pStation->pNic = pNic;

        // Setup default config
        StaInitializeStationConfig(pStation);

        StaInitializeBSSList(&pStation->BSSList);
        ndisStatus = StaInitializeAdHocStaInfo(pStation);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }
        bFreeAdhoc = TRUE;

        ndisStatus = StaInitializeScanContext(pStation);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }

        ndisStatus = StaInitializeConnectionContext(pStation);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }
    } while (FALSE);

    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {
        StaFreeScanContext(pStation);

        if (bFreeAdhoc)
        {
            StaFreeAdHocStaInfo(pStation);
        }
    }

    return ndisStatus;
}
Ejemplo n.º 2
0
NDIS_STATUS
Sta11InitializePort(
    _In_  PMP_PORT                Port,
    _In_  PVOID                   RegistryInformation
    )
{
    NDIS_STATUS                 ndisStatus = NDIS_STATUS_SUCCESS;
    BOOLEAN                     freeAdhoc = FALSE, freeScanContext = FALSE;
    PMP_EXTSTA_PORT             extStaPort = MP_GET_STA_PORT(Port);

    do
    {
        // Save the registry value
        extStaPort->RegInfo = (PSTA_REG_INFO)RegistryInformation;
    
        // Setup default config
        StaInitializeStationConfig(extStaPort);
        
        ndisStatus = StaInitializeAdHocStaInfo(extStaPort);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }
        freeAdhoc = TRUE;

        ndisStatus = StaInitializeScanContext(extStaPort);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }
        freeScanContext = TRUE;

        ndisStatus = StaInitializeConnectionContext(extStaPort);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }

        // Reset all the state
        StaResetStationConfig(extStaPort);
        
        //
        // Now that we are ready, setup the handlers for other data handlers
        //
        Port->RequestHandler = Sta11OidHandler;
        Port->SendEventHandler = Sta11SendEventHandler;
        Port->SendCompleteEventHandler = BasePortSendCompleteEventHandler;
        Port->ReceiveEventHandler = Sta11ReceiveEventHandler;
        Port->ReturnEventHandler = BasePortReturnEventHandler;
 
        
    } while (FALSE);

    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {
        if (freeAdhoc)
        {
            if (freeScanContext)
            {
                StaFreeScanContext(extStaPort);
            }
            
            StaFreeAdHocStaInfo(extStaPort);
        }
    }

    return ndisStatus;
}