From f0440749e8d000821cbc1940dcb3c69e00c9f33f Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:32:46 +0800 Subject: [PATCH] Upgrade `windows-sys` to version 0.59 (and MSRV to 1.60) --- .github/workflows/ci.yaml | 22 ++++++++++++++++++++-- Cargo.toml | 4 ++-- src/reg_key.rs | 10 +++++----- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ebad2e2..4d349ce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,7 +20,7 @@ jobs: - channel: stable target: x86_64-pc-windows-msvc lint: true - - channel: '1.56' + - channel: '1.60' target: x86_64-pc-windows-msvc restrict_deps_versions: true env: @@ -47,18 +47,36 @@ jobs: uses: actions-rs/cargo@v1 with: command: generate-lockfile + - name: Restrict serde version + if: matrix.restrict_deps_versions + uses: actions-rs/cargo@v1 + with: + command: update + args: --package serde --precise 1.0.210 + - name: Restrict syn version + if: matrix.restrict_deps_versions + uses: actions-rs/cargo@v1 + with: + command: update + args: --package syn --precise 2.0.67 - name: Restrict chrono version if: matrix.restrict_deps_versions uses: actions-rs/cargo@v1 with: command: update - args: --package chrono --precise 0.4.26 + args: --package chrono --precise 0.4.31 - name: Restrict libc version if: matrix.restrict_deps_versions uses: actions-rs/cargo@v1 with: command: update args: --package libc --precise 0.2.163 + - name: Restrict memchr version + if: matrix.restrict_deps_versions + uses: actions-rs/cargo@v1 + with: + command: update + args: --package memchr --precise 2.6.2 - name: Setup Taplo if: matrix.lint uses: uncenter/setup-taplo@v1 diff --git a/Cargo.toml b/Cargo.toml index 9e7600e..1db5d93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "winreg" edition = "2021" -rust-version = "1.56" +rust-version = "1.60" version = "0.54.0" authors = ["Igor Shaula "] license = "MIT" @@ -14,7 +14,7 @@ categories = ["api-bindings", "os::windows-apis"] [dependencies] cfg-if = "1.0" -windows-sys = { version = "0.52", features = [ +windows-sys = { version = "0.59", features = [ "Win32_Foundation", "Win32_System_Time", "Win32_System_Registry", diff --git a/src/reg_key.rs b/src/reg_key.rs index d18da25..dff2993 100644 --- a/src/reg_key.rs +++ b/src/reg_key.rs @@ -97,7 +97,7 @@ impl RegKey { options: u32, ) -> io::Result { let c_filename = to_utf16(filename); - let mut new_hkey: HKEY = 0; + let mut new_hkey: HKEY = std::ptr::null_mut(); match unsafe { Registry::RegLoadAppKeyW(c_filename.as_ptr(), &mut new_hkey, perms, options, 0) } { @@ -191,7 +191,7 @@ impl RegKey { perms: Registry::REG_SAM_FLAGS, ) -> io::Result { let c_path = to_utf16(path); - let mut new_hkey: HKEY = 0; + let mut new_hkey: HKEY = std::ptr::null_mut(); match unsafe { Registry::RegOpenKeyExW(self.hkey, c_path.as_ptr(), options, perms, &mut new_hkey) } { @@ -231,7 +231,7 @@ impl RegKey { perms: Registry::REG_SAM_FLAGS, ) -> io::Result { let c_path = to_utf16(path); - let mut new_hkey: HKEY = 0; + let mut new_hkey: HKEY = std::ptr::null_mut(); match unsafe { Registry::RegOpenKeyTransactedW( self.hkey, @@ -292,7 +292,7 @@ impl RegKey { perms: Registry::REG_SAM_FLAGS, ) -> io::Result<(RegKey, RegDisposition)> { let c_path = to_utf16(path); - let mut new_hkey: HKEY = 0; + let mut new_hkey: HKEY = std::ptr::null_mut(); let mut disp_buf: u32 = 0; match unsafe { Registry::RegCreateKeyExW( @@ -346,7 +346,7 @@ impl RegKey { perms: Registry::REG_SAM_FLAGS, ) -> io::Result<(RegKey, RegDisposition)> { let c_path = to_utf16(path); - let mut new_hkey: HKEY = 0; + let mut new_hkey: HKEY = std::ptr::null_mut(); let mut disp_buf: u32 = 0; match unsafe { Registry::RegCreateKeyTransactedW(