Skip to content

Update to winx 0.23.0. #159

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

Merged
merged 1 commit into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ libc = "0.2.81"
# for testing here.
nt_version = "0.1.3"
winapi = "0.3.9"
winx = "0.22.0"
winx = "0.23.0"

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion cap-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ errno = "0.2.7"
errno = "0.2.7"

[target.'cfg(windows)'.dependencies]
winx = "0.22.0"
winx = "0.23.0"
winapi = { version = "0.3.9", features = [
"ioapiset",
"winioctl"
Expand Down
8 changes: 4 additions & 4 deletions cap-primitives/src/windows/fs/dir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::{
},
path::{Path, PathBuf},
};
use winapi::um::winbase::FILE_FLAG_BACKUP_SEMANTICS;
use winapi::um::winnt;
use winx::file::Flags;

/// Rust's `Path` implicitly strips redundant slashes, however they aren't
/// redundant in one case: at the end of a path they indicate that a path is
Expand Down Expand Up @@ -68,7 +68,7 @@ pub(crate) fn dir_options() -> OpenOptions {
OpenOptions::new()
.read(true)
.dir_required(true)
.custom_flags(Flags::FILE_FLAG_BACKUP_SEMANTICS.bits())
.custom_flags(FILE_FLAG_BACKUP_SEMANTICS)
.share_mode(winnt::FILE_SHARE_READ | winnt::FILE_SHARE_WRITE)
.clone()
}
Expand All @@ -83,7 +83,7 @@ pub(crate) fn readdir_options() -> OpenOptions {
pub(crate) fn canonicalize_options() -> OpenOptions {
OpenOptions::new()
.read(true)
.custom_flags(Flags::FILE_FLAG_BACKUP_SEMANTICS.bits())
.custom_flags(FILE_FLAG_BACKUP_SEMANTICS)
.clone()
}

Expand All @@ -100,7 +100,7 @@ pub(crate) unsafe fn open_ambient_dir_impl(path: &Path) -> io::Result<fs::File>
// underneath us, since we use paths to implement many directory operations.
let dir = fs::OpenOptions::new()
.read(true)
.custom_flags(Flags::FILE_FLAG_BACKUP_SEMANTICS.bits())
.custom_flags(FILE_FLAG_BACKUP_SEMANTICS)
.share_mode(winnt::FILE_SHARE_READ | winnt::FILE_SHARE_WRITE)
.open(&path)?;

Expand Down
16 changes: 9 additions & 7 deletions cap-primitives/src/windows/fs/metadata_ext.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(clippy::useless_conversion)]

use std::{fs, io};
use std::{convert::TryInto, fs, io};

#[derive(Debug, Clone)]
pub(crate) struct MetadataExt {
Expand Down Expand Up @@ -38,17 +38,19 @@ impl MetadataExt {

#[cfg(not(windows_by_handle))]
if volume_serial_number.is_none() || number_of_links.is_none() || file_index.is_none() {
let fileinfo = winx::file::get_fileinfo(file)?;
let fileinfo = winapi_util::file::information(file)?;
if volume_serial_number.is_none() {
volume_serial_number = Some(fileinfo.dwVolumeSerialNumber);
let t64: u64 = fileinfo.volume_serial_number();
let t32: u32 = t64.try_into().unwrap();
volume_serial_number = Some(t32);
}
if number_of_links.is_none() {
number_of_links = Some(fileinfo.nNumberOfLinks);
let t64: u64 = fileinfo.number_of_links();
let t32: u32 = t64.try_into().unwrap();
number_of_links = Some(t32);
}
if file_index.is_none() {
file_index = Some(
(u64::from(fileinfo.nFileIndexHigh) << 32) | u64::from(fileinfo.nFileIndexLow),
);
file_index = Some(fileinfo.file_index());
}
}

Expand Down
6 changes: 3 additions & 3 deletions cap-primitives/src/windows/fs/oflags.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::fs::{FollowSymlinks, OpenOptions};
use std::{fs, os::windows::fs::OpenOptionsExt};
use winx::file::Flags;
use winapi::um::winbase::{FILE_FLAG_BACKUP_SEMANTICS, FILE_FLAG_OPEN_REPARSE_POINT};

/// Translate the given `cap_std` into `std` options. Also return a bool
/// indicating that the `trunc` flag was requested but could not be set,
Expand All @@ -18,11 +18,11 @@ pub(in super::super) fn open_options_to_std(opts: &OpenOptions) -> (fs::OpenOpti
manually_trunc = true;
trunc = false;
}
opts.ext.custom_flags | Flags::FILE_FLAG_OPEN_REPARSE_POINT.bits()
opts.ext.custom_flags | FILE_FLAG_OPEN_REPARSE_POINT
}
};
if opts.maybe_dir {
custom_flags |= Flags::FILE_FLAG_BACKUP_SEMANTICS.bits();
custom_flags |= FILE_FLAG_BACKUP_SEMANTICS;
}
let mut std_opts = fs::OpenOptions::new();
std_opts
Expand Down
2 changes: 1 addition & 1 deletion cap-time-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ posish = "0.5.2"

[target.'cfg(windows)'.dependencies]
once_cell = "1.5.2"
winx = "0.22.0"
winx = "0.23.0"

[badges]
maintenance = { status = "actively-developed" }