Skip to content
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

Update windows-rs to v0.48.0 #58

Merged
merged 4 commits into from
Jul 15, 2023
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 .github/workflows/windows_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
shell: bash -l {0}
run: echo "LLVM_PROFILE_FILE=winpty_rs-%p-%m.profraw" >> $GITHUB_ENV
- name: Cargo test
shell: bash -l {0}
# shell: bash -l {0}
run: cargo test --features conpty --features winpty -- --test-threads=1
- name: Gather test coverage
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ keywords = ["windows", "pty", "winpty", "conpty", "pseudoterminal"]
[dependencies]
enum-primitive-derive = "0.2.2"
num-traits = "0.2"
bitflags = "1.3"
bitflags = "2.3"

[build-dependencies]
which = "4.1.0"

[dependencies.windows]
version = "0.44.0"
version = "0.48.0"
features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
Expand All @@ -34,7 +34,7 @@ features = [
]

[build-dependencies.windows]
version = "0.44.0"
version = "0.48.0"
features = [
"Win32_Foundation",
"Win32_System_LibraryLoader"
Expand Down
6 changes: 3 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(windows)]
use windows::Win32::System::LibraryLoader::{GetProcAddress, GetModuleHandleW};
#[cfg(windows)]
use windows::core::{PWSTR, PSTR, PCWSTR, PCSTR};
use windows::core::{PWSTR, PSTR, PCWSTR, PCSTR, HSTRING};
use std::i64;
use std::process::Command;
use std::str;
Expand Down Expand Up @@ -144,10 +144,10 @@ fn main() {
println!("Windows build number: {:?}", build_version);

let conpty_enabled;
let kernel32_res = unsafe { GetModuleHandleW("kernel32.dll".into_pcwstr()) };
let kernel32_res = unsafe { GetModuleHandleW(&HSTRING::from("kernel32.dll")) };
let kernel32 = kernel32_res.unwrap();

let conpty = unsafe { GetProcAddress(kernel32, "CreatePseudoConsole".into_pcstr()) };
let conpty = unsafe { GetProcAddress(kernel32, "CreatePseudoConsole".into_pcstr()) };
match conpty {
Some(_) => {
conpty_enabled = "1";
Expand Down
2 changes: 1 addition & 1 deletion src/pty/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl PTYProcess {
// let bytes_ref = bytes_ptr.as_mut();

result =
if WriteFile(self.conin, Some(bytes_buf.as_ptr() as _), required_size.try_into().unwrap(), bytes_ref, None).as_bool() {
if WriteFile(self.conin, Some(&bytes_buf[..]), bytes_ref, None).as_bool() {
S_OK
} else {
Error::from_win32().into()
Expand Down
4 changes: 2 additions & 2 deletions src/pty/conpty/pty_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl PTYImpl for ConPTY {
let conout_pwstr = PCWSTR(conout_vec.as_ptr());

let h_console_res = CreateFileW(
conout_pwstr, FILE_GENERIC_READ | FILE_GENERIC_WRITE,
conout_pwstr, (FILE_GENERIC_READ | FILE_GENERIC_WRITE).0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
None, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, HANDLE(0));

Expand All @@ -88,7 +88,7 @@ impl PTYImpl for ConPTY {

let h_in_res = CreateFileW(
conin_pwstr,
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
(FILE_GENERIC_READ | FILE_GENERIC_WRITE).0,
FILE_SHARE_READ, None,
OPEN_EXISTING, FILE_FLAGS_AND_ATTRIBUTES(0),
HANDLE(0));
Expand Down
4 changes: 2 additions & 2 deletions src/pty/winpty/pty_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl PTYImpl for WinPTY {

let empty_handle = HANDLE(0);
let conin_res = CreateFileW(
PCWSTR(conin_name as *const u16), FILE_GENERIC_WRITE, FILE_SHARE_NONE, None,
PCWSTR(conin_name as *const u16), FILE_GENERIC_WRITE.0, FILE_SHARE_NONE, None,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, empty_handle
);

Expand All @@ -182,7 +182,7 @@ impl PTYImpl for WinPTY {
}

let conout_res = CreateFileW(
PCWSTR(conout_name as *mut u16), FILE_GENERIC_READ, FILE_SHARE_NONE, None,
PCWSTR(conout_name as *mut u16), FILE_GENERIC_READ.0, FILE_SHARE_NONE, None,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, empty_handle
);

Expand Down