Skip to content

Commit 97ff12e

Browse files
authored
Update to windows-sys 0.59. (#379)
* Update to windows-sys 0.59. Allow compilation with either windows-sys 0.52 or 0.59. * Add needed windows-sys features.
1 parent 0f53e08 commit 97ff12e

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ rustix = { version = "0.38.0", features = ["fs"] }
4141
nt_version = "0.1.3"
4242

4343
[target.'cfg(windows)'.dependencies.windows-sys]
44-
version = "0.52.0"
44+
version = ">=0.52, <=0.59"
4545
features = [
4646
"Win32_Storage_FileSystem",
4747
"Win32_Foundation",
48+
"Win32_System_Ioctl",
4849
"Win32_System_SystemServices",
4950
]
5051

cap-directories/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ directories-next = "2.0.0"
2020
rustix = { version = "0.38.0" }
2121

2222
[target.'cfg(windows)'.dependencies.windows-sys]
23-
version = "0.52.0"
23+
version = ">=0.52, <=0.59"
2424
features = [
2525
"Win32_Foundation",
2626
]

cap-fs-ext/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async_std_fs_utf8 = ["cap-async-std/fs_utf8", "camino"]
3232
async_std_arf_strings = ["cap-async-std/arf_strings", "async_std_fs_utf8", "arf-strings"]
3333

3434
[target.'cfg(windows)'.dependencies.windows-sys]
35-
version = "0.52.0"
35+
version = ">=0.52, <=0.59"
3636
features = [
3737
"Win32_Storage_FileSystem",
3838
]

cap-primitives/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ rustix = { version = "0.38.38", features = ["fs", "process", "procfs", "termios"
3131
winx = "0.36.0"
3232

3333
[target.'cfg(windows)'.dependencies.windows-sys]
34-
version = "0.52.0"
34+
version = ">=0.52, <=0.59"
3535
features = [
3636
"Win32_Foundation",
3737
"Win32_Security",

cap-primitives/src/windows/fs/create_file_at_w.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ pub unsafe fn CreateFileAtW(
9595
// sorry that I cannot give more details on these functions".
9696
//
9797
// [unofficial blog posts]: https://mecanik.dev/en/posts/convert-dos-and-nt-paths-using-rtl-functions/
98-
assert!(dir != 0);
98+
assert!(dir != 0 as HANDLE);
9999

100100
// Extended attributes are not implemented yet.
101-
if htemplatefile != 0 {
101+
if htemplatefile != 0 as HANDLE {
102102
SetLastError(ERROR_NOT_SUPPORTED);
103103
return HandleOrInvalid::from_raw_handle(INVALID_HANDLE_VALUE as _);
104104
}

cap-primitives/src/windows/fs/open_unchecked.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn open_at(start: &fs::File, path: &Path, opts: &OpenOptions) -> io::Result<fs::
5858
match component {
5959
Component::Prefix(_) | Component::RootDir => {
6060
rebuilt.push(component);
61-
dir = 0;
61+
dir = 0 as HANDLE;
6262
}
6363
Component::Normal(_) => {
6464
rebuilt.push(component);
@@ -70,7 +70,7 @@ fn open_at(start: &fs::File, path: &Path, opts: &OpenOptions) -> io::Result<fs::
7070
// path by dropping the directory base. It's ok to do
7171
// this because we're not sandboxing at this level of the
7272
// code.
73-
if dir == 0 {
73+
if dir == 0 as HANDLE {
7474
return Err(io::Error::from_raw_os_error(ERROR_ACCESS_DENIED as _));
7575
}
7676
rebuilt = match file_path(start) {
@@ -79,7 +79,7 @@ fn open_at(start: &fs::File, path: &Path, opts: &OpenOptions) -> io::Result<fs::
7979
return Err(io::Error::from_raw_os_error(ERROR_ACCESS_DENIED as _));
8080
}
8181
};
82-
dir = 0;
82+
dir = 0 as HANDLE;
8383
// And then pop the last component of that.
8484
let _ = rebuilt.pop();
8585
}
@@ -93,7 +93,7 @@ fn open_at(start: &fs::File, path: &Path, opts: &OpenOptions) -> io::Result<fs::
9393
// If we ended up re-rooting, use Windows' `CreateFileW` instead of our
9494
// own `CreateFileAtW` so that it does the requisite magic for absolute
9595
// paths.
96-
if dir == 0 {
96+
if dir == 0 as HANDLE {
9797
// We're calling the windows-sys `CreateFileW` which expects a
9898
// NUL-terminated filename, so add a NUL terminator.
9999
wide.push(0);

cap-tempfile/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ rand = "0.8.1"
2424
rustix = { version = "0.38.0", features = ["procfs"] }
2525

2626
[target.'cfg(windows)'.dev-dependencies.windows-sys]
27-
version = "0.52.0"
27+
version = ">=0.52, <=0.59"
2828
features = [
2929
"Win32_Foundation",
3030
]

0 commit comments

Comments
 (0)