@@ -294,15 +294,14 @@ pub fn complete_windows_uninstall() -> Result<utils::ExitCode> {
294294pub ( crate ) fn wait_for_parent ( ) -> Result < ( ) > {
295295 use std:: io;
296296 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 :: {
302300 CreateToolhelp32Snapshot , Process32First , Process32Next , PROCESSENTRY32 , TH32CS_SNAPPROCESS ,
303301 } ;
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+ } ;
306305
307306 unsafe {
308307 // Take a snapshot of system processes, one of which is ours
@@ -318,7 +317,7 @@ pub(crate) fn wait_for_parent() -> Result<()> {
318317 } ) ;
319318
320319 let mut entry: PROCESSENTRY32 = mem:: zeroed ( ) ;
321- entry. dwSize = mem:: size_of :: < PROCESSENTRY32 > ( ) as DWORD ;
320+ entry. dwSize = mem:: size_of :: < PROCESSENTRY32 > ( ) as u32 ;
322321
323322 // Iterate over system processes looking for ours
324323 let success = Process32First ( * snapshot, & mut entry) ;
@@ -343,7 +342,7 @@ pub(crate) fn wait_for_parent() -> Result<()> {
343342
344343 // Get a handle to the parent process
345344 let parent = OpenProcess ( SYNCHRONIZE , 0 , parent_id) ;
346- if parent. is_null ( ) {
345+ if parent == 0 {
347346 // This just means the parent has already exited.
348347 return Ok ( ( ) ) ;
349348 }
@@ -371,8 +370,8 @@ pub(crate) fn do_add_to_path() -> Result<()> {
371370
372371fn _apply_new_path ( new_path : Option < Vec < u16 > > ) -> Result < ( ) > {
373372 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 :: {
376375 SendMessageTimeoutA , HWND_BROADCAST , SMTO_ABORTIFHUNG , WM_SETTINGCHANGE ,
377376 } ;
378377
@@ -645,12 +644,11 @@ pub(crate) fn delete_rustup_and_cargo_home() -> Result<()> {
645644 use std:: ptr;
646645 use std:: thread;
647646 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+ } ;
654652
655653 // CARGO_HOME, hopefully empty except for bin/rustup.exe
656654 let cargo_home = utils:: cargo_home ( ) ?;
@@ -671,8 +669,8 @@ pub(crate) fn delete_rustup_and_cargo_home() -> Result<()> {
671669 let gc_exe_win: Vec < _ > = gc_exe. as_os_str ( ) . encode_wide ( ) . chain ( Some ( 0 ) ) . collect ( ) ;
672670
673671 // 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 ,
676674 lpSecurityDescriptor : ptr:: null_mut ( ) ,
677675 bInheritHandle : 1 ,
678676 } ;
@@ -684,10 +682,10 @@ pub(crate) fn delete_rustup_and_cargo_home() -> Result<()> {
684682 gc_exe_win. as_ptr ( ) ,
685683 GENERIC_READ ,
686684 FILE_SHARE_READ | FILE_SHARE_DELETE ,
687- & mut sa,
685+ & sa,
688686 OPEN_EXISTING ,
689687 FILE_FLAG_DELETE_ON_CLOSE ,
690- ptr :: null_mut ( ) ,
688+ 0 ,
691689 ) ;
692690
693691 if gc_handle == INVALID_HANDLE_VALUE {
0 commit comments