about summary refs log tree commit diff
path: root/src/libstd/sys/windows/c.rs
diff options
context:
space:
mode:
authorElahn Ientile <github@elahn.com.au>2016-12-10 09:46:47 +1000
committerElahn Ientile <github@elahn.com.au>2016-12-10 09:46:47 +1000
commitf9bca00469f4e6826c79638a5058c838ab4c1925 (patch)
treede621eeec786f494d602bdbbdafcafbf0ae3a8bb /src/libstd/sys/windows/c.rs
parente9aa73d2bf3c94bc4ff32afeb2b20f28c677dafa (diff)
downloadrust-f9bca00469f4e6826c79638a5058c838ab4c1925.tar.gz
rust-f9bca00469f4e6826c79638a5058c838ab4c1925.zip
Ctrl-Z returns from Stdin.read() when reading from the console on
Windows.
Fixes #19914.
Fixes read(), read_to_string(), read_to_end(), etc.
Diffstat (limited to 'src/libstd/sys/windows/c.rs')
-rw-r--r--src/libstd/sys/windows/c.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index 1a563127f7f..6ac3e08f908 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -819,6 +819,16 @@ pub enum EXCEPTION_DISPOSITION {
     ExceptionCollidedUnwind
 }
 
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct CONSOLE_READCONSOLE_CONTROL {
+    pub nLength: ULONG,
+    pub nInitialChars: ULONG,
+    pub dwCtrlWakeupMask: ULONG,
+    pub dwControlKeyState: ULONG,
+}
+pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL;
+
 #[link(name = "ws2_32")]
 #[link(name = "userenv")]
 #[link(name = "shell32")]
@@ -849,12 +859,11 @@ extern "system" {
     pub fn LeaveCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
     pub fn DeleteCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
 
-    // FIXME - pInputControl should be PCONSOLE_READCONSOLE_CONTROL
     pub fn ReadConsoleW(hConsoleInput: HANDLE,
                         lpBuffer: LPVOID,
                         nNumberOfCharsToRead: DWORD,
                         lpNumberOfCharsRead: LPDWORD,
-                        pInputControl: LPVOID) -> BOOL;
+                        pInputControl: PCONSOLE_READCONSOLE_CONTROL) -> BOOL;
 
     pub fn WriteConsoleW(hConsoleOutput: HANDLE,
                          lpBuffer: LPCVOID,