CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-comtypes

Pure Python COM package for Windows COM automation and interoperability

88

0.98x
Overview
Eval results
Files

task.mdevals/scenario-10/

COM Type Library Analyzer

Build a utility that analyzes Windows COM type libraries and generates a JSON report containing metadata about the interfaces, classes, and enumerations defined within them.

Requirements

Your utility should:

  1. Accept a path to a type library file (.tlb, .dll, or .exe) as input
  2. Parse the type library and extract information about its contents
  3. Generate a structured JSON report with the following information:
    • Type library name and version
    • List of all interfaces with their methods and parameters
    • List of all coclasses with their implemented interfaces
    • List of all enumerations with their constants
  4. Handle type library references to other type libraries
  5. Output the report to a file named tlb_report.json

Implementation

@generates

The main entry point should be a function that accepts a type library path and output path.

API

def analyze_type_library(tlb_path: str, output_path: str) -> dict:
    """
    Analyze a COM type library and generate a JSON report.

    Args:
        tlb_path: Path to the type library file (.tlb, .dll, or .exe)
        output_path: Path where the JSON report should be written

    Returns:
        dict: The analysis report as a dictionary

    Raises:
        FileNotFoundError: If the type library file does not exist
        ValueError: If the file is not a valid type library
    """
    pass

Test Cases

  • Analyzes a type library and returns a dictionary containing the library name and version @test
  • Extracts interface information including method names and parameter counts @test
  • Extracts coclass information including implemented interface names @test
  • Extracts enumeration information including constant names and values @test
  • Writes the analysis report to the specified JSON output file @test
  • Raises FileNotFoundError when the type library path does not exist @test

Dependencies { .dependencies }

comtypes { .dependency }

Provides COM type library parsing and analysis capabilities for Windows.

Install with Tessl CLI

npx tessl i tessl/pypi-comtypes

tile.json