Skip to content

πŸ” Powerful Windows COM interface extractor for developers and reverse engineers. Outputs C++-ready interface definitions with RVA offsets

License

player-alex/CoMiExtractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

62 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” CoMiExtractor

Platform Language License

A powerful Windows COM (Component Object Model) Interface Extractor πŸš€


πŸ“‹ Overview

CoMiExtractor is a specialized tool designed to inspect and extract interface information from Windows COM objects. It leverages IProvideClassInfo and IDispatch interfaces to provide comprehensive details about COM interfaces, methods, and parameters - essential for development, debugging, and reverse engineering.

✨ Features

  • 🎯 Interface Extraction - Automatically discovers and extracts COM interface definitions
  • πŸ”¬ Method Analysis - Retrieves detailed method information including parameters and return types
  • πŸ“Š RVA Offset Calculation - Computes Relative Virtual Address offsets for each method
  • 🧬 Type Information - Provides complete type information for parameters and return values
  • πŸ› οΈ Development Ready - Outputs C++-compatible interface definitions ready for use

πŸ“¦ What Gets Extracted

Interface Information

Target Description
Name Interface name
IID Interface identifier (GUID)

Method Information

Target Description
Name Method name
Return Type Method return value type
Invoke Kind Property access type [Get, Set, SetRef]
Display Id Method display ID (DISPID)
RVA Offset Relative Virtual Address offset

Parameter Information

Target Description
Name Parameter name
Direction Parameter direction [In, Out]
Type Parameter type (VARENUM reference)

πŸš€ Usage

Option 1: Interactive Mode

CoMiExtractor.exe
# Enter CLSID when prompted

Option 2: Command Line

CoMiExtractor.exe "{CLSID}"

Example

CoMiExtractor.exe "{2A0B9D10-4B87-11D3-A97A-00104B365C9F}"

πŸ“„ Output Example

MIDL_INTERFACE("2A0B9D10-4B87-11D3-A97A-00104B365C9F")
IFileSystem3 : public IUnknown
{
public:
        // Display Id: 0x60000000
        static const uintptr_t QueryInterfaceRvaOffset = 0x3c80;
        virtual void STDMETHODCALLTYPE QueryInterface(
                /* [in] */ void* riid,
                /* [out] */ void* ppvObj) = 0;

        // Display Id: 0x60000001
        static const uintptr_t AddRefRvaOffset = 0xfec0;
        virtual DWORD STDMETHODCALLTYPE AddRef() = 0;

        // Display Id: 0x60000002
        static const uintptr_t ReleaseRvaOffset = 0x5600;
        virtual DWORD STDMETHODCALLTYPE Release() = 0;

        // Display Id: 0x2710
        static const uintptr_t BuildPathRvaOffset = 0x14870;
        virtual BSTR STDMETHODCALLTYPE BuildPath(
                /* [in] */ BSTR Path,
                /* [in] */ BSTR Name) = 0;

        // Display Id: 0x460
        static const uintptr_t CreateFolderRvaOffset = 0x14bc0;
        virtual void* STDMETHODCALLTYPE CreateFolder(/* [in] */ BSTR Path) = 0;
};

πŸ—οΈ Building

Prerequisites

  • Visual Studio 2022 (or later)
  • Windows SDK 10.0
  • Platform Toolset v143

Build Steps

  1. Clone the repository

    git clone https://github.com/player-alex/CoMiExtractor.git
    cd CoMiExtractor
  2. Open the solution

    cd CoMiExtractor
    start CoMiExtractor.sln
  3. Build the project

    • Select configuration (Debug/Release)
    • Select platform (Win32/x64)
    • Build β†’ Build Solution (Ctrl+Shift+B)
  4. Run the executable

    cd Release
    CoMiExtractor.exe

πŸ”§ Project Structure

CoMiExtractor/
β”œβ”€β”€ CoMiExtractor/
β”‚   β”œβ”€β”€ inc/
β”‚   β”‚   β”œβ”€β”€ CoMiExtractor.h    # Main extractor class header
β”‚   β”‚   └── Utils.h             # Utility functions and type mappings
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.cpp            # Entry point
β”‚   β”‚   └── CoMiExtractor.cpp   # Core extraction implementation
β”‚   └── CoMiExtractor.vcxproj   # Visual Studio project file
β”œβ”€β”€ LICENSE                      # MIT License
└── README.md                    # This file

πŸ›‘οΈ Use Cases

Development

  • πŸ“š Generate interface definitions for undocumented COM objects
  • πŸ”„ Understand COM object capabilities and method signatures
  • πŸ§ͺ Create test harnesses for COM components

Reverse Engineering

  • πŸ” Analyze proprietary COM components
  • πŸ—ΊοΈ Map interface structures and method offsets
  • πŸ” Understand system component internals

Security Research

  • πŸ›‘οΈ Audit COM object attack surfaces
  • πŸ”¬ Identify exploitable method signatures
  • πŸ“Š Document interface capabilities for threat modeling

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

This tool is intended for legitimate development, debugging, and security research purposes only. Users are responsible for ensuring their use of this tool complies with all applicable laws and regulations.

πŸ™ Acknowledgments

  • Built with Windows COM/OLE APIs
  • Uses ATL (Active Template Library) for COM support
  • Type information extracted via ITypeInfo interfaces