Esempio n. 1
0
void CProviderTableDlg::OnOpenProfileSection()
{
    HRESULT			hRes = S_OK;

    if (!m_lpProviderAdmin) return;

    CEditor MyUID(
        this,
        IDS_OPENPROFSECT,
        IDS_OPENPROFSECTPROMPT,
        2,
        CEDITOR_BUTTON_OK|CEDITOR_BUTTON_CANCEL);

    MyUID.InitPane(0, CreateDropDownGuidPane(IDS_MAPIUID, false));
    MyUID.InitPane(1, CreateCheckPane(IDS_MAPIUIDBYTESWAPPED, false, false));

    WC_H(MyUID.DisplayDialog());
    if (S_OK != hRes) return;

    GUID guid = {0};
    SBinary MapiUID = {sizeof(GUID),(LPBYTE) &guid};
    (void) MyUID.GetSelectedGUID(0, MyUID.GetCheck(1), &guid);

    LPPROFSECT lpProfSect = NULL;
    EC_H(OpenProfileSection(
             m_lpProviderAdmin,
             &MapiUID,
             &lpProfSect));
    if (lpProfSect)
    {
        LPMAPIPROP lpTemp = NULL;
        EC_MAPI(lpProfSect->QueryInterface(IID_IMAPIProp,(LPVOID*) &lpTemp));
        if (lpTemp)
        {
            EC_H(DisplayObject(
                     lpTemp,
                     MAPI_PROFSECT,
                     otContents,
                     this));
            lpTemp->Release();
        }
        lpProfSect->Release();
    }
    MAPIFreeBuffer(MapiUID.lpb);
} // CProviderTableDlg::OnOpenProfileSection
Esempio n. 2
0
void CBaseDialog::OnOpenEntryID(_In_opt_ LPSBinary lpBin)
{
	HRESULT			hRes = S_OK;
	if (!m_lpMapiObjects) return;

	CEditor MyEID(
		this,
		IDS_OPENEID,
		IDS_OPENEIDPROMPT,
		10,
		CEDITOR_BUTTON_OK | CEDITOR_BUTTON_CANCEL);

	MyEID.InitPane(0, CreateSingleLinePane(IDS_EID, BinToHexString(lpBin, false), false));

	LPMDB lpMDB = m_lpMapiObjects->GetMDB(); // do not release
	MyEID.InitPane(1, CreateCheckPane(IDS_USEMDB, lpMDB ? true : false, lpMDB ? false : true));

	LPADRBOOK lpAB = m_lpMapiObjects->GetAddrBook(false); // do not release
	MyEID.InitPane(2, CreateCheckPane(IDS_USEAB, lpAB ? true : false, lpAB ? false : true));

	LPMAPISESSION lpMAPISession = m_lpMapiObjects->GetSession(); // do not release
	MyEID.InitPane(3, CreateCheckPane(IDS_SESSION, lpMAPISession ? true : false, lpMAPISession ? false : true));

	MyEID.InitPane(4, CreateCheckPane(IDS_PASSMAPIMODIFY, false, false));

	MyEID.InitPane(5, CreateCheckPane(IDS_PASSMAPINOCACHE, false, false));

	MyEID.InitPane(6, CreateCheckPane(IDS_PASSMAPICACHEONLY, false, false));

	MyEID.InitPane(7, CreateCheckPane(IDS_EIDBASE64ENCODED, false, false));

	MyEID.InitPane(8, CreateCheckPane(IDS_ATTEMPTIADDRBOOKDETAILSCALL, false, lpAB ? false : true));

	MyEID.InitPane(9, CreateCheckPane(IDS_EIDISCONTAB, false, false));

	WC_H(MyEID.DisplayDialog());
	if (S_OK != hRes) return;

	// Get the entry ID as a binary
	LPENTRYID lpEnteredEntryID = NULL;
	LPENTRYID lpEntryID = NULL;
	size_t cbBin = NULL;
	EC_H(MyEID.GetEntryID(0, MyEID.GetCheck(7), &cbBin, &lpEnteredEntryID));

	if (MyEID.GetCheck(9) && lpEnteredEntryID)
	{
		(void)UnwrapContactEntryID((ULONG)cbBin, (LPBYTE)lpEnteredEntryID, (ULONG*)&cbBin, (LPBYTE*)&lpEntryID);
	}
	else
	{
		lpEntryID = lpEnteredEntryID;
	}

	if (MyEID.GetCheck(8) && lpAB) // Do IAddrBook->Details here
	{
		ULONG_PTR ulUIParam = (ULONG_PTR)(void*)m_hWnd;

		EC_H_CANCEL(lpAB->Details(
			&ulUIParam,
			NULL,
			NULL,
			(ULONG)cbBin,
			lpEntryID,
			NULL,
			NULL,
			NULL,
			DIALOG_MODAL)); // API doesn't like unicode
	}
	else
	{
		LPUNKNOWN lpUnk = NULL;
		ULONG ulObjType = NULL;

		EC_H(CallOpenEntry(
			MyEID.GetCheck(1) ? lpMDB : 0,
			MyEID.GetCheck(2) ? lpAB : 0,
			NULL,
			MyEID.GetCheck(3) ? lpMAPISession : 0,
			(ULONG)cbBin,
			lpEntryID,
			NULL,
			(MyEID.GetCheck(4) ? MAPI_MODIFY : MAPI_BEST_ACCESS) |
			(MyEID.GetCheck(5) ? MAPI_NO_CACHE : 0) |
			(MyEID.GetCheck(6) ? MAPI_CACHE_ONLY : 0),
			&ulObjType,
			&lpUnk));

		if (lpUnk)
		{
			LPWSTR szFlags = NULL;
			InterpretNumberAsStringProp(ulObjType, PR_OBJECT_TYPE, &szFlags);
			DebugPrint(DBGGeneric, _T("OnOpenEntryID: Got object (%p) of type 0x%08X = %ws\n"), lpUnk, ulObjType, szFlags);
			delete[] szFlags;
			szFlags = NULL;

			LPMAPIPROP lpTemp = NULL;
			WC_MAPI(lpUnk->QueryInterface(IID_IMAPIProp, (LPVOID*)&lpTemp));
			if (lpTemp)
			{
				WC_H(DisplayObject(
					lpTemp,
					ulObjType,
					otHierarchy,
					this));
				lpTemp->Release();
			}
			lpUnk->Release();
		}
	}

	delete[] lpEnteredEntryID;
} // CBaseDialog::OnOpenEntryID