D
DenisSSSS
Hello.
We found that PrepareForm generates access violation in Office 2003 SP3.
It will generate access violation if you try to call it from external
process. In our case we have to call PrepareForm from uninstallation. It
requires to republish custom forms.
Everything worked properly till Office 2003 SP3 was released.
Please, see code below that generates access violation if you execute it
from external process(test application in our case).
The same code works properly if you run from COM Add-in.
void external_publish_access_violation()
{
MAPIInitialize(NULL);
Outlook::_ApplicationPtr ol_app =
Outlook::_ApplicationPtr(L"Outlook.Application");
Outlook::MAPIFolderPtr type_root =
ol_app->Session->GetDefaultFolder(Outlook:lFolderTasks);
_variant_t fd_v;
Outlook::FormDescriptionPtr fd;
Outlook::_TaskItemPtr task = ol_app->CreateItem(Outlook:lTaskItem);
fd = task->FormDescription;
_variant_t vt = fd->Name;
fd->Name = str2bstr(L"new_task_item");
fd->PublishForm(Outlook:lPersonalRegistry);
IMAPIFormMgrPtr form_manager;
IMAPIFormInfoPtr fi;
::MAPIOpenFormMgr((IMAPISessionPtr)ol_app->Session->MAPIOBJECT,
&form_manager);
// message class is resolved succesfully
HRESULT hr=
form_manager->ResolveMessageClass("IPM.Task.new_task_item",
MAPIFORM_EXACTMATCH, 0, &fi);
// ACCESS VIOLATION
hr = form_manager->PrepareForm(0, 0, fi);
}
We found that PrepareForm generates access violation in Office 2003 SP3.
It will generate access violation if you try to call it from external
process. In our case we have to call PrepareForm from uninstallation. It
requires to republish custom forms.
Everything worked properly till Office 2003 SP3 was released.
Please, see code below that generates access violation if you execute it
from external process(test application in our case).
The same code works properly if you run from COM Add-in.
void external_publish_access_violation()
{
MAPIInitialize(NULL);
Outlook::_ApplicationPtr ol_app =
Outlook::_ApplicationPtr(L"Outlook.Application");
Outlook::MAPIFolderPtr type_root =
ol_app->Session->GetDefaultFolder(Outlook:lFolderTasks);
_variant_t fd_v;
Outlook::FormDescriptionPtr fd;
Outlook::_TaskItemPtr task = ol_app->CreateItem(Outlook:lTaskItem);
fd = task->FormDescription;
_variant_t vt = fd->Name;
fd->Name = str2bstr(L"new_task_item");
fd->PublishForm(Outlook:lPersonalRegistry);
IMAPIFormMgrPtr form_manager;
IMAPIFormInfoPtr fi;
::MAPIOpenFormMgr((IMAPISessionPtr)ol_app->Session->MAPIOBJECT,
&form_manager);
// message class is resolved succesfully
HRESULT hr=
form_manager->ResolveMessageClass("IPM.Task.new_task_item",
MAPIFORM_EXACTMATCH, 0, &fi);
// ACCESS VIOLATION
hr = form_manager->PrepareForm(0, 0, fi);
}