本文整理汇总了C++中MAPIFreeBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ MAPIFreeBuffer函数的具体用法?C++ MAPIFreeBuffer怎么用?C++ MAPIFreeBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAPIFreeBuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
LPSPropValue CMapiApi::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
{
if (!pProp)
return( NULL);
int sz = CbNewSPropTagArray( 1);
SPropTagArray *pTag = (SPropTagArray *) new char[sz];
pTag->cValues = 1;
pTag->aulPropTag[0] = tag;
LPSPropValue lpProp = NULL;
ULONG cValues = 0;
HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
delete [] pTag;
if (HR_FAILED( hr) || (cValues != 1)) {
if (lpProp)
MAPIFreeBuffer( lpProp);
return( NULL);
}
else {
if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
MAPIFreeBuffer( lpProp);
lpProp = NULL;
}
}
}
return( lpProp);
}
示例2: MAPIAllocateBuffer
LPSPropValue Workshare::Mail::Mapi::GetMessageTag(LPMESSAGE lpMessage, const std::tstring& sTag)
{
LPSPropValue pPropVal = 0;
IMAPIPropPtr spMapiProp;
HRESULT hr = lpMessage->QueryInterface(IID_IMAPIProp, (void**) &spMapiProp);
if(SUCCEEDED(hr))
{
LPMAPINAMEID pTagName = 0;
hr = MAPIAllocateBuffer(sizeof(MAPINAMEID), (LPVOID*)&pTagName);
if(SUCCEEDED(hr))
{
pTagName[0].lpguid = (LPGUID)&PS_PUBLIC_STRINGS;
pTagName[0].ulKind = MNID_STRING;
_bstr_t bsTag(sTag.c_str());
pTagName[0].Kind.lpwstrName = bsTag;
LPSPropTagArray pPropTag = 0;
hr = spMapiProp->GetIDsFromNames(1, &pTagName, 0, &pPropTag);
if (!FAILED(hr))
{
if(1 == pPropTag->cValues && PT_ERROR != PROP_TYPE(pPropTag->aulPropTag[0]))
{
ULONG ulCount = 0;
spMapiProp->GetProps(pPropTag, 0, &ulCount, &pPropVal);
}
MAPIFreeBuffer(pPropTag);
}
MAPIFreeBuffer(pTagName);
}
}
return pPropVal;
}
示例3: MAPI_TRACE0
void CMapiApi::ListProperties( LPMAPIPROP lpProp, BOOL getValues)
{
LPSPropTagArray pArray;
HRESULT hr = lpProp->GetPropList( 0, &pArray);
if (FAILED(hr)) {
MAPI_TRACE0( " Unable to retrieve property list\n");
return;
}
ULONG count = 0;
LPMAPINAMEID FAR * lppPropNames;
SPropTagArray tagArray;
LPSPropTagArray lpTagArray = &tagArray;
tagArray.cValues = (ULONG)1;
nsCString desc;
for (ULONG i = 0; i < pArray->cValues; i++) {
GetPropTagName( pArray->aulPropTag[i], desc);
if (getValues) {
tagArray.aulPropTag[0] = pArray->aulPropTag[i];
hr = lpProp->GetNamesFromIDs(&lpTagArray, nsnull, 0, &count, &lppPropNames);
if (hr == S_OK)
MAPIFreeBuffer(lppPropNames);
LPSPropValue pVal = GetMapiProperty( lpProp, pArray->aulPropTag[i]);
if (pVal) {
desc += ", ";
ListPropertyValue( pVal, desc);
MAPIFreeBuffer( pVal);
}
}
MAPI_TRACE2( " Tag #%d: %s\n", (int)i, (const char *)desc);
}
MAPIFreeBuffer( pArray);
}
示例4: prop
// uses the built in outlook email fields, OUTLOOK_EMAIL1 etc, minus 1 for ADDR_TYPE and +1 for EmailOriginalDisplayName
BOOL CMAPIContact::GetEmail(CString& strEmail,int nIndex)
{
strEmail = "";
ULONG nID=GetOutlookEmailID(nIndex);
if(!nID) return FALSE;
LPSPropValue pProp;
CMAPINamedProperty prop(m_pUser);
if(prop.GetOutlookProperty(OUTLOOK_DATA1,nID-1,pProp)) {
CString strAddrType=CMAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
if(prop.GetOutlookProperty(OUTLOOK_DATA1,nID,pProp)) {
strEmail=CMAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
if(strAddrType==_T("EX")) {
// for EX types we use the original display name (seems to contain the appropriate data)
if(prop.GetOutlookProperty(OUTLOOK_DATA1,nID+1,pProp)) {
strEmail=CMAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
}
}
return TRUE;
}
}
return FALSE;
}
示例5: operation
/**
\details Test the NspiGetNamesFromIDs RPC operation (0x11)
\param mt pointer on the top-level mapitest structure
\return true on success, otherwise false
*/
_PUBLIC_ bool mapitest_nspi_GetNamesFromIDs(struct mapitest *mt)
{
TALLOC_CTX *mem_ctx;
enum MAPISTATUS retval;
struct nspi_context *nspi_ctx;
struct SPropTagArray *ppReturnedPropTags;
struct PropertyNameSet_r *ppNames;
mem_ctx = talloc_named(NULL, 0, "mapitest_nspi_GetNamesFromIDs");
nspi_ctx = (struct nspi_context *) mt->session->nspi->ctx;
ppReturnedPropTags = talloc_zero(mem_ctx, struct SPropTagArray);
ppNames = talloc_zero(mem_ctx, struct PropertyNameSet_r);
retval = nspi_GetNamesFromIDs(nspi_ctx, mem_ctx, NULL, NULL, &ppReturnedPropTags, &ppNames);
mapitest_print_retval_clean(mt, "NspiGetNamesFromIDs", retval);
MAPIFreeBuffer(ppReturnedPropTags);
MAPIFreeBuffer(ppNames);
talloc_free(mem_ctx);
if (retval == MAPI_E_SUCCESS) {
return true;
} else {
return false;
}
}
示例6: GetOutlookEmailID
// uses the built in outlook email fields, OUTLOOK_EMAIL1 etc, minus 1 for ADDRt_YPE and +1 for EmailOriginalDisplayName
String MAPIContact::GetEmail(int nIndex) {
String strEmail;
ULONG nID = GetOutlookEmailID(nIndex);
if(!nID)
return String();
#ifdef _WIN32_WCE
return GetPropertyString(nID, strEmail);
#else
LPSPropValue pProp;
if(GetOutlookProperty(OUTLOOK_DATA1, nID-1, pProp)) {
String strAddrType = MAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
if(GetOutlookProperty(OUTLOOK_DATA1, nID, pProp)) {
strEmail = MAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
if(strAddrType == "EX") {
// for EX types we use the original display name (seems to contain the appropriate data)
if(GetOutlookProperty(OUTLOOK_DATA1, nID+1, pProp)) {
strEmail = MAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
}
}
return strEmail;
}
}
return String();
#endif
}
示例7: PyMAPIObject_AsSPropValueArray
// @object PySPropValueArray|A sequence of <o PySPropValue>, as passed to many MAPI functions.
BOOL PyMAPIObject_AsSPropValueArray(PyObject *obs, SPropValue **ppv, ULONG *pcValues)
{
int seqLen = PySequence_Length(obs);
SPropValue *pPV;
HRESULT hr;
if (S_OK != (hr=MAPIAllocateBuffer(sizeof(SPropValue) * seqLen, (void **)&pPV))) {
OleSetOleError(hr);
return FALSE;
}
for (ULONG i=0; i<(ULONG)seqLen; i++) {
PyObject *myob = PySequence_GetItem(obs, i);
if (myob==NULL) {
MAPIFreeBuffer(pPV);
return FALSE;
}
BOOL rc = PyMAPIObject_AsSPropValue(myob, pPV+i, pPV);
Py_DECREF(myob);
if (!rc) {
MAPIFreeBuffer(pPV);
return FALSE;
}
}
*pcValues = seqLen;
*ppv = pPV;
return TRUE;
}
示例8: PyMAPIObject_FreeSRowSet
void PyMAPIObject_FreeSRowSet(SRowSet *pResult)
{
if (pResult) {
for (ULONG i=0; i<pResult->cRows; i++)
MAPIFreeBuffer( pResult->aRow[i].lpProps );
MAPIFreeBuffer(pResult);
}
}
示例9: MAPIFreeBuffer
void CMapiApi::FreeProws( LPSRowSet prows)
{
ULONG irow;
if (!prows)
return;
for (irow = 0; irow < prows->cRows; ++irow)
MAPIFreeBuffer( prows->aRow[irow].lpProps);
MAPIFreeBuffer( prows);
}
示例10: mapitest_nspi_GetGALTable
/**
\details Test the GetGALTable function
\param mt pointer to the top-level mapitest structure
\return true on success, otherwise false
*/
_PUBLIC_ bool mapitest_nspi_GetGALTable(struct mapitest *mt)
{
struct SPropTagArray *SPropTagArray;
struct PropertyRowSet_r *RowSet;
enum MAPISTATUS retval;
uint32_t i;
uint32_t count;
uint8_t ulFlags;
uint32_t rowsFetched = 0;
uint32_t totalRowsFetched = 0;
bool ret = true;
SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0xc,
PR_INSTANCE_KEY,
PR_ENTRYID,
PR_DISPLAY_NAME_UNICODE,
PR_EMAIL_ADDRESS_UNICODE,
PR_DISPLAY_TYPE,
PR_OBJECT_TYPE,
PR_ADDRTYPE_UNICODE,
PR_OFFICE_TELEPHONE_NUMBER_UNICODE,
PR_OFFICE_LOCATION_UNICODE,
PR_TITLE_UNICODE,
PR_COMPANY_NAME_UNICODE,
PR_ACCOUNT_UNICODE);
count = 0x20;
ulFlags = TABLE_START;
do {
retval = GetGALTable(mt->session, SPropTagArray, &RowSet, count, ulFlags);
mapitest_print_retval_clean(mt, "GetGALTable", retval);
if ((!RowSet) || (!(RowSet->aRow))) {
ret = false;
goto cleanup;
}
rowsFetched = RowSet->cRows;
totalRowsFetched += rowsFetched;
if (rowsFetched) {
for (i = 0; i < rowsFetched; i++) {
mapitest_print_PAB_entry(mt, &RowSet->aRow[i]);
}
}
ulFlags = TABLE_CUR;
MAPIFreeBuffer(RowSet);
} while (rowsFetched == count);
if (totalRowsFetched < 1) {
/* We should always have at least ourselves in the list */
/* So if we got no rows at all, there is a problem */
ret = false;
}
cleanup:
MAPIFreeBuffer(SPropTagArray);
return ret;
}
示例11: MAPIFreeBuffer
/* free rows */
void Mapix::freeRows(LPSRowSet nRows)
{
if(nRows)
{
for(ULONG i=0;i<nRows->cRows;i++)
{
MAPIFreeBuffer(nRows->aRow[i].lpProps);
}
MAPIFreeBuffer(nRows);
}
}
示例12: ComputeSingleFolderSize
ULONGLONG ComputeSingleFolderSize(
_In_ LPMAPIFOLDER lpFolder)
{
HRESULT hRes = S_OK;
LPMAPITABLE lpTable = NULL;
LPSRowSet lpsRowSet = NULL;
SizedSPropTagArray (1, sProps) = { 1, {PR_MESSAGE_SIZE} };
ULONGLONG ullThisFolderSize = 0;
// Look at each item in this folder
WC_MAPI(lpFolder->GetContentsTable(0, &lpTable));
if (lpTable)
{
WC_MAPI(HrQueryAllRows(lpTable, (LPSPropTagArray)&sProps, NULL, NULL, 0, &lpsRowSet));
if (lpsRowSet)
{
for(ULONG i = 0; i < lpsRowSet->cRows; i++)
{
if (PROP_TYPE(lpsRowSet->aRow[i].lpProps[0].ulPropTag) != PT_ERROR)
ullThisFolderSize += lpsRowSet->aRow[i].lpProps[0].Value.l;
}
MAPIFreeBuffer(lpsRowSet);
lpsRowSet = NULL;
}
lpTable->Release();
lpTable = NULL;
}
DebugPrint(DBGGeneric, "Content size = %I64u\n", ullThisFolderSize);
// printf("Content size = %I64d\n", ullThisFolderSize);
WC_MAPI(lpFolder->GetContentsTable(MAPI_ASSOCIATED, &lpTable));
if (lpTable)
{
WC_MAPI(HrQueryAllRows(lpTable, (LPSPropTagArray)&sProps, NULL, NULL, 0, &lpsRowSet));
if (lpsRowSet)
{
for(ULONG i = 0; i < lpsRowSet->cRows; i++)
{
if (PROP_TYPE(lpsRowSet->aRow[i].lpProps[0].ulPropTag) != PT_ERROR)
ullThisFolderSize += lpsRowSet->aRow[i].lpProps[0].Value.l;
}
MAPIFreeBuffer(lpsRowSet);
lpsRowSet = NULL;
}
lpTable->Release();
lpTable = NULL;
}
DebugPrint(DBGGeneric, "Total size = %I64u\n", ullThisFolderSize);
// printf("Total size = %I64d\n", ullThisFolderSize);
return ullThisFolderSize;
} // ComputeSingleFolderSize
示例13: FreePadrlist
// utility function to release ADRLIST entries
void CMAPIEx::ReleaseAddressList(LPADRLIST pAddressList)
{
#ifndef _WIN32_WCE
FreePadrlist(pAddressList);
#else
if(pAddressList)
{
for(ULONG i=0;i<pAddressList->cEntries;i++) MAPIFreeBuffer(pAddressList->aEntries[i].rgPropVals);
MAPIFreeBuffer(pAddressList);
}
#endif
}
示例14: PyMAPIObject_AsSBinaryArray
// @object PySBinaryArray|A sequence of strings containing binary data.
BOOL PyMAPIObject_AsSBinaryArray(PyObject *ob, SBinaryArray *pba)
{
BOOL bSeq = TRUE;
int seqLen;
if (PyString_Check(ob)) {
seqLen = 1;
bSeq = FALSE;
} else if (PySequence_Check(ob)) {
seqLen = PySequence_Length(ob);
} else {
PyErr_SetString(PyExc_TypeError, "SBinaryArray must be a sequence of strings");
return FALSE;
}
DWORD cBytes = (seqLen * sizeof(SBinary));
SBinary *pBin;
HRESULT hr = MAPIAllocateBuffer(cBytes, (void **)&pBin);
pba->lpbin = pBin;
if (FAILED(hr)) {
OleSetOleError(hr);
return FALSE;
}
pba->cValues = seqLen;
if (bSeq) {
for (ULONG i=0; i<(ULONG)seqLen; i++) {
PyObject *obItem = PySequence_GetItem(ob, i);
if (obItem==NULL) {
MAPIFreeBuffer(pba);
return FALSE;
}
if (!PyString_Check(obItem)) {
PyErr_SetString(PyExc_TypeError, "SBinary must be a string");
Py_DECREF(obItem);
MAPIFreeBuffer(pba);
return FALSE;
}
pBin[i].cb = PyString_Size(obItem);
pBin[i].lpb = (LPBYTE )PyString_AsString(obItem);
Py_DECREF(obItem);
}
} else {
if (!PyString_Check(ob)) {
PyErr_SetString(PyExc_TypeError, "SBinary must be a string");
MAPIFreeBuffer(pba);
return FALSE;
}
// Simple string
pBin[0].cb = PyString_Size(ob);
pBin[0].lpb = (LPBYTE)PyString_AsString(ob);
}
return TRUE;
}
示例15: MAPIFreeBuffer
BOOL CMAPIContact::GetPropertyString(CString& strProperty,ULONG ulProperty)
{
LPSPropValue pProp=NULL;
if(GetProperty(ulProperty,pProp)==S_OK) {
strProperty=CMAPIEx::GetValidString(*pProp);
MAPIFreeBuffer(pProp);
return TRUE;
} else {
strProperty=_T("");
if (pProp)
MAPIFreeBuffer(pProp);
return FALSE;
}
}