Skip to content

default ABI #2257

Closed
Closed
@kcrazy

Description

@kcrazy

the default ABI of the windows kernel is stdcall, so the most functions do not specify ABI.
Is it possible to increase the default ABI option?
example default_abi(name: &str)

bindgen::Builder::default().default_abi("stdcall"). ...;

Input C/C++ Header

// #include <ntifs.h>

#define DECLSPEC_IMPORT __declspec(dllimport)
#define NTKERNELAPI DECLSPEC_IMPORT     // wdm ntndis ntifs

NTKERNELAPI
VOID
IoDeleteDevice (
    PDEVICE_OBJECT DeviceObject
    );

Bindgen Invocation

bindgen::Builder::default()
        .header("wrapper/wrapper.h")
        .use_core()
        .derive_debug(false)
        .layout_tests(false)
        .ctypes_prefix("cty")
        .default_enum_style(bindgen::EnumVariation::ModuleConsts)
        .clang_arg(format!("-I{}", include_dir.to_str().unwrap()))
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        .blocklist_type(".*")
        .allowlist_function(".*")
        .allowlist_recursively(false)
        .generate()
        .unwrap();

Actual Results

extern "C" {
    pub fn IoDeleteDevice(DeviceObject: PDEVICE_OBJECT);
}

Expected Results

extern "stdcall" {
    pub fn IoDeleteDevice(DeviceObject: PDEVICE_OBJECT);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions