diff --git a/Cargo.toml b/Cargo.toml index 11ee4081b..c4507d9f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,15 @@ unix = [ "generic" ] windows = ["generic"] +windows_legacy = [ + "arch", + "nproc", + "sync", + "touch", + "whoami", + + "redox_generic" + ] # Feature "fuchsia" contains the exclusive list of utilities # that can be compiled and run on Fuchsia. Should be built # with --no-default-features when selecting this feature. diff --git a/build.rs b/build.rs index b5b70c019..124189839 100644 --- a/build.rs +++ b/build.rs @@ -16,7 +16,7 @@ pub fn main() { if val == "1" && key.starts_with(feature_prefix) { let krate = key[feature_prefix.len()..].to_lowercase(); match krate.as_ref() { - "default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "windows" + "default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "windows" | "windows_legacy" | "nightly" | "test_unimplemented" => continue, _ => {} } diff --git a/src/cp/cp.rs b/src/cp/cp.rs index eb2205113..6b08a8e24 100644 --- a/src/cp/cp.rs +++ b/src/cp/cp.rs @@ -29,7 +29,7 @@ extern crate kernel32; #[cfg(windows)] use kernel32::GetFileInformationByHandle; #[cfg(windows)] -use kernel32::CreateFile2; +use kernel32::CreateFileW; #[cfg(windows)] extern crate winapi; @@ -731,10 +731,12 @@ fn preserve_hardlinks( #[cfg(windows)] { let stat = mem::uninitialized(); - let handle = CreateFile2( + let handle = CreateFileW( src_path.as_ptr() as *const u16, winapi::um::winnt::GENERIC_READ, winapi::um::winnt::FILE_SHARE_READ, + std::ptr::null_mut(), + 0, 0, std::ptr::null_mut(), );