当前位置: 首页>>代码示例>>C++>>正文


C++ IADs::get_ADsPath方法代码示例

本文整理汇总了C++中IADs::get_ADsPath方法的典型用法代码示例。如果您正苦于以下问题:C++ IADs::get_ADsPath方法的具体用法?C++ IADs::get_ADsPath怎么用?C++ IADs::get_ADsPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IADs的用法示例。


在下文中一共展示了IADs::get_ADsPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PyIADs_getattro

PyObject* PyIADs_getattro(PyObject *ob, PyObject *obname)
{
	char *name = PYWIN_ATTR_CONVERT(obname);
	if (!name) return NULL;

	IADs *p = PyIADs::GetI(ob);
	
	// These are all BSTR values
	BSTR ret = NULL;
	HRESULT hr;
	BOOL bad = FALSE;
	Py_BEGIN_ALLOW_THREADS
	// docs refer to 'property' as AdsPath, but function is ADsPath
	// allow both
	// @prop <o PyUnicode>|ADsPath|
	// @prop <o PyUnicode>|AdsPath|Synonym for ADsPath
	if (strcmp(name, "AdsPath")==0 || strcmp(name, "ADsPath")==0)
		hr = p->get_ADsPath(&ret);
	// @prop <o PyUnicode>|Class|
	else if (strcmp(name, "Class")==0)
		hr = p->get_Class(&ret);
	// @prop <o PyUnicode>|GUID|Like the IADs method, this returns a string rather than a GUID object.
	else if (strcmp(name, "GUID")==0)
		hr = p->get_GUID(&ret);
	// @prop <o PyUnicode>|Name|
	else if (strcmp(name, "Name")==0)
		hr = p->get_Name(&ret);
	// @prop <o PyUnicode>|Parent|
	else if (strcmp(name, "Parent")==0)
		hr = p->get_Parent(&ret);
	// @prop <o PyUnicode>|Schema|
	else if (strcmp(name, "Schema")==0)
		hr = p->get_Schema(&ret);
	else
		bad = TRUE;
	Py_END_ALLOW_THREADS
	if (bad)
		return PyIBase::getattro(ob, obname);
	if (FAILED(hr))
		return PyCom_BuildPyException(hr, p, IID_IADs );
	PyObject *rc = MakeBstrToObj(ret);
	SysFreeString(ret);
	return rc;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:44,代码来源:PyIADs.cpp

示例2: OnDblClkInterfaces

void CADQIDlg::OnDblClkInterfaces()
{
    CString s;
    int xx=0;
    int idx;
    IUnknown *pNewUnk = NULL;


    idx = m_cListIf.GetCurSel();
    if ( idx == LB_ERR )
    {
        MessageBeep(0);
        return;
    }


    CWaitCursor wait;
    m_cListIf.GetText( idx, s );


    //////////////////////////////////////////////////////////////
    //
    // Find the appropriate dialog box to display
    //
    /////////////////////////////////////////////////////////////////
    while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) && s != adsiIfs[xx].szIf  )
    {
        xx++;
    }

    ASSERT( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) );
    if ( adsiIfs[xx].pFn )
    {
        m_pUnk->AddRef();
        (*adsiIfs[xx].pFn)( m_pUnk, &pNewUnk );
    }
    else
    {
        wait.Restore();
        AfxMessageBox(_T("No UI implemented yet"));
    }



    ////////////////////////////////////////////////////
    // if IADsOpenObject is selected, special care
    ///////////////////////////////////////////////////
    if ( pNewUnk )
    {

        HRESULT hr;
        BSTR  bstr;
        IADs  *pADs;

        hr = pNewUnk->QueryInterface( IID_IADs, (void**) &pADs );
        if ( SUCCEEDED(hr) )
        {
            pADs->get_ADsPath( &bstr );
        }
        pADs->Release();

        m_sADsPath = bstr;
        SysFreeString( bstr );


        m_pUnk->Release(); // old ads iunknown path;
        m_pUnk = pNewUnk;

        UpdateData(FALSE);
        EnumerateInterface();

    }


}
开发者ID:dbremner,项目名称:Windows-classic-samples,代码行数:75,代码来源:ADQIDlg.cpp

示例3: EnumAllObject

HRESULT EnumAllObject(LPWSTR pszADsPath, int indent)
{
    ULONG cElementFetched = 0L;
    IEnumVARIANT * pEnumVariant = NULL;
    VARIANT VariantArray[MAX_ENUM];
    HRESULT hr = S_OK;
    IADsContainer * pADsContainer = NULL;
    DWORD dwObjects = 0, dwEnumCount = 0, i = 0;
    BOOL  fContinue = TRUE;


    hr = ADsGetObject(
             pszADsPath,
             IID_IADsContainer,
             (void **)&pADsContainer
         );


    if (FAILED(hr)) {

        printf("\"%S\" is not a valid container object.\n", pszADsPath);
        goto exitpoint;
    }

    hr = ADsBuildEnumerator(
             pADsContainer,
             &pEnumVariant
         );

    if (FAILED(hr))
    {
        printf("ADsBuildEnumerator failed with %lx\n", hr);
        goto exitpoint;
    }

    fContinue = TRUE;
    while (fContinue) {

        IADs *pObject;

        hr = ADsEnumerateNext(
                 pEnumVariant,
                 MAX_ENUM,
                 VariantArray,
                 &cElementFetched
             );

        if (FAILED(hr))
        {
            printf("ADsEnumerateNext failed with %lx\n", hr);
            goto exitpoint;
        }

        if (hr == S_FALSE) {
            fContinue = FALSE;
        }

        dwEnumCount++;

        for (i = 0; i < cElementFetched; i++) {

            IDispatch *pDispatch = NULL;
            BSTR        bstrADsPath = NULL;

            pDispatch = VariantArray[i].pdispVal;

            hr = V_DISPATCH(VariantArray + i)->QueryInterface(IID_IADs, (void **)&pObject);

            if (SUCCEEDED(hr))
            {
                pObject->get_ADsPath(&bstrADsPath);
                printf("%S\n", bstrADsPath);
                EnumAllObject(bstrADsPath, indent + 2);
            }
            pObject->Release();
            VariantClear(VariantArray + i);
            SysFreeString(bstrADsPath);
        }

        dwObjects += cElementFetched;
    }

    printf("Total Number of Objects enumerated is %d\n", dwObjects);

exitpoint:
    if (pEnumVariant) {
        ADsFreeEnumerator(pEnumVariant);
    }

    if (pADsContainer) {
        pADsContainer->Release();
    }

    return(hr);
}
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:95,代码来源:DomainSearch.cpp

示例4: RecursiveIsMember

BOOL RecursiveIsMember(IADsGroup * pADsGroup,LPWSTR pwszMemberGUID,LPWSTR pwszMemberPath, 
                                             BOOL bVerbose, LPOLESTR  pwszUser, LPOLESTR pwszPassword)
{
    HRESULT         hr                = S_OK;     // COM Result Code
    IADsMembers *   pADsMembers       = NULL;     // Ptr to Members of the IADsGroup
    BOOL            fContinue         = TRUE;     // Looping Variable
    IEnumVARIANT *  pEnumVariant      = NULL;     // Ptr to the Enum variant
    IUnknown *      pUnknown          = NULL;     // IUnknown for getting the ENUM initially
    VARIANT         VariantArray[FETCH_NUM];      // Variant array for temp holding returned data
    ULONG           ulElementsFetched = NULL;     // Number of elements retrieved
    BSTR            bsGroupPath       = NULL;
    BOOL            bRet              = FALSE;

    if(!pADsGroup || !pwszMemberGUID || !pwszMemberPath)
    {
        return FALSE;
    }
 
    // Get the path of the object passed in
    hr = pADsGroup->get_ADsPath(&bsGroupPath);
 
    if (!SUCCEEDED(hr))
        return hr;
 
    if (bVerbose)
    {
        WCHAR pwszOutput[2048];
        wsprintf(pwszOutput,L"Checking the Group:\n\n%s\n\n for the member:\n\n%s\n\n",bsGroupPath,pwszMemberPath);
        PrintBanner(pwszOutput);
    }
 
    // Get an interface pointer to the IADsCollection of members
    hr = pADsGroup->Members(&pADsMembers);
 
    if (SUCCEEDED(hr))
    {
        // Query the IADsCollection of members for a new ENUM Interface
        // Be aware that the enum comes back as an IUnknown *
        hr = pADsMembers->get__NewEnum(&pUnknown);
 
        if (SUCCEEDED(hr))
        {
            // QI the IUnknown * for an IEnumVARIANT interface
            hr = pUnknown->QueryInterface(IID_IEnumVARIANT, (void **)&pEnumVariant);
 
            if (SUCCEEDED(hr))
            {
                // While have not hit errors or end of data....
                while (fContinue) 
                {
                   ulElementsFetched = 0;
                    // Get a "batch" number of group members-number of rows specified by FETCH_NUM
                    hr = ADsEnumerateNext(pEnumVariant, FETCH_NUM, VariantArray, &ulElementsFetched);
 
                    if (ulElementsFetched )
                    {
                        // Loop through the current batch-printing the path for each member.
                        for (ULONG i = 0; i < ulElementsFetched; i++ ) 
                        {
                            IDispatch * pDispatch         = NULL; // ptr for holding dispath of element
                            BSTR        bstrCurrentPath   = NULL; // Holds path of object
                            BSTR        bstrGuidCurrent   = NULL; // Holds path of object
                            IDirectoryObject * pIDOCurrent = NULL;// Holds the current object          
 
                            // Get the dispatch ptr for the variant
                            pDispatch = VariantArray[i].pdispVal;
//                            assert(HAS_BIT_STYLE(VariantArray[i].vt,VT_DISPATCH));
 
                            // Get the IADs interface for the "member" of this group
                            hr = pDispatch->QueryInterface(IID_IDirectoryObject,
                                                           (VOID **) &pIDOCurrent ) ;
 
                            if (SUCCEEDED(hr))
                            {
                                // Get the GUID for the current object
                                hr = GetObjectGuid(pIDOCurrent,bstrGuidCurrent);
 
                                if (FAILED(hr))
                                    return hr;
 
                                IADs * pIADsCurrent = NULL;
 
                                // Retrieve the IADs Interface for the current object
                                hr = pIDOCurrent->QueryInterface(IID_IADs,(void**)&pIADsCurrent);
                                if (FAILED(hr))
                                    return hr;
 
                                // Get the ADsPath property for this member
                                hr = pIADsCurrent->get_ADsPath(&bstrCurrentPath);
 
                                if (SUCCEEDED(hr))
                                {
                                    if (bVerbose)
                                        wprintf(L"Comparing:\n\n%s\nWITH:\n%s\n\n",bstrGuidCurrent,pwszMemberGUID);
                                    
                                    // Verify that the member of this group is Equal to passed.
                                    if (_wcsicmp(bstrGuidCurrent,pwszMemberGUID)==0)
                                    {
                                        if (bVerbose)
                                            wprintf(L"!!!!!Object:\n\n%s\n\nIs a member of\n\n%s\n\n",pwszMemberPath,bstrGuidCurrent);   
//.........这里部分代码省略.........
开发者ID:copilot-com,项目名称:CopilotVNC,代码行数:101,代码来源:ldapAuth.cpp


注:本文中的IADs::get_ADsPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。