Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust DEVMODE structure fields #1329

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

riverar
Copy link
Collaborator

@riverar riverar commented Oct 26, 2022

Fixes: #1325

Sample from original reporter, tweaked to validate the struct:

use windows::Win32::Graphics::Gdi::*;
fn main() {
    let mut dm = DEVMODEA::default();
    dm.dmSize = std::mem::size_of_val(&dm) as u16;
    assert_eq!(dm.dmSize, 156);

    let b = unsafe {
        EnumDisplaySettingsExA(
            windows::core::PCSTR::null(),
            ENUM_CURRENT_SETTINGS,
            &mut dm,
            0u32,
        )
    };

    println!("Result: {:?}", b);
    println!("dm.dmSize: {:?}", dm.dmSize);
    println!("dmBitsPerPel: {:?}", dm.dmBitsPerPel);
    println!("dmPelsWidth: {:?}", dm.dmPelsWidth);
    println!("dmPelsHeight: {:?}", dm.dmPelsHeight);
    println!("dmDisplayFrequency: {:?}", dm.dmDisplayFrequency);
    println!("others");
    println!("dmSpecVersion: {:?}", dm.dmSpecVersion);
    println!("dmDriverVersion: {:?}", dm.dmDriverVersion);
    println!("dmDriverExtra: {:?}", dm.dmDriverExtra);
    println!("dmLogPixels: {:?}", dm.dmLogPixels);
    println!("dmICMMethod: {:?}", dm.dmICMMethod);
}
Result: BOOL(1)
dm.dmSize: 156
dmBitsPerPel: 32
dmPelsWidth: 5120
dmPelsHeight: 1440
dmDisplayFrequency: 120
others
dmSpecVersion: 1025
dmDriverVersion: 1025
dmDriverExtra: 0
dmLogPixels: 0
dmICMMethod: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEVMODE structure has fields with incorrect types
2 participants