Skip to content

Commit

Permalink
Doesn't use stdlib in Windows impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioBenitez committed Aug 10, 2023
1 parent ec344c3 commit 38a9447
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ mod windows_console {
}

fn get_output_handle() -> Result<HANDLE, DWORD> {
let file_name: Vec<u16> = "CONOUT$\0".encode_utf16().collect();
// This is "CONOUT$\0" UTF-16 encoded.
const CONOUT: &[u16] = &[0x43, 0x4F, 0x4E, 0x4F, 0x55, 0x54, 0x24, 0x00];

let raw_handle = unsafe {
CreateFileW(
file_name.as_ptr(),
CONOUT.as_ptr(),
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
core::ptr::null_mut(),
Expand Down

0 comments on commit 38a9447

Please sign in to comment.