Skip to main content

pydia3

The ultimate Python wrapper for the Microsoft's DIA SDK (Debug Interface Access)


Goal

pydia3 aims to ease the manual handling of PDB files. No more hacking together some IDA-Python - you can now use your favorite python ditribution and simply install a package! pydia3 makes all the common functionality used when working with PDB files extremely accessible.

My future vision

Hopefully, we can make pydia3 so powerful we will be able to accurately recreate header files from PDBs alone.

How?

The ideaology of pydia3 is as follows:

  • Every DIA2 SDK COM function is wrapped by a neat C++ function which handles all memory allocation/de-allocation and reference count tracking. These C++ wrappers are found in DiaLib.
  • Each DIA2 SDK "class" is implemented as a C-API Python class in pydia (the sub-project).
    • The C-Python wrapper will never directly call a COM function - rather it will call a DiaLib method which will wrap the low level memory managment.
  • The C-Python wrappings (pydia) must be as user-friendly and safe as possible. It should be actively difficult to missuse pydia's exported Python API.
  • The DiaLib wrappings should be 100% responsible for all low-level management - especially memory-wise. Unless the user is a dehydrated donkey they should not be able to cause DiaLib to "seg-fault" (0xC0000005 - STATUS_ACCESS_VIOLATION).

Installation

pydia3 is Windows-only (x64) and supports CPython 3.12, 3.13, 3.14 and 3.15.

pip install pydia3

Install it as pydia3 and import it as pydia3. The DIA runtime (msdia140.dll) must be registered on the machine; it ships with Visual Studio (<VS install>\DIA SDK\bin\amd64\msdia140.dll). If it isn't registered, run from an elevated prompt:

regsvr32 "<VS install>\DIA SDK\bin\amd64\msdia140.dll"

Usage

import pydia3
from pydia3 import DataSource

# Accepts a .pdb, or a binary whose PDB can be found via the symbol path.
data_source = DataSource(r"C:\Windows\System32\ntdll.dll")

for enum in data_source.get_symbols(pydia3.SymTag.Enum):
    print(enum.get_name(), enum.get_length(), enum.get_values())

for udt in data_source.get_symbols(pydia3.SymTag.UDT):
    print(udt.get_name())
    for member in udt.enumerate_members():
        print("   ", member.get_name(), hex(member.get_offset()))

See Examples/Python/ntdll_header_builder.py for a full example that rebuilds C headers (enums and structs) from PDBs, and PyTests for more API usage.

Internals

Directory structure

  • CTests
    • Testing framework for DiaLib based on Microsoft's CppUnitTestFramework.
    • Resources
    • Generally useful binary/misc resources for tests.
  • DiaLib
    • Implementation of the C++ wrapper library for the DIA2 SDK.
  • PyTests
    • Testing framework for pydia (the C-API Python module) based on pytest.
  • pydia
    • Implementation of the C-API Python module which wraps DiaLib (and by transitivity also the DIA2 SDK)

Building from source

Prerequisites

  • Windows x64.
  • Visual Studio 2022 with the Desktop development with C++ workload (this includes the DIA SDK, at <VS install>\DIA SDK).
  • CPython 3.12, 3.13, 3.14 or 3.15 x64 (python.org installer), including its headers and import libraries.

Build

From a Developer PowerShell for VS 2022:

# Where the target Python (3.12-3.15) is installed (defaults to C:\Python312).
# The extension is built for, and the wheel tagged for, this interpreter.
$env:PYTHON_HOME = python -c "import sys; print(sys.base_prefix)"
# Optional: only needed if the DIA SDK isn't at <VS install>\DIA SDK.
# $env:DIA_SDK_DIR = "C:\path\to\DIA SDK"

msbuild pydia.sln /m /p:Configuration=Release-Python /p:Platform=x64 /t:pydia

Alternatively, open pydia.sln in Visual Studio and build the Release-Python | x64 configuration (it builds for whichever Python PYTHON_HOME points at). The build produces pydia3.pyd and stages a ready-to-package folder at x64\Release-Python\package.

Build and install a wheel

cd x64\Release-Python\package
python -m pip install build
python -m build --wheel
python -m pip install (Get-ChildItem dist\*.whl).FullName
python -c "import pydia3; print(pydia3.DataSource)"

Running the tests

python -m pip install pytest
$env:PYTHONPATH = "$PWD\x64\Release-Python\package"
python -m pytest

The C++ tests in CTests use the Microsoft CppUnitTestFramework and run from Visual Studio's Test Explorer.

Linting

python -m pip install -r requirements-dev.txt
python -m ruff check .
python -m ruff format --check .

Metadata

Release files for pydia3 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pydia3 0.2.1
File Interpreter ABI Platform
pydia3-0.2.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
pydia3-0.2.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pydia3-0.2.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details

Total release size: 327.1 kB

Release files / pydia3-0.2.1-cp314-cp314-win_amd64.whl

Download URL pydia3-0.2.1-cp314-cp314-win_amd64.whl
Size 111.2 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
e925959016e50b7ea4c9694c60de137146663c6dda2b3c4b5311e2b8b5ebda2d
BLAKE2b-256 checksum
How to use checksums
a545077449f145c05415a4950cd4465f83eb38cac9db7a54543e510ee9cf859a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / pydia3-0.2.1-cp313-cp313-win_amd64.whl

Download URL pydia3-0.2.1-cp313-cp313-win_amd64.whl
Size 107.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
bb8067b1d0145710233183089f11d21beee6ee371e69fd31879effd3f5c86af1
BLAKE2b-256 checksum
How to use checksums
50e914050ed2a8c2dd9dd3a4bd6cf70a01cd0f157f6ffc90d42c28f693637ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / pydia3-0.2.1-cp312-cp312-win_amd64.whl

Download URL pydia3-0.2.1-cp312-cp312-win_amd64.whl
Size 107.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
6807b743553ca99393652921fbcad10bf6b42549755d48d6b09e94e9d9179379
BLAKE2b-256 checksum
How to use checksums
914817a7ca39ca4717caf8901266a6168ba2186f9b2ae0987f1c755a75d0c109
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

3 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page