From 11c10b16be213e198918ca665bfec47345923edb Mon Sep 17 00:00:00 2001 From: Rafael Rivera Date: Wed, 13 Nov 2024 16:41:01 -0800 Subject: [PATCH] Update samples --- crates/samples/windows-sys/counter/src/main.rs | 4 ++-- crates/samples/windows/counter/src/main.rs | 4 ++-- crates/samples/windows/dcomp/src/main.rs | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/samples/windows-sys/counter/src/main.rs b/crates/samples/windows-sys/counter/src/main.rs index bfb7ade07b..7316b94ac9 100644 --- a/crates/samples/windows-sys/counter/src/main.rs +++ b/crates/samples/windows-sys/counter/src/main.rs @@ -2,10 +2,10 @@ use windows_sys::{core::*, Win32::System::Performance::*}; fn main() { unsafe { - let mut query = 0; + let mut query = std::ptr::null_mut(); PdhOpenQueryW(std::ptr::null(), 0, &mut query); - let mut counter = 0; + let mut counter = std::ptr::null_mut(); PdhAddCounterW( query, w!("\\Processor(0)\\% Processor Time"), diff --git a/crates/samples/windows/counter/src/main.rs b/crates/samples/windows/counter/src/main.rs index e5edc7896c..b1a805b827 100644 --- a/crates/samples/windows/counter/src/main.rs +++ b/crates/samples/windows/counter/src/main.rs @@ -2,10 +2,10 @@ use windows::{core::*, Win32::System::Performance::*}; fn main() { unsafe { - let mut query = 0; + let mut query = PDH_HQUERY::default(); PdhOpenQueryW(None, 0, &mut query); - let mut counter = 0; + let mut counter = PDH_HCOUNTER::default(); PdhAddCounterW( query, w!("\\Processor(0)\\% Processor Time"), diff --git a/crates/samples/windows/dcomp/src/main.rs b/crates/samples/windows/dcomp/src/main.rs index bf9c685e06..14694115e8 100644 --- a/crates/samples/windows/dcomp/src/main.rs +++ b/crates/samples/windows/dcomp/src/main.rs @@ -261,8 +261,7 @@ impl Window { } let desktop = self.desktop.as_ref().expect("IDCompositionDesktopDevice"); - let mut stats = Default::default(); - desktop.GetFrameStatistics(&mut stats)?; + let stats = desktop.GetFrameStatistics()?; let next_frame: f64 = stats.nextEstimatedFrameTime as f64 / stats.timeFrequency as f64;