Skip to content

Commit

Permalink
Upgrade to windows 0.37.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick888 committed Jun 17, 2022
1 parent f7879fd commit e4c98cb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ xml-rs = "0.8.4"
strum = { version = "0.22.0", features = ["derive"] }

[target.'cfg(target_env = "msvc")'.dependencies.windows]
version = "0.24.0"
version = "0.37.0"
features = [
"Win32_Foundation",
"Foundation_Collections",
Expand All @@ -29,8 +29,9 @@ features = [
]

[target.'cfg(target_env = "gnu")'.dependencies.windows]
version = "0.24.0"
version = "0.37.0"
features = [
"alloc",
"Win32_Foundation",
"Foundation_Collections",
"Win32_System_SystemInformation",
Expand Down
4 changes: 2 additions & 2 deletions examples/without_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use windows::{
UI::Notifications::ToastNotificationManager,
};

pub use windows::runtime::{
pub use windows::core::{
Error,
HSTRING,
};
Expand All @@ -26,7 +26,7 @@ fn main() {
std::thread::sleep(std::time::Duration::from_millis(10));
}

fn do_toast() -> windows::runtime::Result<()> {
fn do_toast() -> windows::core::Result<()> {
let toast_xml = XmlDocument::new()?;

toast_xml.LoadXml(HSTRING::from(
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use std::path::Path;
use xml::escape::escape_str_attribute;
mod windows_check;

pub use windows::runtime::{Error, HSTRING, Result};
pub use windows::core::{Error, HSTRING, Result};
pub use windows::UI::Notifications::ToastNotification;

pub struct Toast {
Expand Down Expand Up @@ -283,7 +283,7 @@ impl Toast {
self
}

fn create_template(&self) -> windows::runtime::Result<ToastNotification> {
fn create_template(&self) -> windows::core::Result<ToastNotification> {
//using this to get an instance of XmlDocument
let toast_xml = XmlDocument::new()?;

Expand Down Expand Up @@ -325,7 +325,7 @@ impl Toast {
}

/// Display the toast on the screen
pub fn show(&self) -> windows::runtime::Result<()> {
pub fn show(&self) -> windows::core::Result<()> {
let toast_template = self.create_template()?;

let toast_notifier = ToastNotificationManager::CreateToastNotifierWithId(HSTRING::from(&self.app_id))?;
Expand Down
4 changes: 3 additions & 1 deletion src/windows_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ mod internal {
#[allow(non_snake_case)]
pub unsafe fn RtlGetNtVersionNumbers(major: *mut u32, minor: *mut u32, build: *mut u32) {
if CacheRtlGetNtVersionNumbers.is_none() {
CacheRtlGetNtVersionNumbers = GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlGetNtVersionNumbers");
if let Ok(handle) = GetModuleHandleA("ntdll.dll") {
CacheRtlGetNtVersionNumbers = GetProcAddress(handle, "RtlGetNtVersionNumbers");
}
}

if let Some(RtlGetNtVersionNumbers_FUNCTION) = CacheRtlGetNtVersionNumbers {
Expand Down

0 comments on commit e4c98cb

Please sign in to comment.