Rust for Debug Interface Access (DIA) SDK
Перейти к файлу
Rafael Rivera 9961def48b
Update windows dependency (#9)
2022-10-24 14:49:45 -07:00
.github Update windows dependency (#9) 2022-10-24 14:49:45 -07:00
.metadata Update crate (#7) 2022-09-22 13:57:06 -07:00
.windows Update crate (#7) 2022-09-22 13:57:06 -07:00
crates Update windows dependency (#9) 2022-10-24 14:49:45 -07:00
src Update crate (#7) 2022-09-22 13:57:06 -07:00
.gitattributes Initial crate 2021-11-18 22:10:59 -08:00
.gitignore Initial crate 2021-11-18 22:10:59 -08:00
Cargo.toml Update windows dependency (#9) 2022-10-24 14:49:45 -07:00
license-apache-2.0 Add license 2022-09-22 09:38:14 -05:00
license-mit Add license 2022-09-22 09:38:14 -05:00
rustfmt.toml Initial crate 2021-11-18 22:10:59 -08:00

.github/README.md

crates.io

Rust for Debug Interface Access (DIA) SDK

The Microsoft Debug Interface Access Software Development Kit (DIA SDK) provides access to debug information stored in program database (.pdb) files generated by Microsoft postcompiler tools.

Start by adding windows and microsoft-dia dependencies to Cargo.toml:

[dependencies.windows]
version = "0.43.0"
features = [
    "Win32_System_Com"
]

[dependencies.microsoft-dia]
version = "0.1.0"

Make use of any DIA SDK APIs as needed.

use microsoft_dia::{nsfRegularExpression, DiaSource, IDiaDataSource, SymTagFunction};
use windows::{core::*, Win32::System::Com::{CoInitializeEx, COINIT_MULTITHREADED}};

fn main() -> windows::core::Result<()> {
    unsafe {
        CoInitializeEx(None, COINIT_MULTITHREADED)?;

        let source: IDiaDataSource = microsoft_dia::helpers::NoRegCoCreate(s!("msdia140.dll"), &DiaSource)?;
        let executable = std::env::current_exe().unwrap();
        source.loadDataForExe(&HSTRING::from(executable.as_os_str()), None, None)?;

        let session = source.openSession()?;
        let symbols = session.globalScope()?.findChildren(SymTagFunction, w!("sample_functions::*"), nsfRegularExpression.0 as u32)?;

        println!("Function symbols found in sample_functions::* ({}):", &executable.to_string_lossy());

        for i in 0..symbols.Count()? {
            println!("\t{}", symbols.Item(i as u32)?.name()?);
        }

        Ok(())
    }
}