Fix prefast issues
↧
Source code checked in, #110902
↧
Source code checked in, #110909
Remove extra JunkDataToString implementation
↧
↧
Source code checked in, #110911
Port InterpretFlags and a few other functions to wstring
↧
Source code checked in, #110913
Convert FileTimeToString to wstring. Remove some redundant code.
↧
Created Unassigned: 0x80004002 in OpenProperty [17368]
Hi,
I am using the below code to get all the folders under the IPM_SUBTREE. Same is working fine in all computers.
However, in one of the customer machine this is not working. While analyzing the logs we have found that OpenProperty returns 0x80004002
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
```
BOOL CMapiSession::DisplayIPMSubTree()
{
BOOL bReturn = FALSE;
HRESULT hr = S_OK;
LPSPropValue lpProp = NULL;
LPMAPIFOLDER lpRootFolder = NULL;
LPMAPITABLE lpHierarchyTable = NULL;
LPSRowSet sRows = NULL;
LPMAPIFOLDER lpContactsFolder = NULL;
do
{
//Before the function make sure that OpenMsgStore() is done
if (NULL == m_lpMsgStore)
{
PAS_ERROR(("%s: lpMsgStore can not be empty", __FUNCTION__));
break;
}
hr = HrGetOneProp(m_lpMsgStore, PR_IPM_SUBTREE_ENTRYID, &lpProp);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrGetOneProp . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpProp)
{
PAS_ERROR(("%s: PR_IPM_SUBTREE_ENTRYID is NULL.", __FUNCTION__));
break;
}
/* if (lpProp->ulPropTag != PR_ENTRYID)
{
PAS_ERROR(("%s: Returned value is not PR_ENTRYID.", __FUNCTION__));
break;
}
*/
ULONG ipmroottype;
hr = m_lpMsgStore->OpenEntry(lpProp->Value.bin.cb,
(LPENTRYID)lpProp->Value.bin.lpb,
NULL,
0,
&ipmroottype,
(IUnknown**)&lpRootFolder);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenEntry . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpRootFolder)
{
PAS_ERROR(("%s: Root is NULL", __FUNCTION__));
break;
}
if (ipmroottype!=MAPI_FOLDER)
{
PAS_ERROR(("%s: Root is not a folder", __FUNCTION__));
break;
}
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenProperty . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (lpHierarchyTable == NULL)
{
PAS_ERROR(("%s: lpHierarchyTable is NULL ", __FUNCTION__));
break;
}
SizedSPropTagArray(3, cols) = {3, {PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS} };
hr = HrQueryAllRows( lpHierarchyTable,
(SPropTagArray*)&cols,
NULL,
NULL,
0,
&sRows);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrQueryAllRows . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (sRows == NULL)
{
PAS_ERROR(("%s: sRows is NULL ", __FUNCTION__));
break;
}
for (unsigned int i=0; i<sRows->cRows; i++)
{
std::wstring csFolderName = sRows->aRow[i].lpProps[1].Value.lpszW;
std::wstring csContainerClass;
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_NULL)
{
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_ERROR)
{
if (sRows->aRow[i].lpProps[2].Value.err != MAPI_E_NOT_FOUND)
{
csContainerClass = sRows->aRow[i].lpProps[2].Value.lpszW;
}
}
}
PAS_TRACE(("%s: Folder=[%s], ContainerClass=[%s] ", __FUNCTION__, csFolderName.c_str(), csContainerClass.c_str()));
}
bReturn = TRUE;
}
while(FALSE);
if (lpContactsFolder)
{
PAS_TRACE(("%s: Freeing the lpContactsFolder-2", __FUNCTION__));
lpContactsFolder->Release();
lpContactsFolder = NULL;
}
if (sRows)
{
PAS_TRACE(("%s: Freeing the sRows", __FUNCTION__));
FreeProws(sRows);
sRows = NULL;
}
if (lpHierarchyTable)
{
PAS_TRACE(("%s: Freeing the lpHierarchyTable", __FUNCTION__));
lpHierarchyTable->Release();
lpHierarchyTable = NULL;
}
if (lpRootFolder)
{
PAS_TRACE(("%s: Freeing the lpRootFolder", __FUNCTION__));
lpRootFolder->Release();
lpRootFolder = NULL;
}
if (lpProp)
{
PAS_TRACE(("%s: Freeing the lpProp", __FUNCTION__));
MAPIFreeBuffer(lpProp);
lpProp = NULL;
}
return bReturn;
}
```
Do let me know if you need any more details. Any help is appreciated.
Regards,
Rohan
I am using the below code to get all the folders under the IPM_SUBTREE. Same is working fine in all computers.
However, in one of the customer machine this is not working. While analyzing the logs we have found that OpenProperty returns 0x80004002
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
```
BOOL CMapiSession::DisplayIPMSubTree()
{
BOOL bReturn = FALSE;
HRESULT hr = S_OK;
LPSPropValue lpProp = NULL;
LPMAPIFOLDER lpRootFolder = NULL;
LPMAPITABLE lpHierarchyTable = NULL;
LPSRowSet sRows = NULL;
LPMAPIFOLDER lpContactsFolder = NULL;
do
{
//Before the function make sure that OpenMsgStore() is done
if (NULL == m_lpMsgStore)
{
PAS_ERROR(("%s: lpMsgStore can not be empty", __FUNCTION__));
break;
}
hr = HrGetOneProp(m_lpMsgStore, PR_IPM_SUBTREE_ENTRYID, &lpProp);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrGetOneProp . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpProp)
{
PAS_ERROR(("%s: PR_IPM_SUBTREE_ENTRYID is NULL.", __FUNCTION__));
break;
}
/* if (lpProp->ulPropTag != PR_ENTRYID)
{
PAS_ERROR(("%s: Returned value is not PR_ENTRYID.", __FUNCTION__));
break;
}
*/
ULONG ipmroottype;
hr = m_lpMsgStore->OpenEntry(lpProp->Value.bin.cb,
(LPENTRYID)lpProp->Value.bin.lpb,
NULL,
0,
&ipmroottype,
(IUnknown**)&lpRootFolder);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenEntry . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpRootFolder)
{
PAS_ERROR(("%s: Root is NULL", __FUNCTION__));
break;
}
if (ipmroottype!=MAPI_FOLDER)
{
PAS_ERROR(("%s: Root is not a folder", __FUNCTION__));
break;
}
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenProperty . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (lpHierarchyTable == NULL)
{
PAS_ERROR(("%s: lpHierarchyTable is NULL ", __FUNCTION__));
break;
}
SizedSPropTagArray(3, cols) = {3, {PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS} };
hr = HrQueryAllRows( lpHierarchyTable,
(SPropTagArray*)&cols,
NULL,
NULL,
0,
&sRows);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrQueryAllRows . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (sRows == NULL)
{
PAS_ERROR(("%s: sRows is NULL ", __FUNCTION__));
break;
}
for (unsigned int i=0; i<sRows->cRows; i++)
{
std::wstring csFolderName = sRows->aRow[i].lpProps[1].Value.lpszW;
std::wstring csContainerClass;
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_NULL)
{
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_ERROR)
{
if (sRows->aRow[i].lpProps[2].Value.err != MAPI_E_NOT_FOUND)
{
csContainerClass = sRows->aRow[i].lpProps[2].Value.lpszW;
}
}
}
PAS_TRACE(("%s: Folder=[%s], ContainerClass=[%s] ", __FUNCTION__, csFolderName.c_str(), csContainerClass.c_str()));
}
bReturn = TRUE;
}
while(FALSE);
if (lpContactsFolder)
{
PAS_TRACE(("%s: Freeing the lpContactsFolder-2", __FUNCTION__));
lpContactsFolder->Release();
lpContactsFolder = NULL;
}
if (sRows)
{
PAS_TRACE(("%s: Freeing the sRows", __FUNCTION__));
FreeProws(sRows);
sRows = NULL;
}
if (lpHierarchyTable)
{
PAS_TRACE(("%s: Freeing the lpHierarchyTable", __FUNCTION__));
lpHierarchyTable->Release();
lpHierarchyTable = NULL;
}
if (lpRootFolder)
{
PAS_TRACE(("%s: Freeing the lpRootFolder", __FUNCTION__));
lpRootFolder->Release();
lpRootFolder = NULL;
}
if (lpProp)
{
PAS_TRACE(("%s: Freeing the lpProp", __FUNCTION__));
MAPIFreeBuffer(lpProp);
lpProp = NULL;
}
return bReturn;
}
```
Do let me know if you need any more details. Any help is appreciated.
Regards,
Rohan
↧
↧
Closed Unassigned: 0x80004002 in OpenProperty [17368]
Hi,
I am using the below code to get all the folders under the IPM_SUBTREE. Same is working fine in all computers.
However, in one of the customer machine this is not working. While analyzing the logs we have found that OpenProperty returns 0x80004002
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
```
BOOL CMapiSession::DisplayIPMSubTree()
{
BOOL bReturn = FALSE;
HRESULT hr = S_OK;
LPSPropValue lpProp = NULL;
LPMAPIFOLDER lpRootFolder = NULL;
LPMAPITABLE lpHierarchyTable = NULL;
LPSRowSet sRows = NULL;
LPMAPIFOLDER lpContactsFolder = NULL;
do
{
//Before the function make sure that OpenMsgStore() is done
if (NULL == m_lpMsgStore)
{
PAS_ERROR(("%s: lpMsgStore can not be empty", __FUNCTION__));
break;
}
hr = HrGetOneProp(m_lpMsgStore, PR_IPM_SUBTREE_ENTRYID, &lpProp);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrGetOneProp . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpProp)
{
PAS_ERROR(("%s: PR_IPM_SUBTREE_ENTRYID is NULL.", __FUNCTION__));
break;
}
/* if (lpProp->ulPropTag != PR_ENTRYID)
{
PAS_ERROR(("%s: Returned value is not PR_ENTRYID.", __FUNCTION__));
break;
}
*/
ULONG ipmroottype;
hr = m_lpMsgStore->OpenEntry(lpProp->Value.bin.cb,
(LPENTRYID)lpProp->Value.bin.lpb,
NULL,
0,
&ipmroottype,
(IUnknown**)&lpRootFolder);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenEntry . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpRootFolder)
{
PAS_ERROR(("%s: Root is NULL", __FUNCTION__));
break;
}
if (ipmroottype!=MAPI_FOLDER)
{
PAS_ERROR(("%s: Root is not a folder", __FUNCTION__));
break;
}
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenProperty . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (lpHierarchyTable == NULL)
{
PAS_ERROR(("%s: lpHierarchyTable is NULL ", __FUNCTION__));
break;
}
SizedSPropTagArray(3, cols) = {3, {PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS} };
hr = HrQueryAllRows( lpHierarchyTable,
(SPropTagArray*)&cols,
NULL,
NULL,
0,
&sRows);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrQueryAllRows . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (sRows == NULL)
{
PAS_ERROR(("%s: sRows is NULL ", __FUNCTION__));
break;
}
for (unsigned int i=0; i<sRows->cRows; i++)
{
std::wstring csFolderName = sRows->aRow[i].lpProps[1].Value.lpszW;
std::wstring csContainerClass;
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_NULL)
{
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_ERROR)
{
if (sRows->aRow[i].lpProps[2].Value.err != MAPI_E_NOT_FOUND)
{
csContainerClass = sRows->aRow[i].lpProps[2].Value.lpszW;
}
}
}
PAS_TRACE(("%s: Folder=[%s], ContainerClass=[%s] ", __FUNCTION__, csFolderName.c_str(), csContainerClass.c_str()));
}
bReturn = TRUE;
}
while(FALSE);
if (lpContactsFolder)
{
PAS_TRACE(("%s: Freeing the lpContactsFolder-2", __FUNCTION__));
lpContactsFolder->Release();
lpContactsFolder = NULL;
}
if (sRows)
{
PAS_TRACE(("%s: Freeing the sRows", __FUNCTION__));
FreeProws(sRows);
sRows = NULL;
}
if (lpHierarchyTable)
{
PAS_TRACE(("%s: Freeing the lpHierarchyTable", __FUNCTION__));
lpHierarchyTable->Release();
lpHierarchyTable = NULL;
}
if (lpRootFolder)
{
PAS_TRACE(("%s: Freeing the lpRootFolder", __FUNCTION__));
lpRootFolder->Release();
lpRootFolder = NULL;
}
if (lpProp)
{
PAS_TRACE(("%s: Freeing the lpProp", __FUNCTION__));
MAPIFreeBuffer(lpProp);
lpProp = NULL;
}
return bReturn;
}
```
Do let me know if you need any more details. Any help is appreciated.
Regards,
Rohan
Comments: This is not an issue with MFCMAPI. MFCMAPI did not implement OpenProperty, which is what is failing. Please don't clutter my issues list.
I am using the below code to get all the folders under the IPM_SUBTREE. Same is working fine in all computers.
However, in one of the customer machine this is not working. While analyzing the logs we have found that OpenProperty returns 0x80004002
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
```
BOOL CMapiSession::DisplayIPMSubTree()
{
BOOL bReturn = FALSE;
HRESULT hr = S_OK;
LPSPropValue lpProp = NULL;
LPMAPIFOLDER lpRootFolder = NULL;
LPMAPITABLE lpHierarchyTable = NULL;
LPSRowSet sRows = NULL;
LPMAPIFOLDER lpContactsFolder = NULL;
do
{
//Before the function make sure that OpenMsgStore() is done
if (NULL == m_lpMsgStore)
{
PAS_ERROR(("%s: lpMsgStore can not be empty", __FUNCTION__));
break;
}
hr = HrGetOneProp(m_lpMsgStore, PR_IPM_SUBTREE_ENTRYID, &lpProp);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrGetOneProp . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpProp)
{
PAS_ERROR(("%s: PR_IPM_SUBTREE_ENTRYID is NULL.", __FUNCTION__));
break;
}
/* if (lpProp->ulPropTag != PR_ENTRYID)
{
PAS_ERROR(("%s: Returned value is not PR_ENTRYID.", __FUNCTION__));
break;
}
*/
ULONG ipmroottype;
hr = m_lpMsgStore->OpenEntry(lpProp->Value.bin.cb,
(LPENTRYID)lpProp->Value.bin.lpb,
NULL,
0,
&ipmroottype,
(IUnknown**)&lpRootFolder);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenEntry . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpRootFolder)
{
PAS_ERROR(("%s: Root is NULL", __FUNCTION__));
break;
}
if (ipmroottype!=MAPI_FOLDER)
{
PAS_ERROR(("%s: Root is not a folder", __FUNCTION__));
break;
}
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenProperty . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (lpHierarchyTable == NULL)
{
PAS_ERROR(("%s: lpHierarchyTable is NULL ", __FUNCTION__));
break;
}
SizedSPropTagArray(3, cols) = {3, {PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS} };
hr = HrQueryAllRows( lpHierarchyTable,
(SPropTagArray*)&cols,
NULL,
NULL,
0,
&sRows);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrQueryAllRows . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (sRows == NULL)
{
PAS_ERROR(("%s: sRows is NULL ", __FUNCTION__));
break;
}
for (unsigned int i=0; i<sRows->cRows; i++)
{
std::wstring csFolderName = sRows->aRow[i].lpProps[1].Value.lpszW;
std::wstring csContainerClass;
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_NULL)
{
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_ERROR)
{
if (sRows->aRow[i].lpProps[2].Value.err != MAPI_E_NOT_FOUND)
{
csContainerClass = sRows->aRow[i].lpProps[2].Value.lpszW;
}
}
}
PAS_TRACE(("%s: Folder=[%s], ContainerClass=[%s] ", __FUNCTION__, csFolderName.c_str(), csContainerClass.c_str()));
}
bReturn = TRUE;
}
while(FALSE);
if (lpContactsFolder)
{
PAS_TRACE(("%s: Freeing the lpContactsFolder-2", __FUNCTION__));
lpContactsFolder->Release();
lpContactsFolder = NULL;
}
if (sRows)
{
PAS_TRACE(("%s: Freeing the sRows", __FUNCTION__));
FreeProws(sRows);
sRows = NULL;
}
if (lpHierarchyTable)
{
PAS_TRACE(("%s: Freeing the lpHierarchyTable", __FUNCTION__));
lpHierarchyTable->Release();
lpHierarchyTable = NULL;
}
if (lpRootFolder)
{
PAS_TRACE(("%s: Freeing the lpRootFolder", __FUNCTION__));
lpRootFolder->Release();
lpRootFolder = NULL;
}
if (lpProp)
{
PAS_TRACE(("%s: Freeing the lpProp", __FUNCTION__));
MAPIFreeBuffer(lpProp);
lpProp = NULL;
}
return bReturn;
}
```
Do let me know if you need any more details. Any help is appreciated.
Regards,
Rohan
Comments: This is not an issue with MFCMAPI. MFCMAPI did not implement OpenProperty, which is what is failing. Please don't clutter my issues list.
↧
Commented Unassigned: 0x80004002 in OpenProperty [17368]
Hi,
I am using the below code to get all the folders under the IPM_SUBTREE. Same is working fine in all computers.
However, in one of the customer machine this is not working. While analyzing the logs we have found that OpenProperty returns 0x80004002
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
```
BOOL CMapiSession::DisplayIPMSubTree()
{
BOOL bReturn = FALSE;
HRESULT hr = S_OK;
LPSPropValue lpProp = NULL;
LPMAPIFOLDER lpRootFolder = NULL;
LPMAPITABLE lpHierarchyTable = NULL;
LPSRowSet sRows = NULL;
LPMAPIFOLDER lpContactsFolder = NULL;
do
{
//Before the function make sure that OpenMsgStore() is done
if (NULL == m_lpMsgStore)
{
PAS_ERROR(("%s: lpMsgStore can not be empty", __FUNCTION__));
break;
}
hr = HrGetOneProp(m_lpMsgStore, PR_IPM_SUBTREE_ENTRYID, &lpProp);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrGetOneProp . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpProp)
{
PAS_ERROR(("%s: PR_IPM_SUBTREE_ENTRYID is NULL.", __FUNCTION__));
break;
}
/* if (lpProp->ulPropTag != PR_ENTRYID)
{
PAS_ERROR(("%s: Returned value is not PR_ENTRYID.", __FUNCTION__));
break;
}
*/
ULONG ipmroottype;
hr = m_lpMsgStore->OpenEntry(lpProp->Value.bin.cb,
(LPENTRYID)lpProp->Value.bin.lpb,
NULL,
0,
&ipmroottype,
(IUnknown**)&lpRootFolder);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenEntry . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpRootFolder)
{
PAS_ERROR(("%s: Root is NULL", __FUNCTION__));
break;
}
if (ipmroottype!=MAPI_FOLDER)
{
PAS_ERROR(("%s: Root is not a folder", __FUNCTION__));
break;
}
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenProperty . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (lpHierarchyTable == NULL)
{
PAS_ERROR(("%s: lpHierarchyTable is NULL ", __FUNCTION__));
break;
}
SizedSPropTagArray(3, cols) = {3, {PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS} };
hr = HrQueryAllRows( lpHierarchyTable,
(SPropTagArray*)&cols,
NULL,
NULL,
0,
&sRows);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrQueryAllRows . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (sRows == NULL)
{
PAS_ERROR(("%s: sRows is NULL ", __FUNCTION__));
break;
}
for (unsigned int i=0; i<sRows->cRows; i++)
{
std::wstring csFolderName = sRows->aRow[i].lpProps[1].Value.lpszW;
std::wstring csContainerClass;
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_NULL)
{
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_ERROR)
{
if (sRows->aRow[i].lpProps[2].Value.err != MAPI_E_NOT_FOUND)
{
csContainerClass = sRows->aRow[i].lpProps[2].Value.lpszW;
}
}
}
PAS_TRACE(("%s: Folder=[%s], ContainerClass=[%s] ", __FUNCTION__, csFolderName.c_str(), csContainerClass.c_str()));
}
bReturn = TRUE;
}
while(FALSE);
if (lpContactsFolder)
{
PAS_TRACE(("%s: Freeing the lpContactsFolder-2", __FUNCTION__));
lpContactsFolder->Release();
lpContactsFolder = NULL;
}
if (sRows)
{
PAS_TRACE(("%s: Freeing the sRows", __FUNCTION__));
FreeProws(sRows);
sRows = NULL;
}
if (lpHierarchyTable)
{
PAS_TRACE(("%s: Freeing the lpHierarchyTable", __FUNCTION__));
lpHierarchyTable->Release();
lpHierarchyTable = NULL;
}
if (lpRootFolder)
{
PAS_TRACE(("%s: Freeing the lpRootFolder", __FUNCTION__));
lpRootFolder->Release();
lpRootFolder = NULL;
}
if (lpProp)
{
PAS_TRACE(("%s: Freeing the lpProp", __FUNCTION__));
MAPIFreeBuffer(lpProp);
lpProp = NULL;
}
return bReturn;
}
```
Do let me know if you need any more details. Any help is appreciated.
Regards,
Rohan
Comments: ** Comment from web user: shetty_rohan **
I am using the below code to get all the folders under the IPM_SUBTREE. Same is working fine in all computers.
However, in one of the customer machine this is not working. While analyzing the logs we have found that OpenProperty returns 0x80004002
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
```
BOOL CMapiSession::DisplayIPMSubTree()
{
BOOL bReturn = FALSE;
HRESULT hr = S_OK;
LPSPropValue lpProp = NULL;
LPMAPIFOLDER lpRootFolder = NULL;
LPMAPITABLE lpHierarchyTable = NULL;
LPSRowSet sRows = NULL;
LPMAPIFOLDER lpContactsFolder = NULL;
do
{
//Before the function make sure that OpenMsgStore() is done
if (NULL == m_lpMsgStore)
{
PAS_ERROR(("%s: lpMsgStore can not be empty", __FUNCTION__));
break;
}
hr = HrGetOneProp(m_lpMsgStore, PR_IPM_SUBTREE_ENTRYID, &lpProp);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrGetOneProp . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpProp)
{
PAS_ERROR(("%s: PR_IPM_SUBTREE_ENTRYID is NULL.", __FUNCTION__));
break;
}
/* if (lpProp->ulPropTag != PR_ENTRYID)
{
PAS_ERROR(("%s: Returned value is not PR_ENTRYID.", __FUNCTION__));
break;
}
*/
ULONG ipmroottype;
hr = m_lpMsgStore->OpenEntry(lpProp->Value.bin.cb,
(LPENTRYID)lpProp->Value.bin.lpb,
NULL,
0,
&ipmroottype,
(IUnknown**)&lpRootFolder);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenEntry . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (NULL == lpRootFolder)
{
PAS_ERROR(("%s: Root is NULL", __FUNCTION__));
break;
}
if (ipmroottype!=MAPI_FOLDER)
{
PAS_ERROR(("%s: Root is not a folder", __FUNCTION__));
break;
}
const GUID local_IID_IMAPITable = {0x00020301,0,0, {0xC0,0,0,0,0,0,0,0x46}};
hr = lpRootFolder->OpenProperty( PR_CONTAINER_HIERARCHY,
&local_IID_IMAPITable,
0,
0,
(IUnknown**)&lpHierarchyTable);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in OpenProperty . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (lpHierarchyTable == NULL)
{
PAS_ERROR(("%s: lpHierarchyTable is NULL ", __FUNCTION__));
break;
}
SizedSPropTagArray(3, cols) = {3, {PR_ENTRYID, PR_DISPLAY_NAME, PR_CONTAINER_CLASS} };
hr = HrQueryAllRows( lpHierarchyTable,
(SPropTagArray*)&cols,
NULL,
NULL,
0,
&sRows);
if (FAILED(hr))
{
PAS_ERROR(("%s: Failed in HrQueryAllRows . HRESULT=[0x%x]", __FUNCTION__, hr));
LogMapiError(hr);
break;
}
if (sRows == NULL)
{
PAS_ERROR(("%s: sRows is NULL ", __FUNCTION__));
break;
}
for (unsigned int i=0; i<sRows->cRows; i++)
{
std::wstring csFolderName = sRows->aRow[i].lpProps[1].Value.lpszW;
std::wstring csContainerClass;
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_NULL)
{
if(PROP_TYPE(sRows->aRow[i].lpProps[2].ulPropTag) != PT_ERROR)
{
if (sRows->aRow[i].lpProps[2].Value.err != MAPI_E_NOT_FOUND)
{
csContainerClass = sRows->aRow[i].lpProps[2].Value.lpszW;
}
}
}
PAS_TRACE(("%s: Folder=[%s], ContainerClass=[%s] ", __FUNCTION__, csFolderName.c_str(), csContainerClass.c_str()));
}
bReturn = TRUE;
}
while(FALSE);
if (lpContactsFolder)
{
PAS_TRACE(("%s: Freeing the lpContactsFolder-2", __FUNCTION__));
lpContactsFolder->Release();
lpContactsFolder = NULL;
}
if (sRows)
{
PAS_TRACE(("%s: Freeing the sRows", __FUNCTION__));
FreeProws(sRows);
sRows = NULL;
}
if (lpHierarchyTable)
{
PAS_TRACE(("%s: Freeing the lpHierarchyTable", __FUNCTION__));
lpHierarchyTable->Release();
lpHierarchyTable = NULL;
}
if (lpRootFolder)
{
PAS_TRACE(("%s: Freeing the lpRootFolder", __FUNCTION__));
lpRootFolder->Release();
lpRootFolder = NULL;
}
if (lpProp)
{
PAS_TRACE(("%s: Freeing the lpProp", __FUNCTION__));
MAPIFreeBuffer(lpProp);
lpProp = NULL;
}
return bReturn;
}
```
Do let me know if you need any more details. Any help is appreciated.
Regards,
Rohan
Comments: ** Comment from web user: shetty_rohan **
I had a misunderstanding while posting this issue. I thought I could also post "MAPI problems" here.
Anyways, sorry for that.
↧
New Post: Exchange 2003, event 1023, how to find message ID.
Hello,
I've got annoying problem with following errors in event logs on SBS server: "Error 0x7da occurred while rendering message 0001-000001005cc2 for download for user xxx" (source: IMAP4SVC).
User doesn't know about any unreadable supiscious mails and I didn't manage to locate any message/calendar which was received about time that first error 0x7da occured in logs
I've read that I can use mfcmapi and Instance Key attribute to match message id and delete it, so I went IPM_Subtree of xxx user and I was opening each folder one-by-one, but Instance Key is in following format:
cb: 4 lpb: 002C4584, its always lpb: 002xxxxx,
there is nothing that can match 0001-000001005cc2 or 0001-000001005f33 or 0001-000000fc782d.
Could you give me a hint how to solve this issue or how to find particular message be ID?
I've got annoying problem with following errors in event logs on SBS server: "Error 0x7da occurred while rendering message 0001-000001005cc2 for download for user xxx" (source: IMAP4SVC).
User doesn't know about any unreadable supiscious mails and I didn't manage to locate any message/calendar which was received about time that first error 0x7da occured in logs
I've read that I can use mfcmapi and Instance Key attribute to match message id and delete it, so I went IPM_Subtree of xxx user and I was opening each folder one-by-one, but Instance Key is in following format:
cb: 4 lpb: 002C4584, its always lpb: 002xxxxx,
there is nothing that can match 0001-000001005cc2 or 0001-000001005f33 or 0001-000000fc782d.
Could you give me a hint how to solve this issue or how to find particular message be ID?
↧
New Post: IPM.Configuration.Autocomplete
I was in the process of copying the Outlook autocomplete email address from one notebook to another. The step to delete the existing IPM.Configuration.Autocomplete was done incorrectly. I chose to delete and send to the deleted folder. The instructions say to use Permanent deletion (deletes to the deleted item retention if supported). Now I'm getting an error when trying to import the auto complete msg from the old notebook. The error indicates the file is already there.
Sorry for not having exact message details
Sorry for not having exact message details
↧
↧
Created Unassigned: Corrupt heap in MrMapi folder operations [17403]
When running MrMapi built in debug mode for any command requiring a folder spec, exception is taken on corrupt heap.
Example command line: MrMAPI -Contents -Profile "Outlook" -Folder "IPM_SUBTREE\Drafts" -List
Problem found to be an invalid count parameter to wcscpy_s() at line 133 in MMFolder.cpp in the current version of the source. Count is bytes, should be characters.
Sorry, I'm not set up to contribute patches.
Example command line: MrMAPI -Contents -Profile "Outlook" -Folder "IPM_SUBTREE\Drafts" -List
Problem found to be an invalid count parameter to wcscpy_s() at line 133 in MMFolder.cpp in the current version of the source. Count is bytes, should be characters.
Sorry, I'm not set up to contribute patches.
↧
Created Unassigned: MrMapi hangs on -ChildFolders with invalid folder name [17406]
When MrMapi is run with -ChildFolders (or any other command that requires a -Folder parameter) and an invalid folder name, it hangs in the final MapiUninitialize().
The cause is in function HrMAPIOpenStoreAndFolder(...), file MMStore.cpp line 161, where the negative hRes value returned by the open folder attempt causes release or return of both the folder and MDB handles to be skipped. The leaked MDB handle then causes the final MapiUninitialize() to hang.
The easiest fix is to simply remove the "if (SUCCEEDED(hr))" check at line 161. The remaining NULL checking is sufficient to prevent any attempt to free an uninitialized MDB and/or folder handle.
The cause is in function HrMAPIOpenStoreAndFolder(...), file MMStore.cpp line 161, where the negative hRes value returned by the open folder attempt causes release or return of both the folder and MDB handles to be skipped. The leaked MDB handle then causes the final MapiUninitialize() to hang.
The easiest fix is to simply remove the "if (SUCCEEDED(hr))" check at line 161. The remaining NULL checking is sufficient to prevent any attempt to free an uninitialized MDB and/or folder handle.
↧
Reviewed: August 2014 Release (Mar 25, 2015)
Rated 2 Stars (out of 5) - Apparrently does not support 64 bit Outlook.....
↧
New Post: No items in Purges folder
Trying to access a purge folder for a user, Exchange 2010 Viewing mailbox in an online mode.
I can see items in deletions and versions but not in purges.
Am I missing something here?
I can see items in deletions and versions but not in purges.
Am I missing something here?
↧
↧
New Post: Calendar Version Store question
To locate my own calendar meetings using MFCMapi for my own mailbox I go to Root Container->Top of Information Store->Calendar, then Open Contents Table.
However in the course of troubleshooting a users corrupted Calendar, I find that the meetings in that Calendar don't match what I see in OWA when I view their Calendar.
Instead for this user, the location of his calendar meetigns seems to be: Root Containter -> Calendar Version Store
Howver there are many more meetings listed in Calendar Version Store than exist in the Calendar when viewed through OWA.
I tested this by re-naming a couple meetings in the Subject Line so i could easily identify where his Calendar meets are.
What does this all mean?
However in the course of troubleshooting a users corrupted Calendar, I find that the meetings in that Calendar don't match what I see in OWA when I view their Calendar.
Instead for this user, the location of his calendar meetigns seems to be: Root Containter -> Calendar Version Store
Howver there are many more meetings listed in Calendar Version Store than exist in the Calendar when viewed through OWA.
I tested this by re-naming a couple meetings in the Subject Line so i could easily identify where his Calendar meets are.
What does this all mean?
↧
Reviewed: August 2014 Release (Apr 08, 2015)
Rated 5 Stars (out of 5) - Thank goodness this tool is available! Have many root duplicate folders to get rid of without losing data!
I was referred to this tool by http://support.microsoft.com/en-au/kb/2509983
↧
New Post: No items in Purges folder
↧
New Post: Cannot delete item from Public folder
Exchange 2010, outlook 2010
Receive the following from MFCMAPI x86 when trying to delete item from a public folder:
Error:
Code: MAPI_E_NO_ACCESS == 0x80070005
Function m_lpMessage->DeleteAttach( lpAttNumList[iSelection], lpProgress ? (ULONG_PTR)m_hWnd : NULL, lpProgress, lpProgress ? ATTACH_DIALOG : 0)
File AttachmentsDlg.cpp
Line 387
In outlook the message is 'Some items cannot be deleted. They were either moved or already deleted or access is denied'. The item we are trying to delete shows no information in From, To, and all other field EXCEPT size, which is 293b. Oddly, this item has an attachment (a shortcut of sorts) that actually functions, but trying to delete the file crashes outlook in normal mode and gives the aforementioned error in safe mode.
Receive the following from MFCMAPI x86 when trying to delete item from a public folder:
Error:
Code: MAPI_E_NO_ACCESS == 0x80070005
Function m_lpMessage->DeleteAttach( lpAttNumList[iSelection], lpProgress ? (ULONG_PTR)m_hWnd : NULL, lpProgress, lpProgress ? ATTACH_DIALOG : 0)
File AttachmentsDlg.cpp
Line 387
In outlook the message is 'Some items cannot be deleted. They were either moved or already deleted or access is denied'. The item we are trying to delete shows no information in From, To, and all other field EXCEPT size, which is 293b. Oddly, this item has an attachment (a shortcut of sorts) that actually functions, but trying to delete the file crashes outlook in normal mode and gives the aforementioned error in safe mode.
↧
↧
New Post: OpenMsgStore fails while accessing archive mailbox by using an account having full access permission in Exchange Online (O365)
Hello,
I am trying to access archive mailbox using an account which has full access permissions on the mailbox. The mailbox and archive both are in cloud - O365. I have "ArchiveGUID" of the archive which I want to access. I use this ArchiveGUID and append to MsgStoreEntryID. i.e. I use PR_ENTRYID to access archive mailbox store.
For example, I want to access xyz's mailbox archive (present in O365) using account "SuperAccnt". SuperAccnt has full access permission on xyz's mailbox. I have archive GUID of xyz's mailbox. IMapiSession::OpenMsgStore fails here. With full access permissions I am able to access xyz' mailbox and dumpster. It just fails while accessing archive mailbox.
The strange thing I noticed is that if I open the profile in Outlook 2013 and let Outlook load the archive store and close Outlook and then OpenMsgStore succeeds.
The same code works well with Exchange 2013 On premise - i.e. Loading profile in Outlook is not required. However, For Exchange Online it requires profile to be loaded in Outlook and then only OpenMsgStore works.
Am I missing anything here ?
Thanks in advance,
Pranay
I am trying to access archive mailbox using an account which has full access permissions on the mailbox. The mailbox and archive both are in cloud - O365. I have "ArchiveGUID" of the archive which I want to access. I use this ArchiveGUID and append to MsgStoreEntryID. i.e. I use PR_ENTRYID to access archive mailbox store.
For example, I want to access xyz's mailbox archive (present in O365) using account "SuperAccnt". SuperAccnt has full access permission on xyz's mailbox. I have archive GUID of xyz's mailbox. IMapiSession::OpenMsgStore fails here. With full access permissions I am able to access xyz' mailbox and dumpster. It just fails while accessing archive mailbox.
The strange thing I noticed is that if I open the profile in Outlook 2013 and let Outlook load the archive store and close Outlook and then OpenMsgStore succeeds.
The same code works well with Exchange 2013 On premise - i.e. Loading profile in Outlook is not required. However, For Exchange Online it requires profile to be loaded in Outlook and then only OpenMsgStore works.
Am I missing anything here ?
Thanks in advance,
Pranay
↧
Source code checked in, #111293
Problem: Crash exporting messages
Fix: GetLargeProp wasn't handling string cases properly, instead returning them as PT_BINARY data with a string type. Modified function to return proper data structure for each case.
↧
New Post: Open Other Mailboxes From GAL - Long Time required
Hello,
I have a problem with a long time required to open other Mailboxes from GAL.
A software vendor sold us a software which connects our telephone-system to the exchange-server. So when a telephone call is comeing, the software looks to my personal contact folder in outlook and shows me, which customer,... is calling.
The software was fine with exchange 2010. Now we've upgraded to exchange 2013. Since then, the automatic search needs a very long time to show me a result. We have look with the development of the software a very long time and they tested with mfcmapi. We've done the following steps:
Thank you very much and have a nice weekend!
Holger
I have a problem with a long time required to open other Mailboxes from GAL.
A software vendor sold us a software which connects our telephone-system to the exchange-server. So when a telephone call is comeing, the software looks to my personal contact folder in outlook and shows me, which customer,... is calling.
The software was fine with exchange 2010. Now we've upgraded to exchange 2013. Since then, the automatic search needs a very long time to show me a result. We have look with the development of the software a very long time and they tested with mfcmapi. We've done the following steps:
- log on to the windows sever with the accoutn under which the telephone-software ist running
- open mfcmapi.exe (Version 15.0.0.1042)
- click "Session - Logon" (take the profile which the developer created
- click "MDB - Open other mailboxes - From GAL"
- select any user
-
click "ok"
Then the developer told me that a "normal" system would take 1 or 2 seconds. But our systems take 8-15 seconds to show me the result.
Thank you very much and have a nice weekend!
Holger
↧