MFCMAPI - Microsoft MAPI inspection tool

repository·main·Indexed 21 days ago

https://github.com/microsoft/mfcmapi

A utility for accessing MAPI stores used to troubleshoot Exchange and Outlook issues and serve as a reference sample for MAPI development. It provides capabilities for managing MAPI profiles, inspecting MAPI properties, and interacting with message stores. The tool includes a command-line interface (MrMAPI), support for add-in development via DLLs, and a sample project, CreateOutlookItemsAddin, for creating Outlook items.

Tokens
5.7K
Snippets
14
Records
35
Agent score
76%

What's inside MFCMAPI

  1. Overview of MFCMAPI

    main
    MFCMAPI is a tool that provides access to MAPI (Messaging Application Programming Interface) stores. It is primarily used to facilitate the investigation of Exchange and Outlook issues and serves as a reference implementation/sample for developers performing MAPI development.
  2. Capabilities of CreateOutlookItemsAddin

    main

    The CreateOutlookItemsAddin project provides implementations for creating the following Outlook items using MAPI:

    • Contacts (available in version 1.0)
    • Recurring Appointments (available in version 2.0)
    • Recurring Tasks (available in version 2.0)
    • Mail Items (creation and sending, available in version 2.0)
  3. Locate Fuzzing Artifacts

    main
    When the fuzzer discovers a crash or a hang, it automatically saves the specific input file that triggered the issue to the fuzz/artifacts/ directory. These files are essential for reproducing and debugging the discovered bugs.
  4. Generate the Fuzzing Corpus

    main

    The fuzzer requires binary input files. Since unit test data is stored as hex strings in .dat files, you must run the corpus builder to convert them. This command reads from UnitTest/SmartViewTestData/In/*.dat and writes the resulting binary files to fuzz/corpus/.

    Note: You must run this step before fuzzing, as the fuzz/corpus/ directory is not created automatically.

    npm run fuzz:corpus
  5. Build the Fuzz Configuration

    main

    You can build the fuzz configuration using either the command line or Visual Studio.

    Command Line:

    npm run build:fuzz

    Visual Studio:

    1. Open MFCMapi.sln in Visual Studio 2026.
    2. Select Fuzz from the Solution Configurations dropdown.
    3. Build the solution.
  6. Quick Start for Fuzzing MFCMAPI

    main

    To begin fuzzing MFCMAPI, you must follow a three-step sequence: generate the binary corpus from hex data, build the fuzz configuration, and then execute the fuzzer. This process uses libFuzzer and requires Visual Studio 2026 with the Fuzz build configuration and PowerShell.

    # 1. Generate the corpus (converts hex test data to binary)
    npm run fuzz:corpus
    
    # 2. Build the fuzz configuration
    npm run build:fuzz
    
    # 3. Run the fuzzer
    npm run fuzz
  7. Troubleshoot Hidden or Missing Folders and Items

    main

    MFCMAPI can be used to locate and manage items that are not visible in the standard Outlook interface. Common use cases include:

    • Locating Hidden Folders: Accessing folders that exist in the Exchange hierarchy but are hidden from the Outlook folder pane.
    • Recovering Missing Folders: Identifying and restoring folders that have disappeared from the user view.
    • Deleting Stuck Messages: Using MFCMAPI to force-delete hidden or 'stuck' messages that cannot be removed via standard Outlook commands.
    • Investigating IPM_SUBTREE: Troubleshooting vanishing emails by inspecting the IPM_SUBTREE structure.
  8. Run the Fuzzer

    main

    The fuzzer runs for a default of 60 seconds. You can execute it via VS Code, Visual Studio, or the Command Line.

    From VS Code

    1. Run pwsh .\fuzz\Build-FuzzingCorpus.ps1 (if not already done).
    2. Open the Run and Debug panel (Ctrl+Shift+D).
    3. Select "Fuzz (x64)" or "Fuzz (x86)" from the configuration dropdown.
    4. Press F5 to start.

    To change the runtime in VS Code, edit the selected fuzz entry in .vscode/launch.json and update the "-MaxTotalTime", "60" arguments.

    From Command Line

    Use npm run fuzz for the default architecture or specify x86:

    npm run fuzz
    # or
    npm run fuzz:x86

    To specify a custom runtime (in seconds) via the command line, pass the -MaxTotalTime argument:

    npm run fuzz:x64 -- -MaxTotalTime 300
    npm run fuzz:x86 -- -MaxTotalTime 120

    From Visual Studio

    1. Open MFCMapi.sln in Visual Studio.
    2. Select the fuzz/x64 project (or fuzz/x86).
    3. Press F5 to run.
    npm run fuzz:x64 -- -MaxTotalTime 300
  9. Troubleshoot OWA (Outlook Web Access) Issues

    main

    Use MFCMAPI to investigate problems occurring in the web-based client, including:

    • OWA Signatures: Managing or deleting OWA signatures that are generated with broken HTML code.
    • Access Restrictions: Investigating corrupt restriction filter data that prevents OWA access.
    • Configuration Settings: Understanding how OWA configuration settings interact with the underlying MAPI structure.