Пример #1
0
//
// Get the list of ICS connections
//
void
CIcsManager::GetIcsConnections(
    CRefObjList<CIcsConnectionInfo *> & ConnectionList
    )
{
    // remove all old entries
    ConnectionList.RemoveAllEntries();

    // add connections
    _ASSERT(m_pList);

    for (long i = 0; i < m_lNumConns; i++)
    {
        CIcsConnectionInfo * pConnInfo = nullptr;

        pConnInfo = new(std::nothrow) CIcsConnectionInfo(m_pList[i]);

        if (nullptr == pConnInfo)
        {
            break;
        }

        ConnectionList.AddTail(pConnInfo);
    }
}
HRESULT 
CWlanManager::GetStaionList(
    CRefObjList<CWlanStation*>& StationList
    )
{
    HRESULT hr = S_OK;

    Lock();

    if (!m_Initialized)
    {
        BAIL_ON_WIN32_ERROR(ERROR_INVALID_STATE, hr);
    }

    if (m_HostedNetworkState != wlan_hosted_network_active)
    {
        BAIL_ON_WIN32_ERROR(ERROR_INVALID_STATE, hr);
    }

    //
    // Remove old entries
    //
    StationList.RemoveAllEntries();

    //
    // Copy all the stations to the list
    //
    for (size_t i = 0; i < m_StationList.GetCount(); i++)
    {
        CWlanStation* pStation = m_StationList.GetAt(m_StationList.FindIndex(i));
        _ASSERT(pStation != NULL);

        pStation->AddRef();
        StationList.AddTail(pStation);
    }

error:
    Unlock();

    return hr;
}