windows-nt/Source/XPSP1/NT/net/homenet/alg/exe/adapterinfo.cpp
2020-09-26 16:20:57 +08:00

63 lines
907 B
C++

/////////////////////////////////////////////////////////////////////////////
//
// CAdapterInfo
//
// AdapterInfo.cpp : Implementation of CAdapterInfo
//
#include "PreComp.h"
#include "AdapterInfo.h"
//
//
//
STDMETHODIMP
CAdapterInfo::GetAdapterIndex(
ULONG* pulAdapterIndex
)
{
*pulAdapterIndex = m_nAdapterIndex;
return S_OK;
}
//
//
//
STDMETHODIMP
CAdapterInfo::GetAdapterType(
ALG_ADAPTER_TYPE* pAdapterType
)
{
*pAdapterType = (ALG_ADAPTER_TYPE )m_eType;
return S_OK;
}
//
//
//
STDMETHODIMP
CAdapterInfo::GetAdapterAddresses(
ULONG* pulAddressCount,
ULONG** prgAddresses
)
{
*pulAddressCount = m_nAddressCount;
*prgAddresses = (ULONG*)CoTaskMemAlloc(m_nAddressCount*sizeof(ULONG));
if ( *prgAddresses == NULL )
return ERROR_OUTOFMEMORY;
memcpy(*prgAddresses, m_anAddress, m_nAddressCount*sizeof(ULONG));
return S_OK;
}