RegSvr32 hangs in MsMapi32 RPC

Add-in Express™ Support Service
That's what is more important than anything else

RegSvr32 hangs in MsMapi32 RPC
 
Erwin Sienknecht


Guest


Hi,
I've finished a Outlook-Plugin that stores E-Mail into our (Sybase Anywhere)= Database - and all is working fine in Outlook 2010 and 2007. But when i try to register this .dll in Outlook 2003 regsvr32.exe hangs.
It hangs on all Operating System (7, Vista and XP) and i think its Outlook-MAPI Related.

i've uses Process Explorer and here it what i've found:

Last thing regsvr32 does ist calling

Thread-ID: 2144 msmapi32.dll!FOpenThreadImpersonationToken@8+0x998

The callstack of this thread is:
ntoskrnl.exe!KeWaitForMultipleObjects+0xc0a
ntoskrnl.exe!KeAcquireSpinLockAtDpcLevel+0x732
ntoskrnl.exe!KeWaitForMutexObject+0x19f
ntoskrnl.exe!NtWaitForSingleObject+0xde
ntoskrnl.exe!KeSynchronizeExecution+0x3a23
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x6c0
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x4a8
wow64.dll!Wow64SystemServiceEx+0x1ce
wow64.dll!Wow64LdrpInitialize+0x429
ntdll.dll!RtlIsDosDeviceName_U+0x24c87
ntdll.dll!LdrInitializeThunk+0xe
ntdll.dll!ZwWaitForSingleObject+0x15
ntdll.dll!RtlIntegerToUnicodeString+0x20b
ntdll.dll!RtlAllocateActivationContextStack+0x116
ntdll.dll!RtlDecodePointer+0xf7
ntdll.dll!LdrInitializeThunk+0x10


(I'm using Delphi 2010 14.0.3593.25826)


any hints or suggestions?
Posted 24 Jul, 2012 02:23:33 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Erwin,

When you register your add-in, Add-in Express creates the module in order to retrieve required porperties; then the module is killed. I suggest that you debug how your add-in is registered; in the Run | Parameters dialog, use these settings:

Host Application:
{System32}\regsvr32.exe

Parameters:
{path}\YourAddin.DLL


Andrei Smolin
Add-in Express Team Leader
Posted 24 Jul, 2012 08:48:06 Top
Erwin Sienknecht


Guest


Hi Andrei,
i think i've solved the problem...

THIS:
lExt := '*.' + fExt;
SHGetFileInfo(PChar(lExt), 0, FileInfo, SizeOf(FileInfo), SHGFI_USEFILEATTRIBUTES OR SHGFI_ICON OR SHGFI_SMALLICON OR SHGFI_SYSICONINDEX);
IconIndex := FileInfo.iIcon;

causes to load msmapi32.dll and then it hangs...

I've moved the code into the getXXX Function of the IconIndex Property so SHGetFIleInfo will only be calles on demand (and much later) instead of callin it at unit initialization.

This works for this computer - but i'm still a bit afraid it will fail on another customers Computer.
Do you have any idea WHY this function "hangs" on some PCs (and ONLY with Outlook 2003 installed - samne PC with uninstalled Outlook will run fine)...

Thanks for your time,
Erwin
Posted 25 Jul, 2012 08:45:29 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Erwin,

I'm afraid I cannot help you with this; I don't specialize in this area.

In the description of this function I've found these notes:

From http://msdn.microsoft.com/en-us/library/windows/desktop/bb762179(v=vs.85).aspx:
You should call this function from a background thread. Failure to do so could cause the UI to stop responding.
...
You must initialize Component Object Model (COM) with CoInitialize or OleInitialize prior to calling SHGetFileInfo.


If this doesn't help, I suggest that you ask this question on Microsoft forums, see http://social.msdn.microsoft.com/Forums/en-us/category/officedev. Sorry, I cannot even point you to a correct forum(s).


Andrei Smolin
Add-in Express Team Leader
Posted 25 Jul, 2012 09:59:54 Top
Erwin Sienknecht


Guest


Hi Andrei,

consider the Problem as solved - im happy with the workaround :-)
Maybe i will implement a backround worker thread later, at the moment i've too less time for doing that.

Thanks for your help and Time

Erwin
Posted 26 Jul, 2012 03:50:29 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Erwin,

Thanks and good luck with your project!


Andrei Smolin
Add-in Express Team Leader
Posted 26 Jul, 2012 04:29:15 Top