@@ -294,15 +294,14 @@ pub fn complete_windows_uninstall() -> Result<utils::ExitCode> {
294
294
pub ( crate ) fn wait_for_parent ( ) -> Result < ( ) > {
295
295
use std:: io;
296
296
use std:: mem;
297
- use winapi:: shared:: minwindef:: DWORD ;
298
- use winapi:: um:: handleapi:: { CloseHandle , INVALID_HANDLE_VALUE } ;
299
- use winapi:: um:: processthreadsapi:: { GetCurrentProcessId , OpenProcess } ;
300
- use winapi:: um:: synchapi:: WaitForSingleObject ;
301
- use winapi:: um:: tlhelp32:: {
297
+ use windows_sys:: Win32 :: Foundation :: { CloseHandle , INVALID_HANDLE_VALUE , WAIT_OBJECT_0 } ;
298
+ use windows_sys:: Win32 :: Storage :: FileSystem :: SYNCHRONIZE ;
299
+ use windows_sys:: Win32 :: System :: Diagnostics :: ToolHelp :: {
302
300
CreateToolhelp32Snapshot , Process32First , Process32Next , PROCESSENTRY32 , TH32CS_SNAPPROCESS ,
303
301
} ;
304
- use winapi:: um:: winbase:: { INFINITE , WAIT_OBJECT_0 } ;
305
- use winapi:: um:: winnt:: SYNCHRONIZE ;
302
+ use windows_sys:: Win32 :: System :: Threading :: {
303
+ GetCurrentProcessId , OpenProcess , WaitForSingleObject , INFINITE ,
304
+ } ;
306
305
307
306
unsafe {
308
307
// Take a snapshot of system processes, one of which is ours
@@ -318,7 +317,7 @@ pub(crate) fn wait_for_parent() -> Result<()> {
318
317
} ) ;
319
318
320
319
let mut entry: PROCESSENTRY32 = mem:: zeroed ( ) ;
321
- entry. dwSize = mem:: size_of :: < PROCESSENTRY32 > ( ) as DWORD ;
320
+ entry. dwSize = mem:: size_of :: < PROCESSENTRY32 > ( ) as u32 ;
322
321
323
322
// Iterate over system processes looking for ours
324
323
let success = Process32First ( * snapshot, & mut entry) ;
@@ -343,7 +342,7 @@ pub(crate) fn wait_for_parent() -> Result<()> {
343
342
344
343
// Get a handle to the parent process
345
344
let parent = OpenProcess ( SYNCHRONIZE , 0 , parent_id) ;
346
- if parent. is_null ( ) {
345
+ if parent == 0 {
347
346
// This just means the parent has already exited.
348
347
return Ok ( ( ) ) ;
349
348
}
@@ -371,8 +370,8 @@ pub(crate) fn do_add_to_path() -> Result<()> {
371
370
372
371
fn _apply_new_path ( new_path : Option < Vec < u16 > > ) -> Result < ( ) > {
373
372
use std:: ptr;
374
- use winapi :: shared :: minwindef :: * ;
375
- use winapi :: um :: winuser :: {
373
+ use windows_sys :: Win32 :: Foundation :: * ;
374
+ use windows_sys :: Win32 :: UI :: WindowsAndMessaging :: {
376
375
SendMessageTimeoutA , HWND_BROADCAST , SMTO_ABORTIFHUNG , WM_SETTINGCHANGE ,
377
376
} ;
378
377
@@ -645,12 +644,11 @@ pub(crate) fn delete_rustup_and_cargo_home() -> Result<()> {
645
644
use std:: ptr;
646
645
use std:: thread;
647
646
use std:: time:: Duration ;
648
- use winapi:: shared:: minwindef:: DWORD ;
649
- use winapi:: um:: fileapi:: { CreateFileW , OPEN_EXISTING } ;
650
- use winapi:: um:: handleapi:: { CloseHandle , INVALID_HANDLE_VALUE } ;
651
- use winapi:: um:: minwinbase:: SECURITY_ATTRIBUTES ;
652
- use winapi:: um:: winbase:: FILE_FLAG_DELETE_ON_CLOSE ;
653
- use winapi:: um:: winnt:: { FILE_SHARE_DELETE , FILE_SHARE_READ , GENERIC_READ } ;
647
+ use windows_sys:: Win32 :: Foundation :: { CloseHandle , GENERIC_READ , INVALID_HANDLE_VALUE } ;
648
+ use windows_sys:: Win32 :: Security :: SECURITY_ATTRIBUTES ;
649
+ use windows_sys:: Win32 :: Storage :: FileSystem :: {
650
+ CreateFileW , FILE_FLAG_DELETE_ON_CLOSE , FILE_SHARE_DELETE , FILE_SHARE_READ , OPEN_EXISTING ,
651
+ } ;
654
652
655
653
// CARGO_HOME, hopefully empty except for bin/rustup.exe
656
654
let cargo_home = utils:: cargo_home ( ) ?;
@@ -671,8 +669,8 @@ pub(crate) fn delete_rustup_and_cargo_home() -> Result<()> {
671
669
let gc_exe_win: Vec < _ > = gc_exe. as_os_str ( ) . encode_wide ( ) . chain ( Some ( 0 ) ) . collect ( ) ;
672
670
673
671
// Make the sub-process opened by gc exe inherit its attribute.
674
- let mut sa = SECURITY_ATTRIBUTES {
675
- nLength : mem:: size_of :: < SECURITY_ATTRIBUTES > ( ) as DWORD ,
672
+ let sa = SECURITY_ATTRIBUTES {
673
+ nLength : mem:: size_of :: < SECURITY_ATTRIBUTES > ( ) as u32 ,
676
674
lpSecurityDescriptor : ptr:: null_mut ( ) ,
677
675
bInheritHandle : 1 ,
678
676
} ;
@@ -684,10 +682,10 @@ pub(crate) fn delete_rustup_and_cargo_home() -> Result<()> {
684
682
gc_exe_win. as_ptr ( ) ,
685
683
GENERIC_READ ,
686
684
FILE_SHARE_READ | FILE_SHARE_DELETE ,
687
- & mut sa,
685
+ & sa,
688
686
OPEN_EXISTING ,
689
687
FILE_FLAG_DELETE_ON_CLOSE ,
690
- ptr :: null_mut ( ) ,
688
+ 0 ,
691
689
) ;
692
690
693
691
if gc_handle == INVALID_HANDLE_VALUE {
0 commit comments