Quantcast
Channel: SGriffin's MAPI Internals
Viewing all 84 articles
Browse latest View live

Indexed Search With MAPI and Exchange

$
0
0

In Outlook 2013, we took a change to improve how we build search folders when searching against Exchange 2010 and higher for text we’d expect to find in commonly indexed fields. Prior to this change, we’d build a search folder restriction that looks like this:

PR_SUBJECT contains 'text' || PR_BODY contains 'text' || PR_SENDER_NAME contains ‘text' || ...

If you use Outlook 2013 and create an online search folder (say, by just doing a search), then look in MFCMAPI, you’ll find the search criteria is greatly simplified:

0x0eaf001f contains ‘text’

Development has allowed me to document this property:

#define PR_SEARCH_ALL_INDEXED_PROPS_W PROP_TAG(PT_UNICODE, 0x0EAF)

Use of this property in building your searches has a few benefits:

  • Your restriction is greatly simplified
  • The Exchange server can better understand the intent of the search and use this to better optimize it.
  • As new properties are indexed on the server side, the utility of your searches increases without rewriting client code.

This property will work against Exchange 2010 and higher.


December 2013 Release of MFCMAPI and MrMAPI

$
0
0

The December 2013 Release (build 15.0.0.1040) is live: http://mfcmapi.codeplex.com.

It’s been a while. I’ve been busy while I was gone. All dialogs got a visual refresh with collapsible panes. New windows cascade now. I finally implemented a viewer for messages. And most important of all, I went out and got myself a snazzy new icon for Christmas:

MFCMAPI Icon

Here's a change list - see the Issue Tracker on Codeplex for more details, or look at the code:

  • Automatic handling of Body Streams (no more Right Click/Open as Stream!)
  • New windows cascade
  • Profile export
  • Hex editor small file import/export
  • SetColumns experience overhauled – no more confusing initial dialog
  • Single item viewer: used for viewing properties on MSG files, recipients, embedded messages, etc.
  • Suppressed expected MAPI_E_NOT_FOUND errors from the table view (while expected, these errors confused too many people)
  • View Panes: part of the dialog refresh – these collapsible panes make the Hex Editor and many other dialogs much more useful
  • Paste from OneNote now works (this is a problem in how OneNote handles the clipboard, but I can handle it now)
  • Icons group on the taskbar properly now – Windows 7/8 broke this
  • New app icon
  • All internal icons refreshed
  • Several painting glitches fixed
  • Upgraded projects to Visual Studio 2013

Enjoy.

Wrapped PST and Indexing

$
0
0

One of the things we’ve seen with Outlook 2013 is that Wrapped PSTs that never used to be indexed by Outlook are indexed now. This can be great if you’ve got a store which can deal with being crawled, but what if your store can’t handle it? The PST provider on which the Wrapped PST is based controls if and when it is indexed. Part of the logic it uses is to call in to the Crawl Scope Manager (CSM) interface to determine if the store has been excluded. Namely, it calls IncludedInCrawlScope, passing in a URL which represents the PST. The CSM will then report whether or not the PST is eligible for indexing.

If you don’t want your store indexed, then the trick is to make sure the CSM returns false here. You can do this by calling AddUserScopeRule and passing the appropriate URL. Here’s the format for the URL:

mapi15://{SID}/StoreDisplayName($HashNumber)/

As you may note, this URL format is very similar to the one described here:

http://msdn.microsoft.com/en-us/library/office/ff960454.aspx

There are a few key differences and caveats:

  • The URI is mapi15 instead of mapi.
  • The SID must be wrapped in curly brackets.
  • The hash is also calculated using the Algorithm to Calculate the Store Hash Number, but the hexadecimal representation should be generated without any leading zeros. So, for instance, if the hash is 0x0abc1234, in the URL you would use ($abc1234), not ($0abc1234).

Here’s an example URL you might generate:

mapi15://{S-1-5-21-123456789-123456789-1234567890-12345}/MyStoreProvider($abcd1234)/

Another issue to be aware of is when you add your URL to the CSM. The PST provider is very sensitive to the indexing state changing while the PST is open. If the state changes, the PST may end up kicking off an installer to repair Outlook. So you need to add the URL before the PST knows anything about it. The best time to do this is when your provider is first loaded, during the IMSProvider::Logon, before you call Logon in the PST. At this point, you have enough information to construct the URL and call in to the CSM, but the PST provider is not aware yet that this PST is being opened.

[Update - 1/16/13] Having registered your store for exclusion, you may want to check that it is, in fact, excluded. If you look at the Indexing Options, you'll see an interesting listing: Microsoft Outlook is both under "Included Locations" and "Exclude". Don't worry - this doesn't mean all of Outlook isn't being indexed. The shell extension that Outlook has registered for the mapi15 namespace simply returns "Microsoft Outlook" as the user readable name for any URL which has been excluded. Development did look at augmenting the extension to provide a better string, but decided most users would never look at this UI to begin with, so it wasn't worth the risk. If you want to check that your code ran correctly, you can look at the registration in the registry under this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\CrawlScopeManager\Windows\SystemIndex\WorkingSetRules.  

Enjoy!

Custom Icons and Table View

$
0
0

A couple of customers recently reported this interesting issue with Outlook views and custom form icons:

  1. Publish a custom form in Outlook and chosen to give it an icon. There doesn’t need to be anything special about the form. In fact, the default custom form icon will reproduce this issue.
  2. Configure a folder with the Table view (single line, with rows and columns). One way to do this is to turn off the Reading pane and make the view wide enough that Outlook defaults to the Table.
  3. Create a new item using your form.

Expected: The entry in the table uses the custom icon.

Actual: The entry in the table has no icon.

Further, if you narrow the view so that it switches to two line mode, you’ll see the icon appear, and it will continue to be used even if you switch back to the Table view.

The problem stems from the logic we use to determine when we can go back to the forms manager to get the icon. We don’t want to hit the forms manager while we’re rendering the view since this could cause a network call which would slow everything down. So we decide we’ll go get the icon later. Except later never happens for this view. The other views don’t have this flaw – only the Table view. We’re working on a fix for this. I’ll post back here when the fix is ready.

Prefix Searching the PST

$
0
0

Here’s a neat trick:

  1. Load a PST into Outlook and pick a folder with some messages in it
  2. Go to Advance Find -> Advanced -> Field -> All mail Fields –> From
  3. Select condition”'word starts with”.
  4. Enter the last part of an e-mail address of a sender of a message in your folder.
  5. Click on Add to List
  6. Click on 'Find Now'.
  7. Observe the results.

Since our restriction is “word starts with”, our restriction won’t match and we won’t get results, as expected. Now – turn off indexing for this PST and try it again. Now you start getting matches!

What’s happening? In MAPI search, “word starts with”  doesn’t correspond to any of the traditional fuzzy flags. FL_PREFIX will only match the beginning of the block of text, and FL_SUBSTRING will match anything within the text, no matter where it is within a word (or even spanning words). So we had to invent a new fuzzy level: FL_PREFIX_ON_ANY_WORD to capture the intended search semantics.

When searching against Exchange, or when using the index against a PST, we understand this flag. However, we never implemented this flag for the PST (non-indexed), and other stores wouldn’t be aware of it either. So, as a compromise, when dealing with a store which we think won’t understand FL_PREFIX_ON_ANY_WORD, we remove the flag from the search and substitute FL_SUBSTRING. For searches of large blocks of text, such as Subject or Body, this is a good compromise. For searches of From or other fields which usually consist of one word (or, at least, no white space), we’ll see this side effect of the searches matching the middle or ends of the words.

BTW – support for this documentation ultimately got cut, but we did point out this substitution of FL_SUBSTRING for FL_PREFIX_ON_ANY_WORD here:

http://blogs.msdn.com/b/stephen_griffin/archive/2006/05/11/595338.aspx

February 2014 Release of MFCMAPI and MrMAPI

$
0
0

The February 2014 Release (build 15.0.0.1041) is live: http://mfcmapi.codeplex.com.

The past month’s experiment of checking in as I go seemed to work well. Since the checkins are now self annotated I’ve decided to stop post creating items in the issue tracker for work I’ve already done. Do please continue to file items for work I need to do.

This month we get the ability to export profile information using MrMAPI. The folks working on our diagnostics tools are salivating over that. :)

Here's a change list - see the Issue Tracker and ChangeSets on Codeplex for more details:

  • CopyTo operations give you the opportunity to fine tune the excluded prop set
  • Named prop details in notification logging
  • IExchangeManagedStoreEx support
  • A couple crashes have been squished
  • MrMAPI: profile export
  • Quickstart: New way to look up a user as well as their thumbnail

Enjoy.

MAPICDO March 2014 Release

$
0
0

It’s time for what is most likely the last release of the MAPICDO download. Here are the release notes:

Installation details:

  • The version given on the Download Center is 08.03.08353. The version stamped on the files, however, is 6.5.8353.0. All of the files in the update are dated January 13th, 2014.
  • If you already have a version of the MAPI Download installed, you must uninstall it before installing the new version. The installer does not upgrade, nor does it warn you if you try to install it without uninstalling the previous version.

Fixes:

  • We fixed a connection leak on network errors which contributed to MAPI clients getting shut out of talking to the Exchange server. More details on this fix are given here: http://support.microsoft.com/kb/2937628
  • That’s it – again – this is probably the last release we’ll do to MAPICDO. If you haven’t already, move your apps to EWS, or Apps for Office, or the brand new Office 365 APIs.

Enjoy!

Outlook 2013 Click To Run and COM Interfaces

$
0
0

In this article I’ll go over the current state of Outlook 2013 Click To Run (C2R)and support for various programmatic interfaces. Please comment on any areas I’ve missed and I’ll update the article accordingly.

With Outlook 2013, we enabled something we had never supported before, side by side (SxS)  installation with other versions of Outlook. Specifically, we support installing Outlook 2013 side by side with Outlook 2010 or Outlook 2007. We do this by installing Outlook 2013 using Click-to-Run. For most MAPI applications and Outlook Add-Ins, C2R does not pose a problem. However, there is a small set of COM interfaces for which C2R creates an issue. We’ll go over them one by one.

Account Manager

This interface gave us the most trouble, but we’ve got it mostly fixed now. Let’s look at how the Outlook Account Manager, or CLSID_OlkAccountManager, caused a problem in the first place. This will also help us understand the remaining interfaces.

On a regular 64 bit installation of Windows with Outlook 2010 32 bit installed, we’ll find this interface registered here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{ED475410-B0D6-11D2-8C3B-00104B2A6676}

The registration will tell COM where to find OUTLMIME.DLL, which actually implements the interface. On the same system, with Outlook 2013 C2R installed, we find this key instead:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{ED475410-B0D6-11D2-8C3B-00104B2A6676}

COM won’t ever know to look here. But when Outlook needs this interface it finds it. How? That’s part of the Click To Run application bubble. Applications outside the bubble see the normal registry. Applications inside the bubble see the normal registry, plus any registry keys mapped through the ClickToRun key. So when Outlook, which runs inside the bubble, looks for the class {4E3A7680-B77A-11D0-9DA5-00C04FD65685}, it has no trouble finding it. Other applications won’t see it though.

Outlook and Office register every class they expose inside the bubble. A few classes are also registered outside the bubble so that other applications can use them. So why don’t we just register CLSID_OlkAccountManager outside the bubble? We actually tried that. We took a fix to register this interface outside the bubble and found that Outlook 2010 clients started crashing. When Outlook 2010 tried to locate it’s own implementation of the Account Manager, it got Outlook 2013’s implementation, which promptly crashed. We had to pull this fix and be a little smarter about it. Now, C2R will only register this key outside the bubble if it detects that a previous version of Outlook isn’t already installed. This is the only interface we’ve done this for.

MAPI<->MIME

The MAPI<->MIME conversion interface, IConverterSession and the support interface it depends on, IMimeMessage, are also only registered inside the bubble. Several customers have chosen to fix this one by hand by copying the registrations from inside the bubble to outside. If the bitness of Outlook matches the bitness of the OS, you could do this as follows:

rem For when the Office bitness matches Windows bitness:
rem IConverterSession
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /f
rem IMimeMessage
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /f

If the bitness differs:

rem For Office 32-bit on Windows 64-bit:
rem IConverterSession
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /f
rem IMimeMessage
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /f

Only do this if Outlook 2013 is not installed side by side with another version of Outlook, or you risk breaking the older version of Outlook!

Also, note that this is why many of you have written to complain to me that MFCMAPI can no longer work with EML files with Outlook 2013 – you have Outlook 2013 C2R and it can’t work unless you patch up the registry.

MAPI Marshalling

Finally, there’s the little known/understood area of MAPI marshalling. This is an area we almost never see…except that Redemption depends on it. In this case, the problem isn’t that COM objects themselves aren’t registered (MAPI isn’t COM after all). The problem is that the proxy stub maps are hidden in the bubble. Dmitry and I worked together to come up with a .reg file to fix this one: https://groups.yahoo.com/neo/groups/Outlook-Redemption/conversations/topics/9600

The same warning about not doing this in a side by side scenario applies. Dmitry points out that we intend to fix this in the C2R installer. We did intend to fix it at the time Dmitry and I spoke, but after the problems we encountered with the Account Manager it became harder to justify these sorts of changes.

Resources


Automated Dump Collection Using Procdump

$
0
0

I thought I’d share a script I’ve been using on some recent cases to generate memory dump files on multiple machines for intermittent crashes. The scenario this script targets is that you have a process, say Outlook.exe, which is crashing for a number of users, but you haven’t yet narrowed down a repro scenario. You’d like to get memory dumps when the process crashes, and you’d also like to get extra debugging information which may help you hone in on the issue. You'd also like to set all of this up so the user doesn't have to do anything themselves. They just run the process and data is generated automatically for you to collect later.

This script, set through Image File Execution Options, attaches Procdump.exe to your process every time it starts, so it can listen for exceptions and write dump files when interesting ones occur. It also captures Procdump’s debug spew in a log file which you can use to identify first chance exceptions that you'd also like to get dumps for. Once enabled, you'll just need to visit the user's machine periodically to collect the dumps and logs for analysis.

To use this script, create a file called DoProcDump.cmd and place it in c:\tools alongside procdump.exe (you can configure these paths differently if you like, but you’ll need to modify the script) and then create an entry under Image File Execution Options. Next time the user starts the process, Procdump will attach and listen for exceptions. There are a number of ways you can change up the data collection, such as enabling first chance exceptions, or getting dumps on process shutdown (useful for silent exits, though this is even better). Look at the comments in the script to see how to enable and configure these.

To disable this script, just remove the reg key you created under Image File Execution Options.

BTW, I got the unique file name code from here: http://blogs.msdn.com/b/myocom/archive/2005/06/03/creating-unique-filenames-in-a-batch-file.aspx

Enjoy!

@ECHO offREM *****DoProcDump.cmd*****REM Configure this in Image File Execution Options like so:REM [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Outlook.exe]REM "Debugger"="cmd /c c:\\tools\\DoProcdump.cmd"REM (Double \\ are how \ are represented in .reg files. If setting this value manually, use single \.)REM Change these paths to reflect the location of Procdump and the location to which the output files should be written.REM Data collection should include .dmp files and all procdumpOutput*.txt files written to the out path.set PDOutPath="C:\tools"set PDExe="C:\tools\Procdump.exe"REM Only enable one of the following.REM Use this filter to catch only second chance exceptions.Set PDFilter=/eREM Enable this filter to catch specific first chance exceptions in addition to second chance exceptions.REM Set PDFilter=/e 1 /f "System.Threading.ThreadAbortException" /f "System.AccessViolationException"REM Configure the maximum number of dumps to gather here.Set PDNumDumps=5REM Enable this also gather dumps on process shutdown.REM Set PDTerm=/tset PDCfg=/ma /n %PDNumDumps% %PDTerm% %PDFilter% /x@ECHO *************************************************************@ECHO *                                                           *@ECHO *               DO NOT CLOSE THIS WINDOW!                   *@ECHO *                                                           *@ECHO * This window will close automatically  when Outlook exits. *@ECHO *                                                           *@ECHO *************************************************************@ECHO.@ECHO Running: %PDExe% %PDCfg% %PDOutPath% %*REM This generates a good file name for our log file.for /f "delims=/ tokens=1-3" %%a in ("%DATE:~4%") do (for /f "delims=:. tokens=1-4" %%m in ("%TIME: =0%") do (set LOGFILE=%PDOutPATH%\procdumpOutput-%username%-%%c-%%b-%%a-%%m%%n%%o%%p.txt
   )
)@ECHO %* > %LOGFILE%@ECHO Current time %TIME: =0% >> %LOGFILE%@ECHO Running: %PDExe% %PDCfg% %PDOutPath% %* >> %LOGFILE%

%PDExe% %PDCfg% %PDOutPath% %* >> %LOGFILE% 2>&1

Message Header Analyzer’s Manifest

August 2014 Release of MFCMAPI and MrMAPI

$
0
0

The August 2014 Release (build 15.0.0.1042) is live: http://mfcmapi.codeplex.com.

It’s been a chaotic half year and I haven’t been able to get my builds out as often as I’d like, though I did do a ton of work on MFCMAPI.

This month we get a totally rebuilt MAPI property parsing engine. As it’s an engine change, you shouldn’t notice much different in MFCMAPI itself, but all of my XML exports get an upgrade.

Here's a change list - see the Issue Tracker and ChangeSets on Codeplex for more details:

  • Property Parsing engine rebuilt
  • MrMAPI: Fixed malformed XML in profile list when no profiles exist
  • Adding attachments is now possible
  • MrMAPI: Can now dump the receive folder table
  • Export now includes large props by defalt
  • SmartView: Understands PR_PREDECESSOR_CHANGE_LIST

Enjoy.

February 2014 Release of MFCMAPI and MrMAPI

$
0
0

The February 2014 Release (build 15.0.0.1041) is live: http://mfcmapi.codeplex.com.

The past month’s experiment of checking in as I go seemed to work well. Since the checkins are now self annotated I’ve decided to stop post creating items in the issue tracker for work I’ve already done. Do please continue to file items for work I need to do.

This month we get the ability to export profile information using MrMAPI. The folks working on our diagnostics tools are salivating over that. 🙂

Here’s a change list – see the Issue Tracker and ChangeSets on Codeplex for more details:

  • CopyTo operations give you the opportunity to fine tune the excluded prop set
  • Named prop details in notification logging
  • IExchangeManagedStoreEx support
  • A couple crashes have been squished
  • MrMAPI: profile export
  • Quickstart: New way to look up a user as well as their thumbnail

Enjoy.

MAPICDO March 2014 Release

$
0
0

It’s time for what is most likely the last release of the MAPICDO download. Here are the release notes:

Installation details:

  • The version given on the Download Center is 08.03.08353. The version stamped on the files, however, is 6.5.8353.0. All of the files in the update are dated January 13th, 2014.
  • If you already have a version of the MAPI Download installed, you must uninstall it before installing the new version. The installer does not upgrade, nor does it warn you if you try to install it without uninstalling the previous version.

Fixes:

  • We fixed a connection leak on network errors which contributed to MAPI clients getting shut out of talking to the Exchange server. More details on this fix are given here: http://support.microsoft.com/kb/2937628
  • That’s it – again – this is probably the last release we’ll do to MAPICDO. If you haven’t already, move your apps to EWS, or Apps for Office, or the brand new Office 365 APIs.

Enjoy!

Outlook 2013 Click To Run and COM Interfaces

$
0
0

In this article I’ll go over the current state of Outlook 2013 Click To Run (C2R)and support for various programmatic interfaces. Please comment on any areas I’ve missed and I’ll update the article accordingly.

With Outlook 2013, we enabled something we had never supported before, side by side (SxS)  installation with other versions of Outlook. Specifically, we support installing Outlook 2013 side by side with Outlook 2010 or Outlook 2007. We do this by installing Outlook 2013 using Click-to-Run. For most MAPI applications and Outlook Add-Ins, C2R does not pose a problem. However, there is a small set of COM interfaces for which C2R creates an issue. We’ll go over them one by one.

Account Manager

This interface gave us the most trouble, but we’ve got it mostly fixed now. Let’s look at how the Outlook Account Manager, or CLSID_OlkAccountManager, caused a problem in the first place. This will also help us understand the remaining interfaces.

On a regular 64 bit installation of Windows with Outlook 2010 32 bit installed, we’ll find this interface registered here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{ED475410-B0D6-11D2-8C3B-00104B2A6676}

The registration will tell COM where to find OUTLMIME.DLL, which actually implements the interface. On the same system, with Outlook 2013 C2R installed, we find this key instead:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{ED475410-B0D6-11D2-8C3B-00104B2A6676}

COM won’t ever know to look here. But when Outlook needs this interface it finds it. How? That’s part of the Click To Run application bubble. Applications outside the bubble see the normal registry. Applications inside the bubble see the normal registry, plus any registry keys mapped through the ClickToRun key. So when Outlook, which runs inside the bubble, looks for the class {4E3A7680-B77A-11D0-9DA5-00C04FD65685}, it has no trouble finding it. Other applications won’t see it though.

Outlook and Office register every class they expose inside the bubble. A few classes are also registered outside the bubble so that other applications can use them. So why don’t we just register CLSID_OlkAccountManager outside the bubble? We actually tried that. We took a fix to register this interface outside the bubble and found that Outlook 2010 clients started crashing. When Outlook 2010 tried to locate it’s own implementation of the Account Manager, it got Outlook 2013’s implementation, which promptly crashed. We had to pull this fix and be a little smarter about it. Now, C2R will only register this key outside the bubble if it detects that a previous version of Outlook isn’t already installed. This is the only interface we’ve done this for.

MAPI<->MIME

The MAPI<->MIME conversion interface, IConverterSession and the support interface it depends on, IMimeMessage, are also only registered inside the bubble. Several customers have chosen to fix this one by hand by copying the registrations from inside the bubble to outside. If the bitness of Outlook matches the bitness of the OS, you could do this as follows:

rem For when the Office bitness matches Windows bitness:
rem IConverterSession
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /f
rem IMimeMessage
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /f

If the bitness differs:

rem For Office 32-bit on Windows 64-bit:
rem IConverterSession
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{4E3A7680-B77A-11D0-9DA5-00C04FD65685} /s /f
rem IMimeMessage
reg copy HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\REGISTRY\MACHINE\Software\Classes\Wow6432Node\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} HKLM\SOFTWARE\Classes\Wow6432Node\CLSID\{9EADBD1A-447B-4240-A9DD-73FE7C53A981} /s /f

Only do this if Outlook 2013 is not installed side by side with another version of Outlook, or you risk breaking the older version of Outlook!

Also, note that this is why many of you have written to complain to me that MFCMAPI can no longer work with EML files with Outlook 2013 – you have Outlook 2013 C2R and it can’t work unless you patch up the registry.

MAPI Marshalling

Finally, there’s the little known/understood area of MAPI marshalling. This is an area we almost never see…except that Redemption depends on it. In this case, the problem isn’t that COM objects themselves aren’t registered (MAPI isn’t COM after all). The problem is that the proxy stub maps are hidden in the bubble. Dmitry and I worked together to come up with a .reg file to fix this one: https://groups.yahoo.com/neo/groups/Outlook-Redemption/conversations/topics/9600

The same warning about not doing this in a side by side scenario applies. Dmitry points out that we intend to fix this in the C2R installer. We did intend to fix it at the time Dmitry and I spoke, but after the problems we encountered with the Account Manager it became harder to justify these sorts of changes.

Resources

Automated Dump Collection Using Procdump

$
0
0

I thought I’d share a script I’ve been using on some recent cases to generate memory dump files on multiple machines for intermittent crashes. The scenario this script targets is that you have a process, say Outlook.exe, which is crashing for a number of users, but you haven’t yet narrowed down a repro scenario. You’d like to get memory dumps when the process crashes, and you’d also like to get extra debugging information which may help you hone in on the issue. You’d also like to set all of this up so the user doesn’t have to do anything themselves. They just run the process and data is generated automatically for you to collect later.

This script, set through Image File Execution Options, attaches Procdump.exe to your process every time it starts, so it can listen for exceptions and write dump files when interesting ones occur. It also captures Procdump’s debug spew in a log file which you can use to identify first chance exceptions that you’d also like to get dumps for. Once enabled, you’ll just need to visit the user’s machine periodically to collect the dumps and logs for analysis.

To use this script, create a file called DoProcDump.cmd and place it in c:\tools alongside procdump.exe (you can configure these paths differently if you like, but you’ll need to modify the script) and then create an entry under Image File Execution Options. Next time the user starts the process, Procdump will attach and listen for exceptions. There are a number of ways you can change up the data collection, such as enabling first chance exceptions, or getting dumps on process shutdown (useful for silent exits, though this is even better). Look at the comments in the script to see how to enable and configure these.

To disable this script, just remove the reg key you created under Image File Execution Options.

BTW, I got the unique file name code from here: http://blogs.msdn.com/b/myocom/archive/2005/06/03/creating-unique-filenames-in-a-batch-file.aspx

Enjoy!

@ECHO off
REM *****DoProcDump.cmd*****
REM Configure this in Image File Execution Options like so:
REM [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Outlook.exe]
REM "Debugger"="cmd /c c:\\tools\\DoProcdump.cmd"
REM (Double \\ are how \ are represented in .reg files. If setting this value manually, use single \.)

REM Change these paths to reflect the location of Procdump and the location to which the output files should be written.
REM Data collection should include .dmp files and all procdumpOutput*.txt files written to the out path.
set PDOutPath="C:\tools"
set PDExe="C:\tools\Procdump.exe"

REM Only enable one of the following.
REM Use this filter to catch only second chance exceptions.
Set PDFilter=/e
REM Enable this filter to catch specific first chance exceptions in addition to second chance exceptions.
REM Set PDFilter=/e 1 /f "System.Threading.ThreadAbortException" /f "System.AccessViolationException"

REM Configure the maximum number of dumps to gather here.
Set PDNumDumps=5

REM Enable this also gather dumps on process shutdown.
REM Set PDTerm=/t

set PDCfg=/ma /n %PDNumDumps% %PDTerm% %PDFilter% /x

@ECHO *************************************************************
@ECHO *                                                           *
@ECHO *               DO NOT CLOSE THIS WINDOW!                   *
@ECHO *                                                           *
@ECHO * This window will close automatically  when Outlook exits. *
@ECHO *                                                           *
@ECHO *************************************************************
@ECHO.
@ECHO Running: %PDExe% %PDCfg% %PDOutPath% %*

REM This generates a good file name for our log file.
for /f "delims=/ tokens=1-3" %%a in ("%DATE:~4%") do (
   for /f "delims=:. tokens=1-4" %%m in ("%TIME: =0%") do (
      set LOGFILE=%PDOutPATH%\procdumpOutput-%username%-%%c-%%b-%%a-%%m%%n%%o%%p.txt
   )
)

@ECHO %* > %LOGFILE%
@ECHO Current time %TIME: =0% >> %LOGFILE%
@ECHO Running: %PDExe% %PDCfg% %PDOutPath% %* >> %LOGFILE%

%PDExe% %PDCfg% %PDOutPath% %* >> %LOGFILE% 2>&1

Message Header Analyzer’s Manifest

August 2014 Release of MFCMAPI and MrMAPI

$
0
0

The August 2014 Release (build 15.0.0.1042) is live: http://mfcmapi.codeplex.com.

It’s been a chaotic half year and I haven’t been able to get my builds out as often as I’d like, though I did do a ton of work on MFCMAPI.

This month we get a totally rebuilt MAPI property parsing engine. As it’s an engine change, you shouldn’t notice much different in MFCMAPI itself, but all of my XML exports get an upgrade.

Here’s a change list – see the Issue Tracker and ChangeSets on Codeplex for more details:

  • Property Parsing engine rebuilt
  • MrMAPI: Fixed malformed XML in profile list when no profiles exist
  • Adding attachments is now possible
  • MrMAPI: Can now dump the receive folder table
  • Export now includes large props by defalt
  • SmartView: Understands PR_PREDECESSOR_CHANGE_LIST

Enjoy.

ProfileProp – Examine Profile Properties

$
0
0

I’ve had some requests lately to write a MAPI sample that shows how to access profile properties programmatically, so I threw this together from some bits and pieces of code I had laying around.

I had the chance to incorporate a few cool features in this code:

  1. MultiEx: It loops over the profile services looking for services of type MSEMS, grabbing the PR_EMSMDB_SECTION_UID property for each. It uses this to open the global profile section for each account.
  2. MAPI Stub Library: This sample uses the MAPI Stub Library, demonstrating yet again how easy this library is to incorporate. The version I’m using here is cribbed from the MFCMAPI source.
  3. The profile name is optional: You can specify any profile you want, or if you leave it out, it will look up and use the default profile.
  4. Deletion: If you have a property you want to delete, you can pass the –d switch. Be careful with this! Deleting random properties could corrupt your profile and leave you in a state where the only fix is to recreate the profile or restore from backup. Make sure you know what your doing before you delete a property!
  5. Backup: If you do use the deletion switch, this sample will create a backup of the profile using CopyProfile.

Here’s the help, showing how to use the sample:

C:\>ProfileProp.exe -?
ProfileProp – Profile Property Examination Tool
   Locates and optionally deletes a property from the Exchange Global Profile section of a profile.
   In the case of multiple Exchange accounts, will locate the property for each account.

Usage:  ProfileProp [-?] [-p profile] [-d] <property tag number>

Options:
        -p profile Name of new profile to examine.
                       Default profile will be used if -p is not used.

        -d         Delete the property (otherwise just locate it)

        -?         Displays this usage information.

Suppose you wanted to use this to output the display name of each account in the profile. You could do this (note that 0x3001001F is PR_DISPLAY_NAME):

C:\>ProfileProp.exe 0x3001001F
Profile Property Tool
Profile: Outlook
Property: 0x3001001F

Examining account Microsoft Exchange
        Located property
                Property tag: 0x3001001F
                Value: sgriffin@example.com
Examining account Microsoft Exchange
        Located property
                Property tag: 0x3001001F
                Value: sgriffin@example.example.com

I haven’t implemented property name lookup like in MrMAPI, and I probably won’t.

You can get the sample here.

Enjoy!

September 2015 Release of MFCMAPI and MrMAPI

$
0
0

The September 2015 Release (build 15.0.0.1043) is live: http://mfcmapi.codeplex.com.

It’s amazing – how much I don’t get to work on MFCMAPI when I’m no longer in Developer Support. That’s no excuse for leaving it alone for a year! I did patch quite a bit in the past year.

Here’s a change list – see the Issue Tracker and ChangeSets on Codeplex for more details:

  • SmartView: Completely rewrote the engine to be much more modular and easier to maintain
  • MrMAPI: Fixed several crashes, leaks, and hangs
  • Migrated a metric ton of old CString and manual string handling to wstring
  • Performance: Did a whole bunch of performance tweaks – everything should be much snappier

Enjoy.

October 2016 Release of MFCMAPI and MrMAPI

$
0
0

The October 2016 Release (build 16.0.16292.01) is live: http://mfcmapi.codeplex.com.

So – I managed somehow to let a year go by without a new release. I hadn’t stopped hacking on MFCMAPI. To the contrary – I completely rewrote all of the string handling to something a bit more modern than naked LPSTR. I also fixed that nasty bug some of you may have seen on Windows 10 – the empty error dialog when you roll over the wrong menu item.

More importantly though, I’ve overhauled my build and publication process. MFCMAPI source is no longer hosted on Codeplex (sniff). You’ll find it over on Github now:

https://github.com/stephenegriffin/mfcmapi

Fortunately, I was able to migrate the complete source history, so it barely stung at all when I checked in the deletion of the source on Codeplex. Feel free to head on over to Github and party. I’m open to pull requests. This is my first project on github, so if I’m not doing things “the right way” just let me know.

I’ve also migrated my build process up to Visual Studio Team Services. I had intended to set this up on a public server, but I see now it’s still private. I’ll have to look in to migrating it. But what I’ve gained is:

  • Continuous integration: I get a build on every check in
  • Nightly builds: I build every possible variation of the project every night
  • One click build and publication to Codeplex

That last one is the crown jewel. In one action I can kick off build, package, and deploy to Codeplex. All I have to do then is check it over, write the blog post, and unhide it. Now I have zero excuses for not publishing updates more often.

I’ll forgo the change list. You can see what I’ve done up on Github.

Enjoy.

Viewing all 84 articles
Browse latest View live