@@ -262,16 +262,16 @@ mod ctrlc {
262
262
mod windows {
263
263
use super :: * ;
264
264
265
- use winapi:: shared:: minwindef:: { BOOL , DWORD , FALSE , TRUE } ;
266
- use winapi:: um:: consoleapi:: { SetConsoleCtrlHandler , WriteConsoleA } ;
267
- use winapi:: um:: handleapi:: DuplicateHandle ;
268
- use winapi:: um:: processenv:: GetStdHandle ;
269
- use winapi:: um:: processthreadsapi:: {
265
+ use windows_sys:: Win32 :: Foundation :: {
266
+ DuplicateHandle , BOOL , DUPLICATE_SAME_ACCESS , FALSE , HANDLE , TRUE ,
267
+ } ;
268
+ use windows_sys:: Win32 :: System :: Console :: {
269
+ GetStdHandle , SetConsoleCtrlHandler , WriteConsoleA , CTRL_C_EVENT ,
270
+ STD_OUTPUT_HANDLE ,
271
+ } ;
272
+ use windows_sys:: Win32 :: System :: Threading :: {
270
273
GetCurrentProcess , GetCurrentThread , SuspendThread ,
271
274
} ;
272
- use winapi:: um:: winbase:: STD_OUTPUT_HANDLE ;
273
- use winapi:: um:: wincon:: CTRL_C_EVENT ;
274
- use winapi:: um:: winnt:: { DUPLICATE_SAME_ACCESS , HANDLE } ;
275
275
276
276
pub type ThreadType = HANDLE ;
277
277
@@ -280,7 +280,7 @@ mod ctrlc {
280
280
const ANSI_RESET : & str = "\u{1B} [00m^C" ;
281
281
282
282
pub ( super ) fn thread_self ( ) -> ThreadId {
283
- let mut this_thread: ThreadType = std :: ptr :: null_mut ( ) ;
283
+ let mut this_thread: ThreadType = 0 ;
284
284
285
285
// SAFETY: GetCurrentThread/Process can not fail. The thread handle on a failed
286
286
// DuplicateHandle() call is not used.
@@ -303,7 +303,7 @@ mod ctrlc {
303
303
} )
304
304
}
305
305
306
- extern "system" fn on_ctrlc ( event_type : DWORD ) -> BOOL {
306
+ extern "system" fn on_ctrlc ( event_type : u32 ) -> BOOL {
307
307
if event_type == CTRL_C_EVENT {
308
308
// Observed behavior: When in a Ctrl-C handler (i.e. this), resetting it so the
309
309
// next ^C is not handled by it does not work, this handler has to run to
@@ -325,16 +325,16 @@ mod ctrlc {
325
325
// SAFETY: Only a valid handle is used later.
326
326
let stdout_handle = unsafe { GetStdHandle ( STD_OUTPUT_HANDLE ) } ;
327
327
328
- if stdout_handle != std :: ptr :: null_mut ( ) {
329
- let mut _bytes_written: DWORD = 0 ;
328
+ if stdout_handle != 0 {
329
+ let mut _bytes_written: u32 = 0 ;
330
330
331
331
// Short writes or other errors are ignored.
332
332
// SAFETY: correctness of `lpBuffer` and `nNumberOfCharsToWrite` is ensured by Rust.
333
333
let _ = unsafe {
334
334
WriteConsoleA (
335
335
stdout_handle,
336
336
ANSI_RESET . as_ptr ( ) as * const _ ,
337
- ANSI_RESET . len ( ) as DWORD ,
337
+ ANSI_RESET . len ( ) as u32 ,
338
338
& mut _bytes_written,
339
339
std:: ptr:: null_mut ( ) ,
340
340
)
0 commit comments