A
Alexander Gorlach
Hi,
To continue the previous topic ;-) This article is posted at:
http://blogs.officezealot.com/gorlach/archives/000858.html
This patch won't modify registry or any file on your disks. So, you can
apply it without any risk. This patch should be compatible with all BCM
versions.
KNOWN ISSUES
1. Business Contact Manager 2003 (even with all updates available for
today) crashes with Microsoft .NET Framework version 1.2 (beta)
installed.
2. Managed MAPI errors occur periodically bringing up a lot of annoying
warning message boxes.
PATCH DOWNLOAD
Download patch file (37071 bytes):
http://blogs.officezealot.com/gorlach/archives/unofficial-bcm2003-patch.
zip
QUICK INSTALL INSTRUCTIONS
1. Unpack IrisMS32.DLL and IrisMS32.DLL.Config from the patch archive.
2. Locate your MAPI folder. In most cases it will be C:\Program
Files\Common Files\System\MSMAPI\1049. This directory should contain
following files: MAPISVC.INF, MAPI32.DLL, MSMAPI32.DLL, MSPST32.DLL.
3. Copy both files from archive to MAPI folder.
4. Locate your .NET Framework folder. In most cases it will be
C:\WINDOWS\Microsoft.NET\Framework.
5. Make sure you have v1.1.4322 subfolder. Otherwise open
IrisMS32.DLL.Config file by Notepad and replace all lines with v1.1.4322
by your Framework version number (v1.1.xxxx subfolder name).
HOW TO APPLY THIS PATCH PARTIALLY
1. If you don't want to fix the first issue, open IrisMS32.DLL.Config
file in Notepad and remove the line <fixruntime />.
2. If you don't want to fix the second issue, open IrisMS32.DLL.Config
file in Notepad and remove the line <fixmapi />.
QUICK REMOVAL INSTRUCTIONS
Just delete the following files from the MAPI folder: IrisMS32.DLL,
IrisMS32.DLL.Config.
HOW DOES THIS PATCH WORK
IrisMS32.DLL is service provider of Business Contact Manager. It is
placed in the Windows system directory (C:\WINDOWS\SYSTEM32). When MAPI
loads the service provider, first it looks into MAPI folder and loads
our IrisMS32.DLL (in place of original).
Our IrisMS32.DLL searches for original IrisMS32.DLL and loads it. After
that, our module does in-memory patch and delegate all calls to the
named library.
Technical information
PROBLEM WITH .NET FRAMEWORK 1.2
..NET Framework 1.2 is currently beta and not intended for commercial
applications. But BCM always loads the latest installed version of
Framework. Let's go look at the original IrisMS32.DLL code:
..text:39A459CE @@init_host:
..text:39A459CE push offset IID_IUnknown
..text:39A459D3 push edi
..text:39A459D4 lea eax, [ebp-14h] ; out ICorRuntimeHost*
..text:39A459D7 push eax
..text:39A459D8 push offset IID_ICorRuntimeHost
..text:39A459DD push offset CLSID_CorRuntimeHost
..text:39A459E2 mov byte ptr [ebp-4], 1
..text:39A459E6 push edi ; LPCWSTR pwszFileName = NULL
..text:39A459E7 mov [ebp-14h], edi
..text:39A459EA call CorBindToCurrentRuntime
..text:39A459EF push eax
..text:39A459F0 call sub_39A456F4
..text:39A459F5 cmp [ebp-14h], edi
..text:39A459F8 jnz short @@start_runtime
..text:39A459FA push E_POINTER
..text:39A459FF call raise_exception
..text:39A45A04
..text:39A45A04 @@start_runtime:
..text:39A45A04 mov eax, [ebp-14h]
..text:39A45A07 mov ecx, [eax]
..text:39A45A09 push eax
..text:39A45A0A call dword ptr [ecx+28h] ; ICorRuntimeHost->Start()
Addresses may different depending on applied patches, but the code is
the same in all versions. CorBindToCurrentRuntime function loads the
latest version of the .NET Framework because of the first parameter. It
contains a pointer to the name of an application configuration file that
specifies the version of the the Common Language Runtime (CLR) to load.
It is NULL in our case. So ICorRuntimeHost->Start() crashes BCM.
This patch catches CorBindToCurrentRuntime call (from IrisMS32 module
only) and replaces the first parameter by IrisMS32.DLL.Config file name.
So that you can configure .NET assemblies for BCM as you wish.
PROBLEMS WITH MANAGED MAPI
The problem occurs in the IrisMS32.DLL again. It contains MSProviderInit
function which calls MAPI function MAPILogonEx. After a number of
successful calls MAPILogonEx starts to return errors. It causes many
message boxes with unknown errors to be displayed.
Let's go look at the code:
..text:39A4404B get_MAPI_session:
..text:39A4404B mov esi, offset dword_39A41234
..text:39A44050 push esi
..text:39A44051 push ebx ; 0
..text:39A44052 lea eax, [ebp-14h] ; lpMapiSession
..text:39A44055 push eax
..text:39A44056 push 80008020h ;
MAPI_EXTENDED|MAPI_NO_MAIL|MAPI_UNICODE
..text:39A4405B push ebx
..text:39A4405C push ebx
..text:39A4405D mov byte ptr [ebp-4], 4
..text:39A44061 push ebx
..text:39A44062 mov [ebp-14h], ebx
..text:39A44065 call MAPILogonEx@20
..text:39A4406A push eax ; oups, MAPI_E_LOGON_FAILED !!!!
..text:39A4406B call chk_MAPI_error_code
..text:39A44070 cmp [ebp-14h], ebx
..text:39A44073 jnz short session_is_not_NULL
..text:39A44075 push E_POINTER
..text:39A4407A call raise_com_exception
This patch replaces 0x80008020 flag by 0x80008068. This value is
MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_UNICODE | MAPI_ALLOW_OTHERS |
MAPI_USE_DEFAULT (I'm not sure this is correct). BCM works without any
errors after applying this patch.
Other information
WHERE TO GET THE LATEST PATCH AND NEWS
At my blog - http://blogs.officezealot.com/gorlach/.
HOW TO SAY THANKS
In the blog comments ;-)
To continue the previous topic ;-) This article is posted at:
http://blogs.officezealot.com/gorlach/archives/000858.html
This patch won't modify registry or any file on your disks. So, you can
apply it without any risk. This patch should be compatible with all BCM
versions.
KNOWN ISSUES
1. Business Contact Manager 2003 (even with all updates available for
today) crashes with Microsoft .NET Framework version 1.2 (beta)
installed.
2. Managed MAPI errors occur periodically bringing up a lot of annoying
warning message boxes.
PATCH DOWNLOAD
Download patch file (37071 bytes):
http://blogs.officezealot.com/gorlach/archives/unofficial-bcm2003-patch.
zip
QUICK INSTALL INSTRUCTIONS
1. Unpack IrisMS32.DLL and IrisMS32.DLL.Config from the patch archive.
2. Locate your MAPI folder. In most cases it will be C:\Program
Files\Common Files\System\MSMAPI\1049. This directory should contain
following files: MAPISVC.INF, MAPI32.DLL, MSMAPI32.DLL, MSPST32.DLL.
3. Copy both files from archive to MAPI folder.
4. Locate your .NET Framework folder. In most cases it will be
C:\WINDOWS\Microsoft.NET\Framework.
5. Make sure you have v1.1.4322 subfolder. Otherwise open
IrisMS32.DLL.Config file by Notepad and replace all lines with v1.1.4322
by your Framework version number (v1.1.xxxx subfolder name).
HOW TO APPLY THIS PATCH PARTIALLY
1. If you don't want to fix the first issue, open IrisMS32.DLL.Config
file in Notepad and remove the line <fixruntime />.
2. If you don't want to fix the second issue, open IrisMS32.DLL.Config
file in Notepad and remove the line <fixmapi />.
QUICK REMOVAL INSTRUCTIONS
Just delete the following files from the MAPI folder: IrisMS32.DLL,
IrisMS32.DLL.Config.
HOW DOES THIS PATCH WORK
IrisMS32.DLL is service provider of Business Contact Manager. It is
placed in the Windows system directory (C:\WINDOWS\SYSTEM32). When MAPI
loads the service provider, first it looks into MAPI folder and loads
our IrisMS32.DLL (in place of original).
Our IrisMS32.DLL searches for original IrisMS32.DLL and loads it. After
that, our module does in-memory patch and delegate all calls to the
named library.
Technical information
PROBLEM WITH .NET FRAMEWORK 1.2
..NET Framework 1.2 is currently beta and not intended for commercial
applications. But BCM always loads the latest installed version of
Framework. Let's go look at the original IrisMS32.DLL code:
..text:39A459CE @@init_host:
..text:39A459CE push offset IID_IUnknown
..text:39A459D3 push edi
..text:39A459D4 lea eax, [ebp-14h] ; out ICorRuntimeHost*
..text:39A459D7 push eax
..text:39A459D8 push offset IID_ICorRuntimeHost
..text:39A459DD push offset CLSID_CorRuntimeHost
..text:39A459E2 mov byte ptr [ebp-4], 1
..text:39A459E6 push edi ; LPCWSTR pwszFileName = NULL
..text:39A459E7 mov [ebp-14h], edi
..text:39A459EA call CorBindToCurrentRuntime
..text:39A459EF push eax
..text:39A459F0 call sub_39A456F4
..text:39A459F5 cmp [ebp-14h], edi
..text:39A459F8 jnz short @@start_runtime
..text:39A459FA push E_POINTER
..text:39A459FF call raise_exception
..text:39A45A04
..text:39A45A04 @@start_runtime:
..text:39A45A04 mov eax, [ebp-14h]
..text:39A45A07 mov ecx, [eax]
..text:39A45A09 push eax
..text:39A45A0A call dword ptr [ecx+28h] ; ICorRuntimeHost->Start()
Addresses may different depending on applied patches, but the code is
the same in all versions. CorBindToCurrentRuntime function loads the
latest version of the .NET Framework because of the first parameter. It
contains a pointer to the name of an application configuration file that
specifies the version of the the Common Language Runtime (CLR) to load.
It is NULL in our case. So ICorRuntimeHost->Start() crashes BCM.
This patch catches CorBindToCurrentRuntime call (from IrisMS32 module
only) and replaces the first parameter by IrisMS32.DLL.Config file name.
So that you can configure .NET assemblies for BCM as you wish.
PROBLEMS WITH MANAGED MAPI
The problem occurs in the IrisMS32.DLL again. It contains MSProviderInit
function which calls MAPI function MAPILogonEx. After a number of
successful calls MAPILogonEx starts to return errors. It causes many
message boxes with unknown errors to be displayed.
Let's go look at the code:
..text:39A4404B get_MAPI_session:
..text:39A4404B mov esi, offset dword_39A41234
..text:39A44050 push esi
..text:39A44051 push ebx ; 0
..text:39A44052 lea eax, [ebp-14h] ; lpMapiSession
..text:39A44055 push eax
..text:39A44056 push 80008020h ;
MAPI_EXTENDED|MAPI_NO_MAIL|MAPI_UNICODE
..text:39A4405B push ebx
..text:39A4405C push ebx
..text:39A4405D mov byte ptr [ebp-4], 4
..text:39A44061 push ebx
..text:39A44062 mov [ebp-14h], ebx
..text:39A44065 call MAPILogonEx@20
..text:39A4406A push eax ; oups, MAPI_E_LOGON_FAILED !!!!
..text:39A4406B call chk_MAPI_error_code
..text:39A44070 cmp [ebp-14h], ebx
..text:39A44073 jnz short session_is_not_NULL
..text:39A44075 push E_POINTER
..text:39A4407A call raise_com_exception
This patch replaces 0x80008020 flag by 0x80008068. This value is
MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_UNICODE | MAPI_ALLOW_OTHERS |
MAPI_USE_DEFAULT (I'm not sure this is correct). BCM works without any
errors after applying this patch.
Other information
WHERE TO GET THE LATEST PATCH AND NEWS
At my blog - http://blogs.officezealot.com/gorlach/.
HOW TO SAY THANKS
In the blog comments ;-)