Source code of Windows XP (NT5)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1995
//
// File: cUser.cxx
//
// Contents: User object
//
// History: 11-1-95 krishnag Created.
//
//----------------------------------------------------------------------------
#include "procs.hxx"
#pragma hdrstop
#include "nds.hxx"
// Class CNDSUserCollection
DEFINE_IDispatch_Implementation(CNDSUserCollection)
CNDSUserCollection::CNDSUserCollection(): _ADsPath(NULL), _pDispMgr(NULL) { VariantInit(&_vMembers); VariantInit(&_vFilter); ENLIST_TRACKING(CNDSUserCollection); }
HRESULT CNDSUserCollection::CreateUserCollection( BSTR bstrADsPath, VARIANT varMembers, REFIID riid, void **ppvObj ) { CNDSUserCollection FAR * pUser = NULL; HRESULT hr = S_OK;
hr = AllocateUserCollectionObject(&pUser); BAIL_ON_FAILURE(hr);
hr = ADsAllocString(bstrADsPath, &(pUser->_ADsPath)); BAIL_ON_FAILURE(hr);
hr = VariantCopy(&(pUser->_vMembers), &varMembers); BAIL_ON_FAILURE(hr);
hr = pUser->QueryInterface(riid, ppvObj); BAIL_ON_FAILURE(hr);
pUser->Release(); RRETURN(hr);
error: delete pUser;
RRETURN(hr);
}
CNDSUserCollection::~CNDSUserCollection( ) { VariantClear(&_vMembers); VariantClear(&_vFilter); delete _pDispMgr; }
STDMETHODIMP CNDSUserCollection::QueryInterface( REFIID iid, LPVOID FAR* ppv ) { if (ppv == NULL) { RRETURN(E_POINTER); } if (IsEqualIID(iid, IID_IUnknown)) { *ppv = (IADsMembers FAR *) this; } else if (IsEqualIID(iid, IID_IADsMembers)) { *ppv = (IADsMembers FAR *) this; } else if (IsEqualIID(iid, IID_IDispatch)) { *ppv = (IADsMembers FAR *) this; } else { *ppv = NULL; return E_NOINTERFACE; } AddRef(); return NOERROR; }
STDMETHODIMP CNDSUserCollection::get_Count(long FAR* retval) { RRETURN(E_NOTIMPL); }
STDMETHODIMP CNDSUserCollection::get_Filter(THIS_ VARIANT FAR* pVar) { VariantInit(pVar); RRETURN(VariantCopy(pVar, &_vFilter)); }
STDMETHODIMP CNDSUserCollection::put_Filter(THIS_ VARIANT Var) { VariantClear(&_vFilter); RRETURN(VariantCopy(&_vFilter, &Var)); }
STDMETHODIMP CNDSUserCollection::get__NewEnum( THIS_ IUnknown * FAR* retval ) { HRESULT hr; IUnknown FAR* punkEnum=NULL; IEnumVARIANT * penum = NULL;
*retval = NULL;
hr = CNDSUserCollectionEnum::Create( _ADsPath, (CNDSUserCollectionEnum **)&penum, _vMembers, _Credentials ); BAIL_ON_FAILURE(hr);
hr = penum->QueryInterface( IID_IUnknown, (VOID FAR* FAR*)retval ); BAIL_ON_FAILURE(hr);
if (penum) { penum->Release(); }
RRETURN(NOERROR);
error:
if (penum) { delete penum; }
RRETURN(hr); }
HRESULT CNDSUserCollection::AllocateUserCollectionObject( CNDSUserCollection ** ppUser ) { CNDSUserCollection FAR * pUser = NULL; CDispatchMgr FAR * pDispMgr = NULL; HRESULT hr = S_OK;
pUser = new CNDSUserCollection(); if (pUser == NULL) { hr = E_OUTOFMEMORY; } BAIL_ON_FAILURE(hr);
pDispMgr = new CDispatchMgr; if (pDispMgr == NULL) { hr = E_OUTOFMEMORY; } BAIL_ON_FAILURE(hr);
hr = LoadTypeInfoEntry(pDispMgr, LIBID_ADs, IID_IADsMembers, (IADsMembers *)pUser, DISPID_NEWENUM ); BAIL_ON_FAILURE(hr);
pUser->_pDispMgr = pDispMgr; *ppUser = pUser;
RRETURN(hr);
error: delete pDispMgr;
RRETURN(hr);
}
|