diff options
| author | joboet <jonasboettiger@icloud.com> | 2024-01-11 20:10:25 +0100 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2024-01-11 20:10:25 +0100 |
| commit | 99128b7e45f8b95d962da2e6ea584767f0c85455 (patch) | |
| tree | 20874cb2d8526a427342c32a45bc63a21022499c /library/std/src/sys/windows | |
| parent | 062e7c6a951c1e4f33c0a6f6761755949cde15ec (diff) | |
| download | rust-99128b7e45f8b95d962da2e6ea584767f0c85455.tar.gz rust-99128b7e45f8b95d962da2e6ea584767f0c85455.zip | |
std: begin moving platform support modules into `pal`
Diffstat (limited to 'library/std/src/sys/windows')
41 files changed, 0 insertions, 16225 deletions
diff --git a/library/std/src/sys/windows/alloc.rs b/library/std/src/sys/windows/alloc.rs deleted file mode 100644 index d53ea16005f..00000000000 --- a/library/std/src/sys/windows/alloc.rs +++ /dev/null @@ -1,247 +0,0 @@ -#![deny(unsafe_op_in_unsafe_fn)] - -use crate::alloc::{GlobalAlloc, Layout, System}; -use crate::ffi::c_void; -use crate::ptr; -use crate::sync::atomic::{AtomicPtr, Ordering}; -use crate::sys::c; -use crate::sys::common::alloc::{realloc_fallback, MIN_ALIGN}; - -#[cfg(test)] -mod tests; - -// Heap memory management on Windows is done by using the system Heap API (heapapi.h) -// See https://docs.microsoft.com/windows/win32/api/heapapi/ - -// Flag to indicate that the memory returned by `HeapAlloc` should be zeroed. -const HEAP_ZERO_MEMORY: c::DWORD = 0x00000008; - -#[link(name = "kernel32")] -extern "system" { - // Get a handle to the default heap of the current process, or null if the operation fails. - // - // SAFETY: Successful calls to this function within the same process are assumed to - // always return the same handle, which remains valid for the entire lifetime of the process. - // - // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-getprocessheap - fn GetProcessHeap() -> c::HANDLE; - - // Allocate a block of `dwBytes` bytes of memory from a given heap `hHeap`. - // The allocated memory may be uninitialized, or zeroed if `dwFlags` is - // set to `HEAP_ZERO_MEMORY`. - // - // Returns a pointer to the newly-allocated memory or null if the operation fails. - // The returned pointer will be aligned to at least `MIN_ALIGN`. - // - // SAFETY: - // - `hHeap` must be a non-null handle returned by `GetProcessHeap`. - // - `dwFlags` must be set to either zero or `HEAP_ZERO_MEMORY`. - // - // Note that `dwBytes` is allowed to be zero, contrary to some other allocators. - // - // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapalloc - fn HeapAlloc(hHeap: c::HANDLE, dwFlags: c::DWORD, dwBytes: c::SIZE_T) -> c::LPVOID; - - // Reallocate a block of memory behind a given pointer `lpMem` from a given heap `hHeap`, - // to a block of at least `dwBytes` bytes, either shrinking the block in place, - // or allocating at a new location, copying memory, and freeing the original location. - // - // Returns a pointer to the reallocated memory or null if the operation fails. - // The returned pointer will be aligned to at least `MIN_ALIGN`. - // If the operation fails the given block will never have been freed. - // - // SAFETY: - // - `hHeap` must be a non-null handle returned by `GetProcessHeap`. - // - `dwFlags` must be set to zero. - // - `lpMem` must be a non-null pointer to an allocated block returned by `HeapAlloc` or - // `HeapReAlloc`, that has not already been freed. - // If the block was successfully reallocated at a new location, pointers pointing to - // the freed memory, such as `lpMem`, must not be dereferenced ever again. - // - // Note that `dwBytes` is allowed to be zero, contrary to some other allocators. - // - // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heaprealloc - fn HeapReAlloc( - hHeap: c::HANDLE, - dwFlags: c::DWORD, - lpMem: c::LPVOID, - dwBytes: c::SIZE_T, - ) -> c::LPVOID; - - // Free a block of memory behind a given pointer `lpMem` from a given heap `hHeap`. - // Returns a nonzero value if the operation is successful, and zero if the operation fails. - // - // SAFETY: - // - `hHeap` must be a non-null handle returned by `GetProcessHeap`. - // - `dwFlags` must be set to zero. - // - `lpMem` must be a pointer to an allocated block returned by `HeapAlloc` or `HeapReAlloc`, - // that has not already been freed. - // If the block was successfully freed, pointers pointing to the freed memory, such as `lpMem`, - // must not be dereferenced ever again. - // - // Note that `lpMem` is allowed to be null, which will not cause the operation to fail. - // - // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapfree - fn HeapFree(hHeap: c::HANDLE, dwFlags: c::DWORD, lpMem: c::LPVOID) -> c::BOOL; -} - -// Cached handle to the default heap of the current process. -// Either a non-null handle returned by `GetProcessHeap`, or null when not yet initialized or `GetProcessHeap` failed. -static HEAP: AtomicPtr<c_void> = AtomicPtr::new(ptr::null_mut()); - -// Get a handle to the default heap of the current process, or null if the operation fails. -// If this operation is successful, `HEAP` will be successfully initialized and contain -// a non-null handle returned by `GetProcessHeap`. -#[inline] -fn init_or_get_process_heap() -> c::HANDLE { - let heap = HEAP.load(Ordering::Relaxed); - if heap.is_null() { - // `HEAP` has not yet been successfully initialized - let heap = unsafe { GetProcessHeap() }; - if !heap.is_null() { - // SAFETY: No locking is needed because within the same process, - // successful calls to `GetProcessHeap` will always return the same value, even on different threads. - HEAP.store(heap, Ordering::Release); - - // SAFETY: `HEAP` contains a non-null handle returned by `GetProcessHeap` - heap - } else { - // Could not get the current process heap. - ptr::null_mut() - } - } else { - // SAFETY: `HEAP` contains a non-null handle returned by `GetProcessHeap` - heap - } -} - -// Get a non-null handle to the default heap of the current process. -// SAFETY: `HEAP` must have been successfully initialized. -#[inline] -unsafe fn get_process_heap() -> c::HANDLE { - HEAP.load(Ordering::Acquire) -} - -// Header containing a pointer to the start of an allocated block. -// SAFETY: Size and alignment must be <= `MIN_ALIGN`. -#[repr(C)] -struct Header(*mut u8); - -// Allocate a block of optionally zeroed memory for a given `layout`. -// SAFETY: Returns a pointer satisfying the guarantees of `System` about allocated pointers, -// or null if the operation fails. If this returns non-null `HEAP` will have been successfully -// initialized. -#[inline] -unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 { - let heap = init_or_get_process_heap(); - if heap.is_null() { - // Allocation has failed, could not get the current process heap. - return ptr::null_mut(); - } - - // Allocated memory will be either zeroed or uninitialized. - let flags = if zeroed { HEAP_ZERO_MEMORY } else { 0 }; - - if layout.align() <= MIN_ALIGN { - // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`. - // The returned pointer points to the start of an allocated block. - unsafe { HeapAlloc(heap, flags, layout.size()) as *mut u8 } - } else { - // Allocate extra padding in order to be able to satisfy the alignment. - let total = layout.align() + layout.size(); - - // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`. - let ptr = unsafe { HeapAlloc(heap, flags, total) as *mut u8 }; - if ptr.is_null() { - // Allocation has failed. - return ptr::null_mut(); - } - - // Create a correctly aligned pointer offset from the start of the allocated block, - // and write a header before it. - - let offset = layout.align() - (ptr.addr() & (layout.align() - 1)); - // SAFETY: `MIN_ALIGN` <= `offset` <= `layout.align()` and the size of the allocated - // block is `layout.align() + layout.size()`. `aligned` will thus be a correctly aligned - // pointer inside the allocated block with at least `layout.size()` bytes after it and at - // least `MIN_ALIGN` bytes of padding before it. - let aligned = unsafe { ptr.add(offset) }; - // SAFETY: Because the size and alignment of a header is <= `MIN_ALIGN` and `aligned` - // is aligned to at least `MIN_ALIGN` and has at least `MIN_ALIGN` bytes of padding before - // it, it is safe to write a header directly before it. - unsafe { ptr::write((aligned as *mut Header).sub(1), Header(ptr)) }; - - // SAFETY: The returned pointer does not point to the to the start of an allocated block, - // but there is a header readable directly before it containing the location of the start - // of the block. - aligned - } -} - -// All pointers returned by this allocator have, in addition to the guarantees of `GlobalAlloc`, the -// following properties: -// -// If the pointer was allocated or reallocated with a `layout` specifying an alignment <= `MIN_ALIGN` -// the pointer will be aligned to at least `MIN_ALIGN` and point to the start of the allocated block. -// -// If the pointer was allocated or reallocated with a `layout` specifying an alignment > `MIN_ALIGN` -// the pointer will be aligned to the specified alignment and not point to the start of the allocated block. -// Instead there will be a header readable directly before the returned pointer, containing the actual -// location of the start of the block. -#[stable(feature = "alloc_system_type", since = "1.28.0")] -unsafe impl GlobalAlloc for System { - #[inline] - unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - // SAFETY: Pointers returned by `allocate` satisfy the guarantees of `System` - let zeroed = false; - unsafe { allocate(layout, zeroed) } - } - - #[inline] - unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { - // SAFETY: Pointers returned by `allocate` satisfy the guarantees of `System` - let zeroed = true; - unsafe { allocate(layout, zeroed) } - } - - #[inline] - unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { - let block = { - if layout.align() <= MIN_ALIGN { - ptr - } else { - // The location of the start of the block is stored in the padding before `ptr`. - - // SAFETY: Because of the contract of `System`, `ptr` is guaranteed to be non-null - // and have a header readable directly before it. - unsafe { ptr::read((ptr as *mut Header).sub(1)).0 } - } - }; - - // SAFETY: because `ptr` has been successfully allocated with this allocator, - // `HEAP` must have been successfully initialized. - let heap = unsafe { get_process_heap() }; - - // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, - // `block` is a pointer to the start of an allocated block. - unsafe { HeapFree(heap, 0, block as c::LPVOID) }; - } - - #[inline] - unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { - if layout.align() <= MIN_ALIGN { - // SAFETY: because `ptr` has been successfully allocated with this allocator, - // `HEAP` must have been successfully initialized. - let heap = unsafe { get_process_heap() }; - - // SAFETY: `heap` is a non-null handle returned by `GetProcessHeap`, - // `ptr` is a pointer to the start of an allocated block. - // The returned pointer points to the start of an allocated block. - unsafe { HeapReAlloc(heap, 0, ptr as c::LPVOID, new_size) as *mut u8 } - } else { - // SAFETY: `realloc_fallback` is implemented using `dealloc` and `alloc`, which will - // correctly handle `ptr` and return a pointer satisfying the guarantees of `System` - unsafe { realloc_fallback(self, ptr, layout, new_size) } - } - } -} diff --git a/library/std/src/sys/windows/alloc/tests.rs b/library/std/src/sys/windows/alloc/tests.rs deleted file mode 100644 index 674a3e1d92d..00000000000 --- a/library/std/src/sys/windows/alloc/tests.rs +++ /dev/null @@ -1,9 +0,0 @@ -use super::{Header, MIN_ALIGN}; -use crate::mem; - -#[test] -fn alloc_header() { - // Header must fit in the padding before an aligned pointer - assert!(mem::size_of::<Header>() <= MIN_ALIGN); - assert!(mem::align_of::<Header>() <= MIN_ALIGN); -} diff --git a/library/std/src/sys/windows/api.rs b/library/std/src/sys/windows/api.rs deleted file mode 100644 index a7ea59e85f7..00000000000 --- a/library/std/src/sys/windows/api.rs +++ /dev/null @@ -1,157 +0,0 @@ -//! # Safe(r) wrappers around Windows API functions. -//! -//! This module contains fairly thin wrappers around Windows API functions, -//! aimed at centralising safety instead of having unsafe blocks spread -//! throughout higher level code. This makes it much easier to audit FFI safety. -//! -//! Not all functions can be made completely safe without more context but in -//! such cases we should still endeavour to reduce the caller's burden of safety -//! as much as possible. -//! -//! ## Guidelines for wrappers -//! -//! Items here should be named similarly to their raw Windows API name, except -//! that they follow Rust's case conventions. E.g. function names are -//! lower_snake_case. The idea here is that it should be easy for a Windows -//! C/C++ programmer to identify the underlying function that's being wrapped -//! while not looking too out of place in Rust code. -//! -//! Every use of an `unsafe` block must have a related SAFETY comment, even if -//! it's trivially safe (for example, see `get_last_error`). Public unsafe -//! functions must document what the caller has to do to call them safely. -//! -//! Avoid unchecked `as` casts. For integers, either assert that the integer -//! is in range or use `try_into` instead. For pointers, prefer to use -//! `ptr.cast::<Type>()` when possible. -//! -//! This module must only depend on core and not on std types as the eventual -//! hope is to have std depend on sys and not the other way around. -//! However, some amount of glue code may currently be necessary so such code -//! should go in sys/windows/mod.rs rather than here. See `IoResult` as an example. - -use core::ffi::c_void; -use core::ptr::addr_of; - -use super::c; - -/// Helper method for getting the size of `T` as a u32. -/// Errors at compile time if the size would overflow. -/// -/// While a type larger than u32::MAX is unlikely, it is possible if only because of a bug. -/// However, one key motivation for this function is to avoid the temptation to -/// use frequent `as` casts. This is risky because they are too powerful. -/// For example, the following will compile today: -/// -/// `std::mem::size_of::<u64> as u32` -/// -/// Note that `size_of` is never actually called, instead a function pointer is -/// converted to a `u32`. Clippy would warn about this but, alas, it's not run -/// on the standard library. -const fn win32_size_of<T: Sized>() -> u32 { - // Const assert that the size does not exceed u32::MAX. - // Uses a trait to workaround restriction on using generic types in inner items. - trait Win32SizeOf: Sized { - const WIN32_SIZE_OF: u32 = { - let size = core::mem::size_of::<Self>(); - assert!(size <= u32::MAX as usize); - size as u32 - }; - } - impl<T: Sized> Win32SizeOf for T {} - - T::WIN32_SIZE_OF -} - -/// The `SetFileInformationByHandle` function takes a generic parameter by -/// making the user specify the type (class), a pointer to the data and its -/// size. This trait allows attaching that information to a Rust type so that -/// [`set_file_information_by_handle`] can be called safely. -/// -/// This trait is designed so that it can support variable sized types. -/// However, currently Rust's std only uses fixed sized structures. -/// -/// # Safety -/// -/// * `as_ptr` must return a pointer to memory that is readable up to `size` bytes. -/// * `CLASS` must accurately reflect the type pointed to by `as_ptr`. E.g. -/// the `FILE_BASIC_INFO` structure has the class `FileBasicInfo`. -pub unsafe trait SetFileInformation { - /// The type of information to set. - const CLASS: i32; - /// A pointer to the file information to set. - fn as_ptr(&self) -> *const c_void; - /// The size of the type pointed to by `as_ptr`. - fn size(&self) -> u32; -} -/// Helper trait for implementing `SetFileInformation` for statically sized types. -unsafe trait SizedSetFileInformation: Sized { - const CLASS: i32; -} -unsafe impl<T: SizedSetFileInformation> SetFileInformation for T { - const CLASS: i32 = T::CLASS; - fn as_ptr(&self) -> *const c_void { - addr_of!(*self).cast::<c_void>() - } - fn size(&self) -> u32 { - win32_size_of::<Self>() - } -} - -// SAFETY: FILE_BASIC_INFO, FILE_END_OF_FILE_INFO, FILE_ALLOCATION_INFO, -// FILE_DISPOSITION_INFO, FILE_DISPOSITION_INFO_EX and FILE_IO_PRIORITY_HINT_INFO -// are all plain `repr(C)` structs that only contain primitive types. -// The given information classes correctly match with the struct. -unsafe impl SizedSetFileInformation for c::FILE_BASIC_INFO { - const CLASS: i32 = c::FileBasicInfo; -} -unsafe impl SizedSetFileInformation for c::FILE_END_OF_FILE_INFO { - const CLASS: i32 = c::FileEndOfFileInfo; -} -unsafe impl SizedSetFileInformation for c::FILE_ALLOCATION_INFO { - const CLASS: i32 = c::FileAllocationInfo; -} -unsafe impl SizedSetFileInformation for c::FILE_DISPOSITION_INFO { - const CLASS: i32 = c::FileDispositionInfo; -} -unsafe impl SizedSetFileInformation for c::FILE_DISPOSITION_INFO_EX { - const CLASS: i32 = c::FileDispositionInfoEx; -} -unsafe impl SizedSetFileInformation for c::FILE_IO_PRIORITY_HINT_INFO { - const CLASS: i32 = c::FileIoPriorityHintInfo; -} - -#[inline] -pub fn set_file_information_by_handle<T: SetFileInformation>( - handle: c::HANDLE, - info: &T, -) -> Result<(), WinError> { - unsafe fn set_info( - handle: c::HANDLE, - class: i32, - info: *const c_void, - size: u32, - ) -> Result<(), WinError> { - let result = c::SetFileInformationByHandle(handle, class, info, size); - (result != 0).then_some(()).ok_or_else(get_last_error) - } - // SAFETY: The `SetFileInformation` trait ensures that this is safe. - unsafe { set_info(handle, T::CLASS, info.as_ptr(), info.size()) } -} - -/// Gets the error from the last function. -/// This must be called immediately after the function that sets the error to -/// avoid the risk of another function overwriting it. -pub fn get_last_error() -> WinError { - // SAFETY: This just returns a thread-local u32 and has no other effects. - unsafe { WinError { code: c::GetLastError() } } -} - -/// An error code as returned by [`get_last_error`]. -/// -/// This is usually a 16-bit Win32 error code but may be a 32-bit HRESULT or NTSTATUS. -/// Check the documentation of the Windows API function being called for expected errors. -#[derive(Clone, Copy, PartialEq, Eq)] -#[repr(transparent)] -pub struct WinError { - pub code: u32, -} diff --git a/library/std/src/sys/windows/args.rs b/library/std/src/sys/windows/args.rs deleted file mode 100644 index ee7dba6e5b3..00000000000 --- a/library/std/src/sys/windows/args.rs +++ /dev/null @@ -1,379 +0,0 @@ -//! The Windows command line is just a string -//! <https://docs.microsoft.com/en-us/archive/blogs/larryosterman/the-windows-command-line-is-just-a-string> -//! -//! This module implements the parsing necessary to turn that string into a list of arguments. - -#[cfg(test)] -mod tests; - -use crate::ffi::OsString; -use crate::fmt; -use crate::io; -use crate::num::NonZeroU16; -use crate::os::windows::prelude::*; -use crate::path::{Path, PathBuf}; -use crate::sys::path::get_long_path; -use crate::sys::process::ensure_no_nuls; -use crate::sys::windows::os::current_exe; -use crate::sys::{c, to_u16s}; -use crate::sys_common::wstr::WStrUnits; -use crate::vec; - -use crate::iter; - -/// This is the const equivalent to `NonZeroU16::new(n).unwrap()` -/// -/// FIXME: This can be removed once `Option::unwrap` is stably const. -/// See the `const_option` feature (#67441). -const fn non_zero_u16(n: u16) -> NonZeroU16 { - match NonZeroU16::new(n) { - Some(n) => n, - None => panic!("called `unwrap` on a `None` value"), - } -} - -pub fn args() -> Args { - // SAFETY: `GetCommandLineW` returns a pointer to a null terminated UTF-16 - // string so it's safe for `WStrUnits` to use. - unsafe { - let lp_cmd_line = c::GetCommandLineW(); - let parsed_args_list = parse_lp_cmd_line(WStrUnits::new(lp_cmd_line), || { - current_exe().map(PathBuf::into_os_string).unwrap_or_else(|_| OsString::new()) - }); - - Args { parsed_args_list: parsed_args_list.into_iter() } - } -} - -/// Implements the Windows command-line argument parsing algorithm. -/// -/// Microsoft's documentation for the Windows CLI argument format can be found at -/// <https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-160#parsing-c-command-line-arguments> -/// -/// A more in-depth explanation is here: -/// <https://daviddeley.com/autohotkey/parameters/parameters.htm#WIN> -/// -/// Windows includes a function to do command line parsing in shell32.dll. -/// However, this is not used for two reasons: -/// -/// 1. Linking with that DLL causes the process to be registered as a GUI application. -/// GUI applications add a bunch of overhead, even if no windows are drawn. See -/// <https://randomascii.wordpress.com/2018/12/03/a-not-called-function-can-cause-a-5x-slowdown/>. -/// -/// 2. It does not follow the modern C/C++ argv rules outlined in the first two links above. -/// -/// This function was tested for equivalence to the C/C++ parsing rules using an -/// extensive test suite available at -/// <https://github.com/ChrisDenton/winarg/tree/std>. -fn parse_lp_cmd_line<'a, F: Fn() -> OsString>( - lp_cmd_line: Option<WStrUnits<'a>>, - exe_name: F, -) -> Vec<OsString> { - const BACKSLASH: NonZeroU16 = non_zero_u16(b'\\' as u16); - const QUOTE: NonZeroU16 = non_zero_u16(b'"' as u16); - const TAB: NonZeroU16 = non_zero_u16(b'\t' as u16); - const SPACE: NonZeroU16 = non_zero_u16(b' ' as u16); - - let mut ret_val = Vec::new(); - // If the cmd line pointer is null or it points to an empty string then - // return the name of the executable as argv[0]. - if lp_cmd_line.as_ref().and_then(|cmd| cmd.peek()).is_none() { - ret_val.push(exe_name()); - return ret_val; - } - let mut code_units = lp_cmd_line.unwrap(); - - // The executable name at the beginning is special. - let mut in_quotes = false; - let mut cur = Vec::new(); - for w in &mut code_units { - match w { - // A quote mark always toggles `in_quotes` no matter what because - // there are no escape characters when parsing the executable name. - QUOTE => in_quotes = !in_quotes, - // If not `in_quotes` then whitespace ends argv[0]. - SPACE | TAB if !in_quotes => break, - // In all other cases the code unit is taken literally. - _ => cur.push(w.get()), - } - } - // Skip whitespace. - code_units.advance_while(|w| w == SPACE || w == TAB); - ret_val.push(OsString::from_wide(&cur)); - - // Parse the arguments according to these rules: - // * All code units are taken literally except space, tab, quote and backslash. - // * When not `in_quotes`, space and tab separate arguments. Consecutive spaces and tabs are - // treated as a single separator. - // * A space or tab `in_quotes` is taken literally. - // * A quote toggles `in_quotes` mode unless it's escaped. An escaped quote is taken literally. - // * A quote can be escaped if preceded by an odd number of backslashes. - // * If any number of backslashes is immediately followed by a quote then the number of - // backslashes is halved (rounding down). - // * Backslashes not followed by a quote are all taken literally. - // * If `in_quotes` then a quote can also be escaped using another quote - // (i.e. two consecutive quotes become one literal quote). - let mut cur = Vec::new(); - let mut in_quotes = false; - while let Some(w) = code_units.next() { - match w { - // If not `in_quotes`, a space or tab ends the argument. - SPACE | TAB if !in_quotes => { - ret_val.push(OsString::from_wide(&cur[..])); - cur.truncate(0); - - // Skip whitespace. - code_units.advance_while(|w| w == SPACE || w == TAB); - } - // Backslashes can escape quotes or backslashes but only if consecutive backslashes are followed by a quote. - BACKSLASH => { - let backslash_count = code_units.advance_while(|w| w == BACKSLASH) + 1; - if code_units.peek() == Some(QUOTE) { - cur.extend(iter::repeat(BACKSLASH.get()).take(backslash_count / 2)); - // The quote is escaped if there are an odd number of backslashes. - if backslash_count % 2 == 1 { - code_units.next(); - cur.push(QUOTE.get()); - } - } else { - // If there is no quote on the end then there is no escaping. - cur.extend(iter::repeat(BACKSLASH.get()).take(backslash_count)); - } - } - // If `in_quotes` and not backslash escaped (see above) then a quote either - // unsets `in_quote` or is escaped by another quote. - QUOTE if in_quotes => match code_units.peek() { - // Two consecutive quotes when `in_quotes` produces one literal quote. - Some(QUOTE) => { - cur.push(QUOTE.get()); - code_units.next(); - } - // Otherwise set `in_quotes`. - Some(_) => in_quotes = false, - // The end of the command line. - // Push `cur` even if empty, which we do by breaking while `in_quotes` is still set. - None => break, - }, - // If not `in_quotes` and not BACKSLASH escaped (see above) then a quote sets `in_quote`. - QUOTE => in_quotes = true, - // Everything else is always taken literally. - _ => cur.push(w.get()), - } - } - // Push the final argument, if any. - if !cur.is_empty() || in_quotes { - ret_val.push(OsString::from_wide(&cur[..])); - } - ret_val -} - -pub struct Args { - parsed_args_list: vec::IntoIter<OsString>, -} - -impl fmt::Debug for Args { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.parsed_args_list.as_slice().fmt(f) - } -} - -impl Iterator for Args { - type Item = OsString; - fn next(&mut self) -> Option<OsString> { - self.parsed_args_list.next() - } - fn size_hint(&self) -> (usize, Option<usize>) { - self.parsed_args_list.size_hint() - } -} - -impl DoubleEndedIterator for Args { - fn next_back(&mut self) -> Option<OsString> { - self.parsed_args_list.next_back() - } -} - -impl ExactSizeIterator for Args { - fn len(&self) -> usize { - self.parsed_args_list.len() - } -} - -#[derive(Debug)] -pub(crate) enum Arg { - /// Add quotes (if needed) - Regular(OsString), - /// Append raw string without quoting - Raw(OsString), -} - -enum Quote { - // Every arg is quoted - Always, - // Whitespace and empty args are quoted - Auto, - // Arg appended without any changes (#29494) - Never, -} - -pub(crate) fn append_arg(cmd: &mut Vec<u16>, arg: &Arg, force_quotes: bool) -> io::Result<()> { - let (arg, quote) = match arg { - Arg::Regular(arg) => (arg, if force_quotes { Quote::Always } else { Quote::Auto }), - Arg::Raw(arg) => (arg, Quote::Never), - }; - - // If an argument has 0 characters then we need to quote it to ensure - // that it actually gets passed through on the command line or otherwise - // it will be dropped entirely when parsed on the other end. - ensure_no_nuls(arg)?; - let arg_bytes = arg.as_encoded_bytes(); - let (quote, escape) = match quote { - Quote::Always => (true, true), - Quote::Auto => { - (arg_bytes.iter().any(|c| *c == b' ' || *c == b'\t') || arg_bytes.is_empty(), true) - } - Quote::Never => (false, false), - }; - if quote { - cmd.push('"' as u16); - } - - let mut backslashes: usize = 0; - for x in arg.encode_wide() { - if escape { - if x == '\\' as u16 { - backslashes += 1; - } else { - if x == '"' as u16 { - // Add n+1 backslashes to total 2n+1 before internal '"'. - cmd.extend((0..=backslashes).map(|_| '\\' as u16)); - } - backslashes = 0; - } - } - cmd.push(x); - } - - if quote { - // Add n backslashes to total 2n before ending '"'. - cmd.extend((0..backslashes).map(|_| '\\' as u16)); - cmd.push('"' as u16); - } - Ok(()) -} - -pub(crate) fn make_bat_command_line( - script: &[u16], - args: &[Arg], - force_quotes: bool, -) -> io::Result<Vec<u16>> { - // Set the start of the command line to `cmd.exe /c "` - // It is necessary to surround the command in an extra pair of quotes, - // hence the trailing quote here. It will be closed after all arguments - // have been added. - let mut cmd: Vec<u16> = "cmd.exe /d /c \"".encode_utf16().collect(); - - // Push the script name surrounded by its quote pair. - cmd.push(b'"' as u16); - // Windows file names cannot contain a `"` character or end with `\\`. - // If the script name does then return an error. - if script.contains(&(b'"' as u16)) || script.last() == Some(&(b'\\' as u16)) { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "Windows file names may not contain `\"` or end with `\\`" - )); - } - cmd.extend_from_slice(script.strip_suffix(&[0]).unwrap_or(script)); - cmd.push(b'"' as u16); - - // Append the arguments. - // FIXME: This needs tests to ensure that the arguments are properly - // reconstructed by the batch script by default. - for arg in args { - cmd.push(' ' as u16); - // Make sure to always quote special command prompt characters, including: - // * Characters `cmd /?` says require quotes. - // * `%` for environment variables, as in `%TMP%`. - // * `|<>` pipe/redirect characters. - const SPECIAL: &[u8] = b"\t &()[]{}^=;!'+,`~%|<>"; - let force_quotes = match arg { - Arg::Regular(arg) if !force_quotes => { - arg.as_encoded_bytes().iter().any(|c| SPECIAL.contains(c)) - } - _ => force_quotes, - }; - append_arg(&mut cmd, arg, force_quotes)?; - } - - // Close the quote we left opened earlier. - cmd.push(b'"' as u16); - - Ok(cmd) -} - -/// Takes a path and tries to return a non-verbatim path. -/// -/// This is necessary because cmd.exe does not support verbatim paths. -pub(crate) fn to_user_path(path: &Path) -> io::Result<Vec<u16>> { - from_wide_to_user_path(to_u16s(path)?) -} -pub(crate) fn from_wide_to_user_path(mut path: Vec<u16>) -> io::Result<Vec<u16>> { - use crate::ptr; - use crate::sys::windows::fill_utf16_buf; - - // UTF-16 encoded code points, used in parsing and building UTF-16 paths. - // All of these are in the ASCII range so they can be cast directly to `u16`. - const SEP: u16 = b'\\' as _; - const QUERY: u16 = b'?' as _; - const COLON: u16 = b':' as _; - const U: u16 = b'U' as _; - const N: u16 = b'N' as _; - const C: u16 = b'C' as _; - - // Early return if the path is too long to remove the verbatim prefix. - const LEGACY_MAX_PATH: usize = 260; - if path.len() > LEGACY_MAX_PATH { - return Ok(path); - } - - match &path[..] { - // `\\?\C:\...` => `C:\...` - [SEP, SEP, QUERY, SEP, _, COLON, SEP, ..] => unsafe { - let lpfilename = path[4..].as_ptr(); - fill_utf16_buf( - |buffer, size| c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()), - |full_path: &[u16]| { - if full_path == &path[4..path.len() - 1] { - let mut path: Vec<u16> = full_path.into(); - path.push(0); - path - } else { - path - } - }, - ) - }, - // `\\?\UNC\...` => `\\...` - [SEP, SEP, QUERY, SEP, U, N, C, SEP, ..] => unsafe { - // Change the `C` in `UNC\` to `\` so we can get a slice that starts with `\\`. - path[6] = b'\\' as u16; - let lpfilename = path[6..].as_ptr(); - fill_utf16_buf( - |buffer, size| c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()), - |full_path: &[u16]| { - if full_path == &path[6..path.len() - 1] { - let mut path: Vec<u16> = full_path.into(); - path.push(0); - path - } else { - // Restore the 'C' in "UNC". - path[6] = b'C' as u16; - path - } - }, - ) - }, - // For everything else, leave the path unchanged. - _ => get_long_path(path, false), - } -} diff --git a/library/std/src/sys/windows/args/tests.rs b/library/std/src/sys/windows/args/tests.rs deleted file mode 100644 index 82c32d08c5e..00000000000 --- a/library/std/src/sys/windows/args/tests.rs +++ /dev/null @@ -1,91 +0,0 @@ -use crate::ffi::OsString; -use crate::sys::windows::args::*; - -fn chk(string: &str, parts: &[&str]) { - let mut wide: Vec<u16> = OsString::from(string).encode_wide().collect(); - wide.push(0); - let parsed = - unsafe { parse_lp_cmd_line(WStrUnits::new(wide.as_ptr()), || OsString::from("TEST.EXE")) }; - let expected: Vec<OsString> = parts.iter().map(|k| OsString::from(k)).collect(); - assert_eq!(parsed.as_slice(), expected.as_slice(), "{:?}", string); -} - -#[test] -fn empty() { - chk("", &["TEST.EXE"]); - chk("\0", &["TEST.EXE"]); -} - -#[test] -fn single_words() { - chk("EXE one_word", &["EXE", "one_word"]); - chk("EXE a", &["EXE", "a"]); - chk("EXE 😅", &["EXE", "😅"]); - chk("EXE 😅🤦", &["EXE", "😅🤦"]); -} - -#[test] -fn official_examples() { - chk(r#"EXE "abc" d e"#, &["EXE", "abc", "d", "e"]); - chk(r#"EXE a\\\b d"e f"g h"#, &["EXE", r"a\\\b", "de fg", "h"]); - chk(r#"EXE a\\\"b c d"#, &["EXE", r#"a\"b"#, "c", "d"]); - chk(r#"EXE a\\\\"b c" d e"#, &["EXE", r"a\\b c", "d", "e"]); -} - -#[test] -fn whitespace_behavior() { - chk(" test", &["", "test"]); - chk(" test", &["", "test"]); - chk(" test test2", &["", "test", "test2"]); - chk(" test test2", &["", "test", "test2"]); - chk("test test2 ", &["test", "test2"]); - chk("test test2 ", &["test", "test2"]); - chk("test ", &["test"]); -} - -#[test] -fn genius_quotes() { - chk(r#"EXE "" """#, &["EXE", "", ""]); - chk(r#"EXE "" """"#, &["EXE", "", r#"""#]); - chk( - r#"EXE "this is """all""" in the same argument""#, - &["EXE", r#"this is "all" in the same argument"#], - ); - chk(r#"EXE "a"""#, &["EXE", r#"a""#]); - chk(r#"EXE "a"" a"#, &["EXE", r#"a" a"#]); - // quotes cannot be escaped in command names - chk(r#""EXE" check"#, &["EXE", "check"]); - chk(r#""EXE check""#, &["EXE check"]); - chk(r#""EXE """for""" check"#, &["EXE for check"]); - chk(r#""EXE \"for\" check"#, &[r"EXE \for\ check"]); - chk(r#""EXE \" for \" check"#, &[r"EXE \", "for", r#"""#, "check"]); - chk(r#"E"X"E test"#, &["EXE", "test"]); - chk(r#"EX""E test"#, &["EXE", "test"]); -} - -// from https://daviddeley.com/autohotkey/parameters/parameters.htm#WINCRULESEX -#[test] -fn post_2008() { - chk("EXE CallMeIshmael", &["EXE", "CallMeIshmael"]); - chk(r#"EXE "Call Me Ishmael""#, &["EXE", "Call Me Ishmael"]); - chk(r#"EXE Cal"l Me I"shmael"#, &["EXE", "Call Me Ishmael"]); - chk(r#"EXE CallMe\"Ishmael"#, &["EXE", r#"CallMe"Ishmael"#]); - chk(r#"EXE "CallMe\"Ishmael""#, &["EXE", r#"CallMe"Ishmael"#]); - chk(r#"EXE "Call Me Ishmael\\""#, &["EXE", r"Call Me Ishmael\"]); - chk(r#"EXE "CallMe\\\"Ishmael""#, &["EXE", r#"CallMe\"Ishmael"#]); - chk(r#"EXE a\\\b"#, &["EXE", r"a\\\b"]); - chk(r#"EXE "a\\\b""#, &["EXE", r"a\\\b"]); - chk(r#"EXE "\"Call Me Ishmael\"""#, &["EXE", r#""Call Me Ishmael""#]); - chk(r#"EXE "C:\TEST A\\""#, &["EXE", r"C:\TEST A\"]); - chk(r#"EXE "\"C:\TEST A\\\"""#, &["EXE", r#""C:\TEST A\""#]); - chk(r#"EXE "a b c" d e"#, &["EXE", "a b c", "d", "e"]); - chk(r#"EXE "ab\"c" "\\" d"#, &["EXE", r#"ab"c"#, r"\", "d"]); - chk(r#"EXE a\\\b d"e f"g h"#, &["EXE", r"a\\\b", "de fg", "h"]); - chk(r#"EXE a\\\"b c d"#, &["EXE", r#"a\"b"#, "c", "d"]); - chk(r#"EXE a\\\\"b c" d e"#, &["EXE", r"a\\b c", "d", "e"]); - // Double Double Quotes - chk(r#"EXE "a b c"""#, &["EXE", r#"a b c""#]); - chk(r#"EXE """CallMeIshmael""" b c"#, &["EXE", r#""CallMeIshmael""#, "b", "c"]); - chk(r#"EXE """Call Me Ishmael""""#, &["EXE", r#""Call Me Ishmael""#]); - chk(r#"EXE """"Call Me Ishmael"" b c"#, &["EXE", r#""Call"#, "Me", "Ishmael", "b", "c"]); -} diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs deleted file mode 100644 index d55d9bace81..00000000000 --- a/library/std/src/sys/windows/c.rs +++ /dev/null @@ -1,480 +0,0 @@ -//! C definitions used by libnative that don't belong in liblibc - -#![allow(nonstandard_style)] -#![cfg_attr(test, allow(dead_code))] -#![unstable(issue = "none", feature = "windows_c")] -#![allow(clippy::style)] - -use crate::ffi::CStr; -use crate::mem; -pub use crate::os::raw::c_int; -use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void}; -use crate::os::windows::io::{AsRawHandle, BorrowedHandle}; -use crate::ptr; -use core::ffi::NonZero_c_ulong; - -mod windows_sys; -pub use windows_sys::*; - -pub type DWORD = c_ulong; -pub type NonZeroDWORD = NonZero_c_ulong; -pub type LARGE_INTEGER = c_longlong; -#[cfg_attr(target_vendor = "uwp", allow(unused))] -pub type LONG = c_long; -pub type UINT = c_uint; -pub type WCHAR = u16; -pub type USHORT = c_ushort; -pub type SIZE_T = usize; -pub type WORD = u16; -pub type CHAR = c_char; -pub type ULONG = c_ulong; -pub type ACCESS_MASK = DWORD; - -pub type LPCVOID = *const c_void; -pub type LPHANDLE = *mut HANDLE; -pub type LPOVERLAPPED = *mut OVERLAPPED; -pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; -pub type LPVOID = *mut c_void; -pub type LPWCH = *mut WCHAR; -pub type LPWSTR = *mut WCHAR; - -pub type PLARGE_INTEGER = *mut c_longlong; -pub type PSRWLOCK = *mut SRWLOCK; - -pub type socklen_t = c_int; -pub type ADDRESS_FAMILY = USHORT; -pub use FD_SET as fd_set; -pub use LINGER as linger; -pub use TIMEVAL as timeval; - -pub const INVALID_HANDLE_VALUE: HANDLE = ::core::ptr::invalid_mut(-1i32 as _); - -// https://learn.microsoft.com/en-us/cpp/c-runtime-library/exit-success-exit-failure?view=msvc-170 -pub const EXIT_SUCCESS: u32 = 0; -pub const EXIT_FAILURE: u32 = 1; - -pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() }; -pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() }; -pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() }; - -// Some windows_sys types have different signs than the types we use. -pub const OBJ_DONT_REPARSE: u32 = windows_sys::OBJ_DONT_REPARSE as u32; -pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: u32 = - windows_sys::FRS_ERR_SYSVOL_POPULATE_TIMEOUT as u32; -pub const AF_INET: c_int = windows_sys::AF_INET as c_int; -pub const AF_INET6: c_int = windows_sys::AF_INET6 as c_int; - -#[repr(C)] -pub struct ip_mreq { - pub imr_multiaddr: in_addr, - pub imr_interface: in_addr, -} - -#[repr(C)] -pub struct ipv6_mreq { - pub ipv6mr_multiaddr: in6_addr, - pub ipv6mr_interface: c_uint, -} - -// Equivalent to the `NT_SUCCESS` C preprocessor macro. -// See: https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values -pub fn nt_success(status: NTSTATUS) -> bool { - status >= 0 -} - -impl UNICODE_STRING { - pub fn from_ref(slice: &[u16]) -> Self { - let len = mem::size_of_val(slice); - Self { Length: len as _, MaximumLength: len as _, Buffer: slice.as_ptr() as _ } - } -} - -impl Default for OBJECT_ATTRIBUTES { - fn default() -> Self { - Self { - Length: mem::size_of::<Self>() as _, - RootDirectory: ptr::null_mut(), - ObjectName: ptr::null_mut(), - Attributes: 0, - SecurityDescriptor: ptr::null_mut(), - SecurityQualityOfService: ptr::null_mut(), - } - } -} - -impl IO_STATUS_BLOCK { - pub const PENDING: Self = - IO_STATUS_BLOCK { Anonymous: IO_STATUS_BLOCK_0 { Status: STATUS_PENDING }, Information: 0 }; - pub fn status(&self) -> NTSTATUS { - // SAFETY: If `self.Anonymous.Status` was set then this is obviously safe. - // If `self.Anonymous.Pointer` was set then this is the equivalent to converting - // the pointer to an integer, which is also safe. - // Currently the only safe way to construct `IO_STATUS_BLOCK` outside of - // this module is to call the `default` method, which sets the `Status`. - unsafe { self.Anonymous.Status } - } -} - -/// NB: Use carefully! In general using this as a reference is likely to get the -/// provenance wrong for the `rest` field! -#[repr(C)] -pub struct REPARSE_DATA_BUFFER { - pub ReparseTag: c_uint, - pub ReparseDataLength: c_ushort, - pub Reserved: c_ushort, - pub rest: (), -} - -/// NB: Use carefully! In general using this as a reference is likely to get the -/// provenance wrong for the `PathBuffer` field! -#[repr(C)] -pub struct SYMBOLIC_LINK_REPARSE_BUFFER { - pub SubstituteNameOffset: c_ushort, - pub SubstituteNameLength: c_ushort, - pub PrintNameOffset: c_ushort, - pub PrintNameLength: c_ushort, - pub Flags: c_ulong, - pub PathBuffer: WCHAR, -} - -#[repr(C)] -pub struct MOUNT_POINT_REPARSE_BUFFER { - pub SubstituteNameOffset: c_ushort, - pub SubstituteNameLength: c_ushort, - pub PrintNameOffset: c_ushort, - pub PrintNameLength: c_ushort, - pub PathBuffer: WCHAR, -} -#[repr(C)] -pub struct REPARSE_MOUNTPOINT_DATA_BUFFER { - pub ReparseTag: DWORD, - pub ReparseDataLength: DWORD, - pub Reserved: WORD, - pub ReparseTargetLength: WORD, - pub ReparseTargetMaximumLength: WORD, - pub Reserved1: WORD, - pub ReparseTarget: WCHAR, -} - -#[repr(C)] -pub struct SOCKADDR_STORAGE_LH { - pub ss_family: ADDRESS_FAMILY, - pub __ss_pad1: [CHAR; 6], - pub __ss_align: i64, - pub __ss_pad2: [CHAR; 112], -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in { - pub sin_family: ADDRESS_FAMILY, - pub sin_port: USHORT, - pub sin_addr: in_addr, - pub sin_zero: [CHAR; 8], -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct sockaddr_in6 { - pub sin6_family: ADDRESS_FAMILY, - pub sin6_port: USHORT, - pub sin6_flowinfo: c_ulong, - pub sin6_addr: in6_addr, - pub sin6_scope_id: c_ulong, -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in_addr { - pub s_addr: u32, -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct in6_addr { - pub s6_addr: [u8; 16], -} - -// Desktop specific functions & types -cfg_if::cfg_if! { -if #[cfg(not(target_vendor = "uwp"))] { - pub const EXCEPTION_CONTINUE_SEARCH: i32 = 0; -} -} - -pub unsafe extern "system" fn WriteFileEx( - hFile: BorrowedHandle<'_>, - lpBuffer: *mut ::core::ffi::c_void, - nNumberOfBytesToWrite: u32, - lpOverlapped: *mut OVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, -) -> BOOL { - windows_sys::WriteFileEx( - hFile.as_raw_handle(), - lpBuffer.cast::<u8>(), - nNumberOfBytesToWrite, - lpOverlapped, - lpCompletionRoutine, - ) -} - -pub unsafe extern "system" fn ReadFileEx( - hFile: BorrowedHandle<'_>, - lpBuffer: *mut ::core::ffi::c_void, - nNumberOfBytesToRead: u32, - lpOverlapped: *mut OVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, -) -> BOOL { - windows_sys::ReadFileEx( - hFile.as_raw_handle(), - lpBuffer.cast::<u8>(), - nNumberOfBytesToRead, - lpOverlapped, - lpCompletionRoutine, - ) -} - -// POSIX compatibility shims. -pub unsafe fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int { - windows_sys::recv(socket, buf.cast::<u8>(), len, flags) -} -pub unsafe fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int { - windows_sys::send(socket, buf.cast::<u8>(), len, flags) -} -pub unsafe fn recvfrom( - socket: SOCKET, - buf: *mut c_void, - len: c_int, - flags: c_int, - addr: *mut SOCKADDR, - addrlen: *mut c_int, -) -> c_int { - windows_sys::recvfrom(socket, buf.cast::<u8>(), len, flags, addr, addrlen) -} -pub unsafe fn sendto( - socket: SOCKET, - buf: *const c_void, - len: c_int, - flags: c_int, - addr: *const SOCKADDR, - addrlen: c_int, -) -> c_int { - windows_sys::sendto(socket, buf.cast::<u8>(), len, flags, addr, addrlen) -} -pub unsafe fn getaddrinfo( - node: *const c_char, - service: *const c_char, - hints: *const ADDRINFOA, - res: *mut *mut ADDRINFOA, -) -> c_int { - windows_sys::getaddrinfo(node.cast::<u8>(), service.cast::<u8>(), hints, res) -} - -cfg_if::cfg_if! { -if #[cfg(not(target_vendor = "uwp"))] { -pub unsafe fn NtReadFile( - filehandle: BorrowedHandle<'_>, - event: HANDLE, - apcroutine: PIO_APC_ROUTINE, - apccontext: *mut c_void, - iostatusblock: &mut IO_STATUS_BLOCK, - buffer: *mut crate::mem::MaybeUninit<u8>, - length: ULONG, - byteoffset: Option<&LARGE_INTEGER>, - key: Option<&ULONG>, -) -> NTSTATUS { - windows_sys::NtReadFile( - filehandle.as_raw_handle(), - event, - apcroutine, - apccontext, - iostatusblock, - buffer.cast::<c_void>(), - length, - byteoffset.map(|o| o as *const i64).unwrap_or(ptr::null()), - key.map(|k| k as *const u32).unwrap_or(ptr::null()), - ) -} -pub unsafe fn NtWriteFile( - filehandle: BorrowedHandle<'_>, - event: HANDLE, - apcroutine: PIO_APC_ROUTINE, - apccontext: *mut c_void, - iostatusblock: &mut IO_STATUS_BLOCK, - buffer: *const u8, - length: ULONG, - byteoffset: Option<&LARGE_INTEGER>, - key: Option<&ULONG>, -) -> NTSTATUS { - windows_sys::NtWriteFile( - filehandle.as_raw_handle(), - event, - apcroutine, - apccontext, - iostatusblock, - buffer.cast::<c_void>(), - length, - byteoffset.map(|o| o as *const i64).unwrap_or(ptr::null()), - key.map(|k| k as *const u32).unwrap_or(ptr::null()), - ) -} -} -} - -// Functions that aren't available on every version of Windows that we support, -// but we still use them and just provide some form of a fallback implementation. -compat_fn_with_fallback! { - pub static KERNEL32: &CStr = c"kernel32"; - - // >= Win10 1607 - // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription - pub fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); E_NOTIMPL - } - - // >= Win8 / Server 2012 - // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime - pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () { - GetSystemTimeAsFileTime(lpsystemtimeasfiletime) - } - - // >= Win11 / Server 2022 - // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a - pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 { - GetTempPathW(bufferlength, buffer) - } -} - -compat_fn_optional! { - crate::sys::compat::load_synch_functions(); - pub fn WaitOnAddress( - address: *const ::core::ffi::c_void, - compareaddress: *const ::core::ffi::c_void, - addresssize: usize, - dwmilliseconds: u32 - ) -> BOOL; - pub fn WakeByAddressSingle(address: *const ::core::ffi::c_void); -} - -compat_fn_with_fallback! { - pub static NTDLL: &CStr = c"ntdll"; - - pub fn NtCreateKeyedEvent( - KeyedEventHandle: LPHANDLE, - DesiredAccess: ACCESS_MASK, - ObjectAttributes: LPVOID, - Flags: ULONG - ) -> NTSTATUS { - panic!("keyed events not available") - } - pub fn NtReleaseKeyedEvent( - EventHandle: HANDLE, - Key: LPVOID, - Alertable: BOOLEAN, - Timeout: PLARGE_INTEGER - ) -> NTSTATUS { - panic!("keyed events not available") - } - pub fn NtWaitForKeyedEvent( - EventHandle: HANDLE, - Key: LPVOID, - Alertable: BOOLEAN, - Timeout: PLARGE_INTEGER - ) -> NTSTATUS { - panic!("keyed events not available") - } - - // These functions are available on UWP when lazily loaded. They will fail WACK if loaded statically. - #[cfg(target_vendor = "uwp")] - pub fn NtCreateFile( - filehandle: *mut HANDLE, - desiredaccess: FILE_ACCESS_RIGHTS, - objectattributes: *const OBJECT_ATTRIBUTES, - iostatusblock: *mut IO_STATUS_BLOCK, - allocationsize: *const i64, - fileattributes: FILE_FLAGS_AND_ATTRIBUTES, - shareaccess: FILE_SHARE_MODE, - createdisposition: NTCREATEFILE_CREATE_DISPOSITION, - createoptions: NTCREATEFILE_CREATE_OPTIONS, - eabuffer: *const ::core::ffi::c_void, - ealength: u32 - ) -> NTSTATUS { - STATUS_NOT_IMPLEMENTED - } - #[cfg(target_vendor = "uwp")] - pub fn NtReadFile( - filehandle: BorrowedHandle<'_>, - event: HANDLE, - apcroutine: PIO_APC_ROUTINE, - apccontext: *mut c_void, - iostatusblock: &mut IO_STATUS_BLOCK, - buffer: *mut crate::mem::MaybeUninit<u8>, - length: ULONG, - byteoffset: Option<&LARGE_INTEGER>, - key: Option<&ULONG> - ) -> NTSTATUS { - STATUS_NOT_IMPLEMENTED - } - #[cfg(target_vendor = "uwp")] - pub fn NtWriteFile( - filehandle: BorrowedHandle<'_>, - event: HANDLE, - apcroutine: PIO_APC_ROUTINE, - apccontext: *mut c_void, - iostatusblock: &mut IO_STATUS_BLOCK, - buffer: *const u8, - length: ULONG, - byteoffset: Option<&LARGE_INTEGER>, - key: Option<&ULONG> - ) -> NTSTATUS { - STATUS_NOT_IMPLEMENTED - } - #[cfg(target_vendor = "uwp")] - pub fn RtlNtStatusToDosError(Status: NTSTATUS) -> u32 { - Status as u32 - } -} - -// # Arm32 shim -// -// AddVectoredExceptionHandler and WSAStartup use platform-specific types. -// However, Microsoft no longer supports thumbv7a so definitions for those targets -// are not included in the win32 metadata. We work around that by defining them here. -// -// Where possible, these definitions should be kept in sync with https://docs.rs/windows-sys -cfg_if::cfg_if! { -if #[cfg(not(target_vendor = "uwp"))] { - #[link(name = "kernel32")] - extern "system" { - pub fn AddVectoredExceptionHandler( - first: u32, - handler: PVECTORED_EXCEPTION_HANDLER, - ) -> *mut c_void; - } - pub type PVECTORED_EXCEPTION_HANDLER = Option< - unsafe extern "system" fn(exceptioninfo: *mut EXCEPTION_POINTERS) -> i32, - >; - #[repr(C)] - pub struct EXCEPTION_POINTERS { - pub ExceptionRecord: *mut EXCEPTION_RECORD, - pub ContextRecord: *mut CONTEXT, - } - #[cfg(target_arch = "arm")] - pub enum CONTEXT {} -}} - -#[link(name = "ws2_32")] -extern "system" { - pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32; -} -#[cfg(target_arch = "arm")] -#[repr(C)] -pub struct WSADATA { - pub wVersion: u16, - pub wHighVersion: u16, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], - pub iMaxSockets: u16, - pub iMaxUdpDg: u16, - pub lpVendorInfo: PSTR, -} diff --git a/library/std/src/sys/windows/c/windows_sys.lst b/library/std/src/sys/windows/c/windows_sys.lst deleted file mode 100644 index f91e1054a04..00000000000 --- a/library/std/src/sys/windows/c/windows_sys.lst +++ /dev/null @@ -1,2596 +0,0 @@ ---out windows_sys.rs ---config flatten std ---filter -// tidy-alphabetical-start -!Windows.Win32.Foundation.INVALID_HANDLE_VALUE -Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED -Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION -Windows.Wdk.Storage.FileSystem.FILE_CREATE -Windows.Wdk.Storage.FileSystem.FILE_CREATE_TREE_CONNECTION -Windows.Wdk.Storage.FileSystem.FILE_DELETE_ON_CLOSE -Windows.Wdk.Storage.FileSystem.FILE_DIRECTORY_FILE -Windows.Wdk.Storage.FileSystem.FILE_DISALLOW_EXCLUSIVE -Windows.Wdk.Storage.FileSystem.FILE_NO_COMPRESSION -Windows.Wdk.Storage.FileSystem.FILE_NO_EA_KNOWLEDGE -Windows.Wdk.Storage.FileSystem.FILE_NO_INTERMEDIATE_BUFFERING -Windows.Wdk.Storage.FileSystem.FILE_NON_DIRECTORY_FILE -Windows.Wdk.Storage.FileSystem.FILE_OPEN -Windows.Wdk.Storage.FileSystem.FILE_OPEN_BY_FILE_ID -Windows.Wdk.Storage.FileSystem.FILE_OPEN_FOR_BACKUP_INTENT -Windows.Wdk.Storage.FileSystem.FILE_OPEN_FOR_FREE_SPACE_QUERY -Windows.Wdk.Storage.FileSystem.FILE_OPEN_IF -Windows.Wdk.Storage.FileSystem.FILE_OPEN_NO_RECALL -Windows.Wdk.Storage.FileSystem.FILE_OPEN_REPARSE_POINT -Windows.Wdk.Storage.FileSystem.FILE_OPEN_REQUIRING_OPLOCK -Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE -Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE_IF -Windows.Wdk.Storage.FileSystem.FILE_RANDOM_ACCESS -Windows.Wdk.Storage.FileSystem.FILE_RESERVE_OPFILTER -Windows.Wdk.Storage.FileSystem.FILE_SEQUENTIAL_ONLY -Windows.Wdk.Storage.FileSystem.FILE_SESSION_AWARE -Windows.Wdk.Storage.FileSystem.FILE_SUPERSEDE -Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_ALERT -Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_NONALERT -Windows.Wdk.Storage.FileSystem.FILE_WRITE_THROUGH -Windows.Wdk.Storage.FileSystem.NtCreateFile -Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_DISPOSITION -Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_OPTIONS -Windows.Wdk.Storage.FileSystem.NtReadFile -Windows.Wdk.Storage.FileSystem.NtWriteFile -Windows.Wdk.Storage.FileSystem.SYMLINK_FLAG_RELATIVE -Windows.Win32.Foundation.BOOL -Windows.Win32.Foundation.BOOLEAN -Windows.Win32.Foundation.CloseHandle -Windows.Win32.Foundation.DNS_ERROR_ADDRESS_REQUIRED -Windows.Win32.Foundation.DNS_ERROR_ALIAS_LOOP -Windows.Win32.Foundation.DNS_ERROR_AUTOZONE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_AXFR -Windows.Win32.Foundation.DNS_ERROR_BACKGROUND_LOADING -Windows.Win32.Foundation.DNS_ERROR_BAD_KEYMASTER -Windows.Win32.Foundation.DNS_ERROR_BAD_PACKET -Windows.Win32.Foundation.DNS_ERROR_CANNOT_FIND_ROOT_HINTS -Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED -Windows.Win32.Foundation.DNS_ERROR_CNAME_COLLISION -Windows.Win32.Foundation.DNS_ERROR_CNAME_LOOP -Windows.Win32.Foundation.DNS_ERROR_DATAFILE_OPEN_FAILURE -Windows.Win32.Foundation.DNS_ERROR_DATAFILE_PARSING -Windows.Win32.Foundation.DNS_ERROR_DEFAULT_SCOPE -Windows.Win32.Foundation.DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE -Windows.Win32.Foundation.DNS_ERROR_DEFAULT_ZONESCOPE -Windows.Win32.Foundation.DNS_ERROR_DELEGATION_REQUIRED -Windows.Win32.Foundation.DNS_ERROR_DNAME_COLLISION -Windows.Win32.Foundation.DNS_ERROR_DNSSEC_IS_DISABLED -Windows.Win32.Foundation.DNS_ERROR_DP_ALREADY_ENLISTED -Windows.Win32.Foundation.DNS_ERROR_DP_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_DP_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_DP_FSMO_ERROR -Windows.Win32.Foundation.DNS_ERROR_DP_NOT_AVAILABLE -Windows.Win32.Foundation.DNS_ERROR_DP_NOT_ENLISTED -Windows.Win32.Foundation.DNS_ERROR_DS_UNAVAILABLE -Windows.Win32.Foundation.DNS_ERROR_DS_ZONE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_DWORD_VALUE_TOO_LARGE -Windows.Win32.Foundation.DNS_ERROR_DWORD_VALUE_TOO_SMALL -Windows.Win32.Foundation.DNS_ERROR_FILE_WRITEBACK_FAILED -Windows.Win32.Foundation.DNS_ERROR_FORWARDER_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_INCONSISTENT_ROOT_HINTS -Windows.Win32.Foundation.DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_CLIENT_SUBNET_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_DATA -Windows.Win32.Foundation.DNS_ERROR_INVALID_DATAFILE_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET -Windows.Win32.Foundation.DNS_ERROR_INVALID_IP_ADDRESS -Windows.Win32.Foundation.DNS_ERROR_INVALID_KEY_SIZE -Windows.Win32.Foundation.DNS_ERROR_INVALID_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_NAME_CHAR -Windows.Win32.Foundation.DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT -Windows.Win32.Foundation.DNS_ERROR_INVALID_POLICY_TABLE -Windows.Win32.Foundation.DNS_ERROR_INVALID_PROPERTY -Windows.Win32.Foundation.DNS_ERROR_INVALID_ROLLOVER_PERIOD -Windows.Win32.Foundation.DNS_ERROR_INVALID_SCOPE_NAME -Windows.Win32.Foundation.DNS_ERROR_INVALID_SCOPE_OPERATION -Windows.Win32.Foundation.DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD -Windows.Win32.Foundation.DNS_ERROR_INVALID_TYPE -Windows.Win32.Foundation.DNS_ERROR_INVALID_XML -Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_OPERATION -Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_TYPE -Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONESCOPE_NAME -Windows.Win32.Foundation.DNS_ERROR_KEYMASTER_REQUIRED -Windows.Win32.Foundation.DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION -Windows.Win32.Foundation.DNS_ERROR_KSP_NOT_ACCESSIBLE -Windows.Win32.Foundation.DNS_ERROR_LOAD_ZONESCOPE_FAILED -Windows.Win32.Foundation.DNS_ERROR_NAME_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_NAME_NOT_IN_ZONE -Windows.Win32.Foundation.DNS_ERROR_NBSTAT_INIT_FAILED -Windows.Win32.Foundation.DNS_ERROR_NEED_SECONDARY_ADDRESSES -Windows.Win32.Foundation.DNS_ERROR_NEED_WINS_SERVERS -Windows.Win32.Foundation.DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE -Windows.Win32.Foundation.DNS_ERROR_NO_CREATE_CACHE_DATA -Windows.Win32.Foundation.DNS_ERROR_NO_DNS_SERVERS -Windows.Win32.Foundation.DNS_ERROR_NO_MEMORY -Windows.Win32.Foundation.DNS_ERROR_NO_PACKET -Windows.Win32.Foundation.DNS_ERROR_NO_TCPIP -Windows.Win32.Foundation.DNS_ERROR_NO_VALID_TRUST_ANCHORS -Windows.Win32.Foundation.DNS_ERROR_NO_ZONE_INFO -Windows.Win32.Foundation.DNS_ERROR_NODE_CREATION_FAILED -Windows.Win32.Foundation.DNS_ERROR_NODE_IS_CNAME -Windows.Win32.Foundation.DNS_ERROR_NODE_IS_DNAME -Windows.Win32.Foundation.DNS_ERROR_NON_RFC_NAME -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_RODC -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_ON_ZSK -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_UNDER_DNAME -Windows.Win32.Foundation.DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES -Windows.Win32.Foundation.DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS -Windows.Win32.Foundation.DNS_ERROR_NOT_UNIQUE -Windows.Win32.Foundation.DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 -Windows.Win32.Foundation.DNS_ERROR_NSEC3_NAME_COLLISION -Windows.Win32.Foundation.DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 -Windows.Win32.Foundation.DNS_ERROR_NUMERIC_NAME -Windows.Win32.Foundation.DNS_ERROR_POLICY_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_POLICY_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_NAME -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_SETTINGS -Windows.Win32.Foundation.DNS_ERROR_POLICY_INVALID_WEIGHT -Windows.Win32.Foundation.DNS_ERROR_POLICY_LOCKED -Windows.Win32.Foundation.DNS_ERROR_POLICY_MISSING_CRITERIA -Windows.Win32.Foundation.DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID -Windows.Win32.Foundation.DNS_ERROR_POLICY_SCOPE_MISSING -Windows.Win32.Foundation.DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED -Windows.Win32.Foundation.DNS_ERROR_PRIMARY_REQUIRES_DATAFILE -Windows.Win32.Foundation.DNS_ERROR_RCODE -Windows.Win32.Foundation.DNS_ERROR_RCODE_BADKEY -Windows.Win32.Foundation.DNS_ERROR_RCODE_BADSIG -Windows.Win32.Foundation.DNS_ERROR_RCODE_BADTIME -Windows.Win32.Foundation.DNS_ERROR_RCODE_FORMAT_ERROR -Windows.Win32.Foundation.DNS_ERROR_RCODE_NAME_ERROR -Windows.Win32.Foundation.DNS_ERROR_RCODE_NOT_IMPLEMENTED -Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTAUTH -Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTZONE -Windows.Win32.Foundation.DNS_ERROR_RCODE_NXRRSET -Windows.Win32.Foundation.DNS_ERROR_RCODE_REFUSED -Windows.Win32.Foundation.DNS_ERROR_RCODE_SERVER_FAILURE -Windows.Win32.Foundation.DNS_ERROR_RCODE_YXDOMAIN -Windows.Win32.Foundation.DNS_ERROR_RCODE_YXRRSET -Windows.Win32.Foundation.DNS_ERROR_RECORD_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_RECORD_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_RECORD_FORMAT -Windows.Win32.Foundation.DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT -Windows.Win32.Foundation.DNS_ERROR_RECORD_TIMED_OUT -Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_ALREADY_QUEUED -Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_IN_PROGRESS -Windows.Win32.Foundation.DNS_ERROR_ROLLOVER_NOT_POKEABLE -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_IPV4_PREFIX -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_IPV6_PREFIX -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_LEAK_RATE -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_TC_RATE -Windows.Win32.Foundation.DNS_ERROR_RRL_INVALID_WINDOW_SIZE -Windows.Win32.Foundation.DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE -Windows.Win32.Foundation.DNS_ERROR_RRL_NOT_ENABLED -Windows.Win32.Foundation.DNS_ERROR_SCOPE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_SCOPE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_SCOPE_LOCKED -Windows.Win32.Foundation.DNS_ERROR_SECONDARY_DATA -Windows.Win32.Foundation.DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP -Windows.Win32.Foundation.DNS_ERROR_SERVERSCOPE_IS_REFERENCED -Windows.Win32.Foundation.DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE -Windows.Win32.Foundation.DNS_ERROR_SOA_DELETE_INVALID -Windows.Win32.Foundation.DNS_ERROR_STANDBY_KEY_NOT_PRESENT -Windows.Win32.Foundation.DNS_ERROR_SUBNET_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_SUBNET_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_TOO_MANY_SKDS -Windows.Win32.Foundation.DNS_ERROR_TRY_AGAIN_LATER -Windows.Win32.Foundation.DNS_ERROR_UNEXPECTED_CNG_ERROR -Windows.Win32.Foundation.DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR -Windows.Win32.Foundation.DNS_ERROR_UNKNOWN_RECORD_TYPE -Windows.Win32.Foundation.DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION -Windows.Win32.Foundation.DNS_ERROR_UNSECURE_PACKET -Windows.Win32.Foundation.DNS_ERROR_UNSUPPORTED_ALGORITHM -Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_VIRTUALIZATION_TREE_LOCKED -Windows.Win32.Foundation.DNS_ERROR_WINS_INIT_FAILED -Windows.Win32.Foundation.DNS_ERROR_ZONE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_ZONE_CONFIGURATION_ERROR -Windows.Win32.Foundation.DNS_ERROR_ZONE_CREATION_FAILED -Windows.Win32.Foundation.DNS_ERROR_ZONE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_ZONE_HAS_NO_NS_RECORDS -Windows.Win32.Foundation.DNS_ERROR_ZONE_HAS_NO_SOA_RECORD -Windows.Win32.Foundation.DNS_ERROR_ZONE_IS_SHUTDOWN -Windows.Win32.Foundation.DNS_ERROR_ZONE_LOCKED -Windows.Win32.Foundation.DNS_ERROR_ZONE_LOCKED_FOR_SIGNING -Windows.Win32.Foundation.DNS_ERROR_ZONE_NOT_SECONDARY -Windows.Win32.Foundation.DNS_ERROR_ZONE_REQUIRES_MASTER_IP -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_ALREADY_EXISTS -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED -Windows.Win32.Foundation.DNS_ERROR_ZONESCOPE_IS_REFERENCED -Windows.Win32.Foundation.DUPLICATE_CLOSE_SOURCE -Windows.Win32.Foundation.DUPLICATE_HANDLE_OPTIONS -Windows.Win32.Foundation.DUPLICATE_SAME_ACCESS -Windows.Win32.Foundation.DuplicateHandle -Windows.Win32.Foundation.E_NOTIMPL -Windows.Win32.Foundation.ERROR_ABANDON_HIBERFILE -Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_0 -Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_63 -Windows.Win32.Foundation.ERROR_ABIOS_ERROR -Windows.Win32.Foundation.ERROR_ACCESS_AUDIT_BY_POLICY -Windows.Win32.Foundation.ERROR_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_ACCESS_DENIED_APPDATA -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_BY_POLICY -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_WEBBLADE -Windows.Win32.Foundation.ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER -Windows.Win32.Foundation.ERROR_ACCOUNT_DISABLED -Windows.Win32.Foundation.ERROR_ACCOUNT_EXPIRED -Windows.Win32.Foundation.ERROR_ACCOUNT_LOCKED_OUT -Windows.Win32.Foundation.ERROR_ACCOUNT_RESTRICTION -Windows.Win32.Foundation.ERROR_ACPI_ERROR -Windows.Win32.Foundation.ERROR_ACTIVE_CONNECTIONS -Windows.Win32.Foundation.ERROR_ADAP_HDW_ERR -Windows.Win32.Foundation.ERROR_ADDRESS_ALREADY_ASSOCIATED -Windows.Win32.Foundation.ERROR_ADDRESS_NOT_ASSOCIATED -Windows.Win32.Foundation.ERROR_ALERTED -Windows.Win32.Foundation.ERROR_ALIAS_EXISTS -Windows.Win32.Foundation.ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_ALLOCATE_BUCKET -Windows.Win32.Foundation.ERROR_ALLOTTED_SPACE_EXCEEDED -Windows.Win32.Foundation.ERROR_ALREADY_ASSIGNED -Windows.Win32.Foundation.ERROR_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_ALREADY_FIBER -Windows.Win32.Foundation.ERROR_ALREADY_HAS_STREAM_ID -Windows.Win32.Foundation.ERROR_ALREADY_INITIALIZED -Windows.Win32.Foundation.ERROR_ALREADY_REGISTERED -Windows.Win32.Foundation.ERROR_ALREADY_RUNNING_LKG -Windows.Win32.Foundation.ERROR_ALREADY_THREAD -Windows.Win32.Foundation.ERROR_ALREADY_WAITING -Windows.Win32.Foundation.ERROR_ALREADY_WIN32 -Windows.Win32.Foundation.ERROR_API_UNAVAILABLE -Windows.Win32.Foundation.ERROR_APP_HANG -Windows.Win32.Foundation.ERROR_APP_INIT_FAILURE -Windows.Win32.Foundation.ERROR_APP_WRONG_OS -Windows.Win32.Foundation.ERROR_APPCONTAINER_REQUIRED -Windows.Win32.Foundation.ERROR_APPEXEC_APP_COMPAT_BLOCK -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES -Windows.Win32.Foundation.ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION -Windows.Win32.Foundation.ERROR_APPEXEC_CONDITION_NOT_SATISFIED -Windows.Win32.Foundation.ERROR_APPEXEC_HANDLE_INVALIDATED -Windows.Win32.Foundation.ERROR_APPEXEC_HOST_ID_MISMATCH -Windows.Win32.Foundation.ERROR_APPEXEC_INVALID_HOST_GENERATION -Windows.Win32.Foundation.ERROR_APPEXEC_INVALID_HOST_STATE -Windows.Win32.Foundation.ERROR_APPEXEC_NO_DONOR -Windows.Win32.Foundation.ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION -Windows.Win32.Foundation.ERROR_APPEXEC_UNKNOWN_USER -Windows.Win32.Foundation.ERROR_APPHELP_BLOCK -Windows.Win32.Foundation.ERROR_APPX_FILE_NOT_ENCRYPTED -Windows.Win32.Foundation.ERROR_ARBITRATION_UNHANDLED -Windows.Win32.Foundation.ERROR_ARENA_TRASHED -Windows.Win32.Foundation.ERROR_ARITHMETIC_OVERFLOW -Windows.Win32.Foundation.ERROR_ASSERTION_FAILURE -Windows.Win32.Foundation.ERROR_ATOMIC_LOCKS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_AUDIT_FAILED -Windows.Win32.Foundation.ERROR_AUTHENTICATION_FIREWALL_FAILED -Windows.Win32.Foundation.ERROR_AUTHIP_FAILURE -Windows.Win32.Foundation.ERROR_AUTODATASEG_EXCEEDS_64k -Windows.Win32.Foundation.ERROR_BACKUP_CONTROLLER -Windows.Win32.Foundation.ERROR_BAD_ACCESSOR_FLAGS -Windows.Win32.Foundation.ERROR_BAD_ARGUMENTS -Windows.Win32.Foundation.ERROR_BAD_COMMAND -Windows.Win32.Foundation.ERROR_BAD_COMPRESSION_BUFFER -Windows.Win32.Foundation.ERROR_BAD_CONFIGURATION -Windows.Win32.Foundation.ERROR_BAD_CURRENT_DIRECTORY -Windows.Win32.Foundation.ERROR_BAD_DESCRIPTOR_FORMAT -Windows.Win32.Foundation.ERROR_BAD_DEV_TYPE -Windows.Win32.Foundation.ERROR_BAD_DEVICE -Windows.Win32.Foundation.ERROR_BAD_DEVICE_PATH -Windows.Win32.Foundation.ERROR_BAD_DLL_ENTRYPOINT -Windows.Win32.Foundation.ERROR_BAD_DRIVER_LEVEL -Windows.Win32.Foundation.ERROR_BAD_ENVIRONMENT -Windows.Win32.Foundation.ERROR_BAD_EXE_FORMAT -Windows.Win32.Foundation.ERROR_BAD_FILE_TYPE -Windows.Win32.Foundation.ERROR_BAD_FORMAT -Windows.Win32.Foundation.ERROR_BAD_FUNCTION_TABLE -Windows.Win32.Foundation.ERROR_BAD_IMPERSONATION_LEVEL -Windows.Win32.Foundation.ERROR_BAD_INHERITANCE_ACL -Windows.Win32.Foundation.ERROR_BAD_LENGTH -Windows.Win32.Foundation.ERROR_BAD_LOGON_SESSION_STATE -Windows.Win32.Foundation.ERROR_BAD_MCFG_TABLE -Windows.Win32.Foundation.ERROR_BAD_NET_NAME -Windows.Win32.Foundation.ERROR_BAD_NET_RESP -Windows.Win32.Foundation.ERROR_BAD_NETPATH -Windows.Win32.Foundation.ERROR_BAD_PATHNAME -Windows.Win32.Foundation.ERROR_BAD_PIPE -Windows.Win32.Foundation.ERROR_BAD_PROFILE -Windows.Win32.Foundation.ERROR_BAD_PROVIDER -Windows.Win32.Foundation.ERROR_BAD_QUERY_SYNTAX -Windows.Win32.Foundation.ERROR_BAD_RECOVERY_POLICY -Windows.Win32.Foundation.ERROR_BAD_REM_ADAP -Windows.Win32.Foundation.ERROR_BAD_SERVICE_ENTRYPOINT -Windows.Win32.Foundation.ERROR_BAD_STACK -Windows.Win32.Foundation.ERROR_BAD_THREADID_ADDR -Windows.Win32.Foundation.ERROR_BAD_TOKEN_TYPE -Windows.Win32.Foundation.ERROR_BAD_UNIT -Windows.Win32.Foundation.ERROR_BAD_USER_PROFILE -Windows.Win32.Foundation.ERROR_BAD_USERNAME -Windows.Win32.Foundation.ERROR_BAD_VALIDATION_CLASS -Windows.Win32.Foundation.ERROR_BADDB -Windows.Win32.Foundation.ERROR_BADKEY -Windows.Win32.Foundation.ERROR_BADSTARTPOSITION -Windows.Win32.Foundation.ERROR_BEGINNING_OF_MEDIA -Windows.Win32.Foundation.ERROR_BEYOND_VDL -Windows.Win32.Foundation.ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT -Windows.Win32.Foundation.ERROR_BLOCK_SHARED -Windows.Win32.Foundation.ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_BLOCK_TOO_MANY_REFERENCES -Windows.Win32.Foundation.ERROR_BLOCK_WEAK_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_BLOCKED_BY_PARENTAL_CONTROLS -Windows.Win32.Foundation.ERROR_BOOT_ALREADY_ACCEPTED -Windows.Win32.Foundation.ERROR_BROKEN_PIPE -Windows.Win32.Foundation.ERROR_BUFFER_ALL_ZEROS -Windows.Win32.Foundation.ERROR_BUFFER_OVERFLOW -Windows.Win32.Foundation.ERROR_BUS_RESET -Windows.Win32.Foundation.ERROR_BUSY -Windows.Win32.Foundation.ERROR_BUSY_DRIVE -Windows.Win32.Foundation.ERROR_BYPASSIO_FLT_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CACHE_PAGE_LOCKED -Windows.Win32.Foundation.ERROR_CALL_NOT_IMPLEMENTED -Windows.Win32.Foundation.ERROR_CALLBACK_INVOKE_INLINE -Windows.Win32.Foundation.ERROR_CALLBACK_POP_STACK -Windows.Win32.Foundation.ERROR_CALLBACK_SUPPLIED_INVALID_DATA -Windows.Win32.Foundation.ERROR_CAN_NOT_COMPLETE -Windows.Win32.Foundation.ERROR_CANCEL_VIOLATION -Windows.Win32.Foundation.ERROR_CANCELLED -Windows.Win32.Foundation.ERROR_CANNOT_BREAK_OPLOCK -Windows.Win32.Foundation.ERROR_CANNOT_COPY -Windows.Win32.Foundation.ERROR_CANNOT_DETECT_DRIVER_FAILURE -Windows.Win32.Foundation.ERROR_CANNOT_DETECT_PROCESS_ABORT -Windows.Win32.Foundation.ERROR_CANNOT_FIND_WND_CLASS -Windows.Win32.Foundation.ERROR_CANNOT_GRANT_REQUESTED_OPLOCK -Windows.Win32.Foundation.ERROR_CANNOT_IMPERSONATE -Windows.Win32.Foundation.ERROR_CANNOT_LOAD_REGISTRY_FILE -Windows.Win32.Foundation.ERROR_CANNOT_MAKE -Windows.Win32.Foundation.ERROR_CANNOT_OPEN_PROFILE -Windows.Win32.Foundation.ERROR_CANT_ACCESS_DOMAIN_INFO -Windows.Win32.Foundation.ERROR_CANT_ACCESS_FILE -Windows.Win32.Foundation.ERROR_CANT_CLEAR_ENCRYPTION_FLAG -Windows.Win32.Foundation.ERROR_CANT_DISABLE_MANDATORY -Windows.Win32.Foundation.ERROR_CANT_ENABLE_DENY_ONLY -Windows.Win32.Foundation.ERROR_CANT_OPEN_ANONYMOUS -Windows.Win32.Foundation.ERROR_CANT_RESOLVE_FILENAME -Windows.Win32.Foundation.ERROR_CANT_TERMINATE_SELF -Windows.Win32.Foundation.ERROR_CANT_WAIT -Windows.Win32.Foundation.ERROR_CANTFETCHBACKWARDS -Windows.Win32.Foundation.ERROR_CANTOPEN -Windows.Win32.Foundation.ERROR_CANTREAD -Windows.Win32.Foundation.ERROR_CANTSCROLLBACKWARDS -Windows.Win32.Foundation.ERROR_CANTWRITE -Windows.Win32.Foundation.ERROR_CAPAUTHZ_CHANGE_TYPE -Windows.Win32.Foundation.ERROR_CAPAUTHZ_DB_CORRUPTED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NO_POLICY -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_AUTHORIZED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_DEVUNLOCKED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_NOT_PROVISIONED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH -Windows.Win32.Foundation.ERROR_CAPAUTHZ_SCCD_PARSE_ERROR -Windows.Win32.Foundation.ERROR_CARDBUS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CASE_DIFFERING_NAMES_IN_DIR -Windows.Win32.Foundation.ERROR_CASE_SENSITIVE_PATH -Windows.Win32.Foundation.ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT -Windows.Win32.Foundation.ERROR_CHECKING_FILE_SYSTEM -Windows.Win32.Foundation.ERROR_CHECKOUT_REQUIRED -Windows.Win32.Foundation.ERROR_CHILD_MUST_BE_VOLATILE -Windows.Win32.Foundation.ERROR_CHILD_NOT_COMPLETE -Windows.Win32.Foundation.ERROR_CHILD_PROCESS_BLOCKED -Windows.Win32.Foundation.ERROR_CHILD_WINDOW_MENU -Windows.Win32.Foundation.ERROR_CIMFS_IMAGE_CORRUPT -Windows.Win32.Foundation.ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CIRCULAR_DEPENDENCY -Windows.Win32.Foundation.ERROR_CLASS_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_CLASS_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_CLASS_HAS_WINDOWS -Windows.Win32.Foundation.ERROR_CLIENT_SERVER_PARAMETERS_INVALID -Windows.Win32.Foundation.ERROR_CLIPBOARD_NOT_OPEN -Windows.Win32.Foundation.ERROR_CLOUD_FILE_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_ALREADY_CONNECTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_AUTHENTICATION_FAILED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY -Windows.Win32.Foundation.ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_IN_USE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS -Windows.Win32.Foundation.ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES -Windows.Win32.Foundation.ERROR_CLOUD_FILE_INVALID_REQUEST -Windows.Win32.Foundation.ERROR_CLOUD_FILE_METADATA_CORRUPT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_METADATA_TOO_LARGE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_IN_SYNC -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PINNED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_CORRUPT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING -Windows.Win32.Foundation.ERROR_CLOUD_FILE_PROVIDER_TERMINATED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_READ_ONLY_VOLUME -Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_ABORTED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_CANCELED -Windows.Win32.Foundation.ERROR_CLOUD_FILE_REQUEST_TIMEOUT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS -Windows.Win32.Foundation.ERROR_CLOUD_FILE_UNSUCCESSFUL -Windows.Win32.Foundation.ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT -Windows.Win32.Foundation.ERROR_CLOUD_FILE_VALIDATION_FAILED -Windows.Win32.Foundation.ERROR_COMMITMENT_LIMIT -Windows.Win32.Foundation.ERROR_COMMITMENT_MINIMUM -Windows.Win32.Foundation.ERROR_COMPRESSED_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_COMPRESSION_DISABLED -Windows.Win32.Foundation.ERROR_COMPRESSION_NOT_BENEFICIAL -Windows.Win32.Foundation.ERROR_CONNECTED_OTHER_PASSWORD -Windows.Win32.Foundation.ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT -Windows.Win32.Foundation.ERROR_CONNECTION_ABORTED -Windows.Win32.Foundation.ERROR_CONNECTION_ACTIVE -Windows.Win32.Foundation.ERROR_CONNECTION_COUNT_LIMIT -Windows.Win32.Foundation.ERROR_CONNECTION_INVALID -Windows.Win32.Foundation.ERROR_CONNECTION_REFUSED -Windows.Win32.Foundation.ERROR_CONNECTION_UNAVAIL -Windows.Win32.Foundation.ERROR_CONTAINER_ASSIGNED -Windows.Win32.Foundation.ERROR_CONTENT_BLOCKED -Windows.Win32.Foundation.ERROR_CONTEXT_EXPIRED -Windows.Win32.Foundation.ERROR_CONTINUE -Windows.Win32.Foundation.ERROR_CONTROL_C_EXIT -Windows.Win32.Foundation.ERROR_CONTROL_ID_NOT_FOUND -Windows.Win32.Foundation.ERROR_CONVERT_TO_LARGE -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_CLEARED -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_CORRUPTED -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_DELETED_FULL -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_OVERFULL -Windows.Win32.Foundation.ERROR_CORRUPT_LOG_UNAVAILABLE -Windows.Win32.Foundation.ERROR_CORRUPT_SYSTEM_FILE -Windows.Win32.Foundation.ERROR_COULD_NOT_INTERPRET -Windows.Win32.Foundation.ERROR_COUNTER_TIMEOUT -Windows.Win32.Foundation.ERROR_CPU_SET_INVALID -Windows.Win32.Foundation.ERROR_CRASH_DUMP -Windows.Win32.Foundation.ERROR_CRC -Windows.Win32.Foundation.ERROR_CREATE_FAILED -Windows.Win32.Foundation.ERROR_CROSS_PARTITION_VIOLATION -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_FILE_NOT_CSE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE -Windows.Win32.Foundation.ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER -Windows.Win32.Foundation.ERROR_CSCSHARE_OFFLINE -Windows.Win32.Foundation.ERROR_CTX_CLIENT_QUERY_TIMEOUT -Windows.Win32.Foundation.ERROR_CTX_MODEM_RESPONSE_TIMEOUT -Windows.Win32.Foundation.ERROR_CURRENT_DIRECTORY -Windows.Win32.Foundation.ERROR_CURRENT_DOMAIN_NOT_ALLOWED -Windows.Win32.Foundation.ERROR_DATA_CHECKSUM_ERROR -Windows.Win32.Foundation.ERROR_DATA_NOT_ACCEPTED -Windows.Win32.Foundation.ERROR_DATABASE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_DATATYPE_MISMATCH -Windows.Win32.Foundation.ERROR_DAX_MAPPING_EXISTS -Windows.Win32.Foundation.ERROR_DBG_COMMAND_EXCEPTION -Windows.Win32.Foundation.ERROR_DBG_CONTINUE -Windows.Win32.Foundation.ERROR_DBG_CONTROL_BREAK -Windows.Win32.Foundation.ERROR_DBG_CONTROL_C -Windows.Win32.Foundation.ERROR_DBG_EXCEPTION_HANDLED -Windows.Win32.Foundation.ERROR_DBG_EXCEPTION_NOT_HANDLED -Windows.Win32.Foundation.ERROR_DBG_PRINTEXCEPTION_C -Windows.Win32.Foundation.ERROR_DBG_REPLY_LATER -Windows.Win32.Foundation.ERROR_DBG_RIPEXCEPTION -Windows.Win32.Foundation.ERROR_DBG_TERMINATE_PROCESS -Windows.Win32.Foundation.ERROR_DBG_TERMINATE_THREAD -Windows.Win32.Foundation.ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE -Windows.Win32.Foundation.ERROR_DC_NOT_FOUND -Windows.Win32.Foundation.ERROR_DDE_FAIL -Windows.Win32.Foundation.ERROR_DEBUG_ATTACH_FAILED -Windows.Win32.Foundation.ERROR_DEBUGGER_INACTIVE -Windows.Win32.Foundation.ERROR_DECRYPTION_FAILED -Windows.Win32.Foundation.ERROR_DELAY_LOAD_FAILED -Windows.Win32.Foundation.ERROR_DELETE_PENDING -Windows.Win32.Foundation.ERROR_DEPENDENT_SERVICES_RUNNING -Windows.Win32.Foundation.ERROR_DESTINATION_ELEMENT_FULL -Windows.Win32.Foundation.ERROR_DESTROY_OBJECT_OF_OTHER_THREAD -Windows.Win32.Foundation.ERROR_DEV_NOT_EXIST -Windows.Win32.Foundation.ERROR_DEVICE_ALREADY_ATTACHED -Windows.Win32.Foundation.ERROR_DEVICE_ALREADY_REMEMBERED -Windows.Win32.Foundation.ERROR_DEVICE_DOOR_OPEN -Windows.Win32.Foundation.ERROR_DEVICE_ENUMERATION_ERROR -Windows.Win32.Foundation.ERROR_DEVICE_FEATURE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DEVICE_HARDWARE_ERROR -Windows.Win32.Foundation.ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL -Windows.Win32.Foundation.ERROR_DEVICE_IN_MAINTENANCE -Windows.Win32.Foundation.ERROR_DEVICE_IN_USE -Windows.Win32.Foundation.ERROR_DEVICE_NO_RESOURCES -Windows.Win32.Foundation.ERROR_DEVICE_NOT_CONNECTED -Windows.Win32.Foundation.ERROR_DEVICE_NOT_PARTITIONED -Windows.Win32.Foundation.ERROR_DEVICE_REINITIALIZATION_NEEDED -Windows.Win32.Foundation.ERROR_DEVICE_REMOVED -Windows.Win32.Foundation.ERROR_DEVICE_REQUIRES_CLEANING -Windows.Win32.Foundation.ERROR_DEVICE_RESET_REQUIRED -Windows.Win32.Foundation.ERROR_DEVICE_SUPPORT_IN_PROGRESS -Windows.Win32.Foundation.ERROR_DEVICE_UNREACHABLE -Windows.Win32.Foundation.ERROR_DHCP_ADDRESS_CONFLICT -Windows.Win32.Foundation.ERROR_DIFFERENT_SERVICE_ACCOUNT -Windows.Win32.Foundation.ERROR_DIR_EFS_DISALLOWED -Windows.Win32.Foundation.ERROR_DIR_NOT_EMPTY -Windows.Win32.Foundation.ERROR_DIR_NOT_ROOT -Windows.Win32.Foundation.ERROR_DIRECT_ACCESS_HANDLE -Windows.Win32.Foundation.ERROR_DIRECTORY -Windows.Win32.Foundation.ERROR_DIRECTORY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DISCARDED -Windows.Win32.Foundation.ERROR_DISK_CHANGE -Windows.Win32.Foundation.ERROR_DISK_CORRUPT -Windows.Win32.Foundation.ERROR_DISK_FULL -Windows.Win32.Foundation.ERROR_DISK_OPERATION_FAILED -Windows.Win32.Foundation.ERROR_DISK_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_DISK_RECALIBRATE_FAILED -Windows.Win32.Foundation.ERROR_DISK_REPAIR_DISABLED -Windows.Win32.Foundation.ERROR_DISK_REPAIR_REDIRECTED -Windows.Win32.Foundation.ERROR_DISK_REPAIR_UNSUCCESSFUL -Windows.Win32.Foundation.ERROR_DISK_RESET_FAILED -Windows.Win32.Foundation.ERROR_DISK_RESOURCES_EXHAUSTED -Windows.Win32.Foundation.ERROR_DISK_TOO_FRAGMENTED -Windows.Win32.Foundation.ERROR_DLL_INIT_FAILED -Windows.Win32.Foundation.ERROR_DLL_INIT_FAILED_LOGOFF -Windows.Win32.Foundation.ERROR_DLL_MIGHT_BE_INCOMPATIBLE -Windows.Win32.Foundation.ERROR_DLL_MIGHT_BE_INSECURE -Windows.Win32.Foundation.ERROR_DLL_NOT_FOUND -Windows.Win32.Foundation.ERROR_DLP_POLICY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_DLP_POLICY_SILENTLY_FAIL -Windows.Win32.Foundation.ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION -Windows.Win32.Foundation.ERROR_DOMAIN_CONTROLLER_EXISTS -Windows.Win32.Foundation.ERROR_DOMAIN_CONTROLLER_NOT_FOUND -Windows.Win32.Foundation.ERROR_DOMAIN_CTRLR_CONFIG_ERROR -Windows.Win32.Foundation.ERROR_DOMAIN_EXISTS -Windows.Win32.Foundation.ERROR_DOMAIN_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION -Windows.Win32.Foundation.ERROR_DOMAIN_TRUST_INCONSISTENT -Windows.Win32.Foundation.ERROR_DOWNGRADE_DETECTED -Windows.Win32.Foundation.ERROR_DPL_NOT_SUPPORTED_FOR_USER -Windows.Win32.Foundation.ERROR_DRIVE_LOCKED -Windows.Win32.Foundation.ERROR_DRIVER_BLOCKED -Windows.Win32.Foundation.ERROR_DRIVER_CANCEL_TIMEOUT -Windows.Win32.Foundation.ERROR_DRIVER_DATABASE_ERROR -Windows.Win32.Foundation.ERROR_DRIVER_FAILED_PRIOR_UNLOAD -Windows.Win32.Foundation.ERROR_DRIVER_FAILED_SLEEP -Windows.Win32.Foundation.ERROR_DRIVER_PROCESS_TERMINATED -Windows.Win32.Foundation.ERROR_DRIVERS_LEAKING_LOCKED_PAGES -Windows.Win32.Foundation.ERROR_DS_ADD_REPLICA_INHIBITED -Windows.Win32.Foundation.ERROR_DS_ADMIN_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_AFFECTS_MULTIPLE_DSAS -Windows.Win32.Foundation.ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_ALIAS_DEREF_PROBLEM -Windows.Win32.Foundation.ERROR_DS_ALIAS_POINTS_TO_ALIAS -Windows.Win32.Foundation.ERROR_DS_ALIAS_PROBLEM -Windows.Win32.Foundation.ERROR_DS_ALIASED_OBJ_MISSING -Windows.Win32.Foundation.ERROR_DS_ATT_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_DS_ATT_IS_NOT_ON_OBJ -Windows.Win32.Foundation.ERROR_DS_ATT_NOT_DEF_FOR_CLASS -Windows.Win32.Foundation.ERROR_DS_ATT_NOT_DEF_IN_SCHEMA -Windows.Win32.Foundation.ERROR_DS_ATT_SCHEMA_REQ_ID -Windows.Win32.Foundation.ERROR_DS_ATT_SCHEMA_REQ_SYNTAX -Windows.Win32.Foundation.ERROR_DS_ATT_VAL_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS -Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_OWNED_BY_SAM -Windows.Win32.Foundation.ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED -Windows.Win32.Foundation.ERROR_DS_AUDIT_FAILURE -Windows.Win32.Foundation.ERROR_DS_AUTH_METHOD_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DS_AUTH_UNKNOWN -Windows.Win32.Foundation.ERROR_DS_AUTHORIZATION_FAILED -Windows.Win32.Foundation.ERROR_DS_AUX_CLS_TEST_FAIL -Windows.Win32.Foundation.ERROR_DS_BACKLINK_WITHOUT_LINK -Windows.Win32.Foundation.ERROR_DS_BAD_ATT_SCHEMA_SYNTAX -Windows.Win32.Foundation.ERROR_DS_BAD_HIERARCHY_FILE -Windows.Win32.Foundation.ERROR_DS_BAD_INSTANCE_TYPE -Windows.Win32.Foundation.ERROR_DS_BAD_NAME_SYNTAX -Windows.Win32.Foundation.ERROR_DS_BAD_RDN_ATT_ID_SYNTAX -Windows.Win32.Foundation.ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED -Windows.Win32.Foundation.ERROR_DS_BUSY -Windows.Win32.Foundation.ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD -Windows.Win32.Foundation.ERROR_DS_CANT_ADD_ATT_VALUES -Windows.Win32.Foundation.ERROR_DS_CANT_ADD_SYSTEM_ONLY -Windows.Win32.Foundation.ERROR_DS_CANT_ADD_TO_GC -Windows.Win32.Foundation.ERROR_DS_CANT_CACHE_ATT -Windows.Win32.Foundation.ERROR_DS_CANT_CACHE_CLASS -Windows.Win32.Foundation.ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC -Windows.Win32.Foundation.ERROR_DS_CANT_CREATE_UNDER_SCHEMA -Windows.Win32.Foundation.ERROR_DS_CANT_DEL_MASTER_CROSSREF -Windows.Win32.Foundation.ERROR_DS_CANT_DELETE -Windows.Win32.Foundation.ERROR_DS_CANT_DELETE_DSA_OBJ -Windows.Win32.Foundation.ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC -Windows.Win32.Foundation.ERROR_DS_CANT_DEREF_ALIAS -Windows.Win32.Foundation.ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN -Windows.Win32.Foundation.ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_DSA_OBJ -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_EXPECTED_NC -Windows.Win32.Foundation.ERROR_DS_CANT_FIND_NC_IN_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_MIX_MASTER_AND_REPS -Windows.Win32.Foundation.ERROR_DS_CANT_MOD_OBJ_CLASS -Windows.Win32.Foundation.ERROR_DS_CANT_MOD_PRIMARYGROUPID -Windows.Win32.Foundation.ERROR_DS_CANT_MOD_SYSTEM_ONLY -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_ACCOUNT_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_APP_BASIC_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_APP_QUERY_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_DELETED_OBJECT -Windows.Win32.Foundation.ERROR_DS_CANT_MOVE_RESOURCE_GROUP -Windows.Win32.Foundation.ERROR_DS_CANT_ON_NON_LEAF -Windows.Win32.Foundation.ERROR_DS_CANT_ON_RDN -Windows.Win32.Foundation.ERROR_DS_CANT_REM_MISSING_ATT -Windows.Win32.Foundation.ERROR_DS_CANT_REM_MISSING_ATT_VAL -Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_ATT_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_CLASS_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_REPLACE_HIDDEN_REC -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_ATTS -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_CHILD -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_DN -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_INSTANCE -Windows.Win32.Foundation.ERROR_DS_CANT_RETRIEVE_SD -Windows.Win32.Foundation.ERROR_DS_CANT_START -Windows.Win32.Foundation.ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ -Windows.Win32.Foundation.ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS -Windows.Win32.Foundation.ERROR_DS_CHILDREN_EXIST -Windows.Win32.Foundation.ERROR_DS_CLASS_MUST_BE_CONCRETE -Windows.Win32.Foundation.ERROR_DS_CLASS_NOT_DSA -Windows.Win32.Foundation.ERROR_DS_CLIENT_LOOP -Windows.Win32.Foundation.ERROR_DS_CODE_INCONSISTENCY -Windows.Win32.Foundation.ERROR_DS_COMPARE_FALSE -Windows.Win32.Foundation.ERROR_DS_COMPARE_TRUE -Windows.Win32.Foundation.ERROR_DS_CONFIDENTIALITY_REQUIRED -Windows.Win32.Foundation.ERROR_DS_CONFIG_PARAM_MISSING -Windows.Win32.Foundation.ERROR_DS_CONSTRAINT_VIOLATION -Windows.Win32.Foundation.ERROR_DS_CONSTRUCTED_ATT_MOD -Windows.Win32.Foundation.ERROR_DS_CONTROL_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_COULDNT_CONTACT_FSMO -Windows.Win32.Foundation.ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE -Windows.Win32.Foundation.ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE -Windows.Win32.Foundation.ERROR_DS_COULDNT_UPDATE_SPNS -Windows.Win32.Foundation.ERROR_DS_COUNTING_AB_INDICES_FAILED -Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE -Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 -Windows.Win32.Foundation.ERROR_DS_CROSS_DOM_MOVE_ERROR -Windows.Win32.Foundation.ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD -Windows.Win32.Foundation.ERROR_DS_CROSS_NC_DN_RENAME -Windows.Win32.Foundation.ERROR_DS_CROSS_REF_BUSY -Windows.Win32.Foundation.ERROR_DS_CROSS_REF_EXISTS -Windows.Win32.Foundation.ERROR_DS_DATABASE_ERROR -Windows.Win32.Foundation.ERROR_DS_DECODING_ERROR -Windows.Win32.Foundation.ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED -Windows.Win32.Foundation.ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_DIFFERENT_REPL_EPOCHS -Windows.Win32.Foundation.ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER -Windows.Win32.Foundation.ERROR_DS_DISALLOWED_NC_REDIRECT -Windows.Win32.Foundation.ERROR_DS_DNS_LOOKUP_FAILURE -Windows.Win32.Foundation.ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_DOMAIN_RENAME_IN_PROGRESS -Windows.Win32.Foundation.ERROR_DS_DOMAIN_VERSION_TOO_HIGH -Windows.Win32.Foundation.ERROR_DS_DOMAIN_VERSION_TOO_LOW -Windows.Win32.Foundation.ERROR_DS_DRA_ABANDON_SYNC -Windows.Win32.Foundation.ERROR_DS_DRA_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_DS_DRA_BAD_DN -Windows.Win32.Foundation.ERROR_DS_DRA_BAD_INSTANCE_TYPE -Windows.Win32.Foundation.ERROR_DS_DRA_BAD_NC -Windows.Win32.Foundation.ERROR_DS_DRA_BUSY -Windows.Win32.Foundation.ERROR_DS_DRA_CONNECTION_FAILED -Windows.Win32.Foundation.ERROR_DS_DRA_CORRUPT_UTD_VECTOR -Windows.Win32.Foundation.ERROR_DS_DRA_DB_ERROR -Windows.Win32.Foundation.ERROR_DS_DRA_DN_EXISTS -Windows.Win32.Foundation.ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT -Windows.Win32.Foundation.ERROR_DS_DRA_EXTN_CONNECTION_FAILED -Windows.Win32.Foundation.ERROR_DS_DRA_GENERIC -Windows.Win32.Foundation.ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET -Windows.Win32.Foundation.ERROR_DS_DRA_INCONSISTENT_DIT -Windows.Win32.Foundation.ERROR_DS_DRA_INTERNAL_ERROR -Windows.Win32.Foundation.ERROR_DS_DRA_INVALID_PARAMETER -Windows.Win32.Foundation.ERROR_DS_DRA_MAIL_PROBLEM -Windows.Win32.Foundation.ERROR_DS_DRA_MISSING_KRBTGT_SECRET -Windows.Win32.Foundation.ERROR_DS_DRA_MISSING_PARENT -Windows.Win32.Foundation.ERROR_DS_DRA_NAME_COLLISION -Windows.Win32.Foundation.ERROR_DS_DRA_NO_REPLICA -Windows.Win32.Foundation.ERROR_DS_DRA_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DS_DRA_OBJ_IS_REP_SOURCE -Windows.Win32.Foundation.ERROR_DS_DRA_OBJ_NC_MISMATCH -Windows.Win32.Foundation.ERROR_DS_DRA_OUT_OF_MEM -Windows.Win32.Foundation.ERROR_DS_DRA_OUT_SCHEDULE_WINDOW -Windows.Win32.Foundation.ERROR_DS_DRA_PREEMPTED -Windows.Win32.Foundation.ERROR_DS_DRA_RECYCLED_TARGET -Windows.Win32.Foundation.ERROR_DS_DRA_REF_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_DS_DRA_REF_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_DRA_REPL_PENDING -Windows.Win32.Foundation.ERROR_DS_DRA_RPC_CANCELLED -Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_CONFLICT -Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_INFO_SHIP -Windows.Win32.Foundation.ERROR_DS_DRA_SCHEMA_MISMATCH -Windows.Win32.Foundation.ERROR_DS_DRA_SECRETS_DENIED -Windows.Win32.Foundation.ERROR_DS_DRA_SHUTDOWN -Windows.Win32.Foundation.ERROR_DS_DRA_SINK_DISABLED -Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_DISABLED -Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA -Windows.Win32.Foundation.ERROR_DS_DRA_SOURCE_REINSTALLED -Windows.Win32.Foundation.ERROR_DS_DRS_EXTENSIONS_CHANGED -Windows.Win32.Foundation.ERROR_DS_DS_REQUIRED -Windows.Win32.Foundation.ERROR_DS_DSA_MUST_BE_INT_MASTER -Windows.Win32.Foundation.ERROR_DS_DST_DOMAIN_NOT_NATIVE -Windows.Win32.Foundation.ERROR_DS_DST_NC_MISMATCH -Windows.Win32.Foundation.ERROR_DS_DUP_LDAP_DISPLAY_NAME -Windows.Win32.Foundation.ERROR_DS_DUP_LINK_ID -Windows.Win32.Foundation.ERROR_DS_DUP_MAPI_ID -Windows.Win32.Foundation.ERROR_DS_DUP_MSDS_INTID -Windows.Win32.Foundation.ERROR_DS_DUP_OID -Windows.Win32.Foundation.ERROR_DS_DUP_RDN -Windows.Win32.Foundation.ERROR_DS_DUP_SCHEMA_ID_GUID -Windows.Win32.Foundation.ERROR_DS_DUPLICATE_ID_FOUND -Windows.Win32.Foundation.ERROR_DS_ENCODING_ERROR -Windows.Win32.Foundation.ERROR_DS_EPOCH_MISMATCH -Windows.Win32.Foundation.ERROR_DS_EXISTING_AD_CHILD_NC -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_AUX_CLS -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_MAY_HAVE -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_MUST_HAVE -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_POSS_SUP -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_RDNATTID -Windows.Win32.Foundation.ERROR_DS_EXISTS_IN_SUB_CLS -Windows.Win32.Foundation.ERROR_DS_FILTER_UNKNOWN -Windows.Win32.Foundation.ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS -Windows.Win32.Foundation.ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_FOREST_VERSION_TOO_HIGH -Windows.Win32.Foundation.ERROR_DS_FOREST_VERSION_TOO_LOW -Windows.Win32.Foundation.ERROR_DS_GC_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_DS_GC_REQUIRED -Windows.Win32.Foundation.ERROR_DS_GCVERIFY_ERROR -Windows.Win32.Foundation.ERROR_DS_GENERIC_ERROR -Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER -Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_GOVERNSID_MISSING -Windows.Win32.Foundation.ERROR_DS_GROUP_CONVERSION_ERROR -Windows.Win32.Foundation.ERROR_DS_HAVE_PRIMARY_MEMBERS -Windows.Win32.Foundation.ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED -Windows.Win32.Foundation.ERROR_DS_HIERARCHY_TABLE_TOO_DEEP -Windows.Win32.Foundation.ERROR_DS_HIGH_ADLDS_FFL -Windows.Win32.Foundation.ERROR_DS_HIGH_DSA_VERSION -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_MOD_OPERATION -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_SUPERIOR -Windows.Win32.Foundation.ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION -Windows.Win32.Foundation.ERROR_DS_INAPPROPRIATE_AUTH -Windows.Win32.Foundation.ERROR_DS_INAPPROPRIATE_MATCHING -Windows.Win32.Foundation.ERROR_DS_INCOMPATIBLE_CONTROLS_USED -Windows.Win32.Foundation.ERROR_DS_INCOMPATIBLE_VERSION -Windows.Win32.Foundation.ERROR_DS_INCORRECT_ROLE_OWNER -Windows.Win32.Foundation.ERROR_DS_INIT_FAILURE -Windows.Win32.Foundation.ERROR_DS_INIT_FAILURE_CONSOLE -Windows.Win32.Foundation.ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE -Windows.Win32.Foundation.ERROR_DS_INSTALL_NO_SRC_SCH_VERSION -Windows.Win32.Foundation.ERROR_DS_INSTALL_SCHEMA_MISMATCH -Windows.Win32.Foundation.ERROR_DS_INSUFF_ACCESS_RIGHTS -Windows.Win32.Foundation.ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT -Windows.Win32.Foundation.ERROR_DS_INTERNAL_FAILURE -Windows.Win32.Foundation.ERROR_DS_INVALID_ATTRIBUTE_SYNTAX -Windows.Win32.Foundation.ERROR_DS_INVALID_DMD -Windows.Win32.Foundation.ERROR_DS_INVALID_DN_SYNTAX -Windows.Win32.Foundation.ERROR_DS_INVALID_GROUP_TYPE -Windows.Win32.Foundation.ERROR_DS_INVALID_LDAP_DISPLAY_NAME -Windows.Win32.Foundation.ERROR_DS_INVALID_NAME_FOR_SPN -Windows.Win32.Foundation.ERROR_DS_INVALID_ROLE_OWNER -Windows.Win32.Foundation.ERROR_DS_INVALID_SCRIPT -Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG -Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE -Windows.Win32.Foundation.ERROR_DS_INVALID_SEARCH_FLAG_TUPLE -Windows.Win32.Foundation.ERROR_DS_IS_LEAF -Windows.Win32.Foundation.ERROR_DS_KEY_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_LDAP_SEND_QUEUE_FULL -Windows.Win32.Foundation.ERROR_DS_LINK_ID_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_LOCAL_ERROR -Windows.Win32.Foundation.ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY -Windows.Win32.Foundation.ERROR_DS_LOOP_DETECT -Windows.Win32.Foundation.ERROR_DS_LOW_ADLDS_FFL -Windows.Win32.Foundation.ERROR_DS_LOW_DSA_VERSION -Windows.Win32.Foundation.ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 -Windows.Win32.Foundation.ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_MAPI_ID_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_DS_MASTERDSA_REQUIRED -Windows.Win32.Foundation.ERROR_DS_MAX_OBJ_SIZE_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY -Windows.Win32.Foundation.ERROR_DS_MISSING_EXPECTED_ATT -Windows.Win32.Foundation.ERROR_DS_MISSING_FOREST_TRUST -Windows.Win32.Foundation.ERROR_DS_MISSING_FSMO_SETTINGS -Windows.Win32.Foundation.ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER -Windows.Win32.Foundation.ERROR_DS_MISSING_REQUIRED_ATT -Windows.Win32.Foundation.ERROR_DS_MISSING_SUPREF -Windows.Win32.Foundation.ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG -Windows.Win32.Foundation.ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE -Windows.Win32.Foundation.ERROR_DS_MODIFYDN_WRONG_GRANDPARENT -Windows.Win32.Foundation.ERROR_DS_MUST_BE_RUN_ON_DST_DC -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_DOMAIN_ONLY -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NO_MAPPING -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_RESOLVING -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_TRUST_REFERRAL -Windows.Win32.Foundation.ERROR_DS_NAME_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_NAME_REFERENCE_INVALID -Windows.Win32.Foundation.ERROR_DS_NAME_TOO_LONG -Windows.Win32.Foundation.ERROR_DS_NAME_TOO_MANY_PARTS -Windows.Win32.Foundation.ERROR_DS_NAME_TYPE_UNKNOWN -Windows.Win32.Foundation.ERROR_DS_NAME_UNPARSEABLE -Windows.Win32.Foundation.ERROR_DS_NAME_VALUE_TOO_LONG -Windows.Win32.Foundation.ERROR_DS_NAMING_MASTER_GC -Windows.Win32.Foundation.ERROR_DS_NAMING_VIOLATION -Windows.Win32.Foundation.ERROR_DS_NC_MUST_HAVE_NC_PARENT -Windows.Win32.Foundation.ERROR_DS_NC_STILL_HAS_DSAS -Windows.Win32.Foundation.ERROR_DS_NCNAME_MISSING_CR_REF -Windows.Win32.Foundation.ERROR_DS_NCNAME_MUST_BE_NC -Windows.Win32.Foundation.ERROR_DS_NO_ATTRIBUTE_OR_VALUE -Windows.Win32.Foundation.ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_CHAINED_EVAL -Windows.Win32.Foundation.ERROR_DS_NO_CHAINING -Windows.Win32.Foundation.ERROR_DS_NO_CHECKPOINT_WITH_PDC -Windows.Win32.Foundation.ERROR_DS_NO_CROSSREF_FOR_NC -Windows.Win32.Foundation.ERROR_DS_NO_DELETED_NAME -Windows.Win32.Foundation.ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS -Windows.Win32.Foundation.ERROR_DS_NO_MORE_RIDS -Windows.Win32.Foundation.ERROR_DS_NO_MSDS_INTID -Windows.Win32.Foundation.ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_NTDSA_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC -Windows.Win32.Foundation.ERROR_DS_NO_PARENT_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION -Windows.Win32.Foundation.ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA -Windows.Win32.Foundation.ERROR_DS_NO_REF_DOMAIN -Windows.Win32.Foundation.ERROR_DS_NO_REQUESTED_ATTS_FOUND -Windows.Win32.Foundation.ERROR_DS_NO_RESULTS_RETURNED -Windows.Win32.Foundation.ERROR_DS_NO_RIDS_ALLOCATED -Windows.Win32.Foundation.ERROR_DS_NO_SERVER_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_SUCH_OBJECT -Windows.Win32.Foundation.ERROR_DS_NO_TREE_DELETE_ABOVE_NC -Windows.Win32.Foundation.ERROR_DS_NON_ASQ_SEARCH -Windows.Win32.Foundation.ERROR_DS_NON_BASE_SEARCH -Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_MAY_HAVE -Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_MUST_HAVE -Windows.Win32.Foundation.ERROR_DS_NONEXISTENT_POSS_SUP -Windows.Win32.Foundation.ERROR_DS_NONSAFE_SCHEMA_CHANGE -Windows.Win32.Foundation.ERROR_DS_NOT_AN_OBJECT -Windows.Win32.Foundation.ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC -Windows.Win32.Foundation.ERROR_DS_NOT_CLOSEST -Windows.Win32.Foundation.ERROR_DS_NOT_INSTALLED -Windows.Win32.Foundation.ERROR_DS_NOT_ON_BACKLINK -Windows.Win32.Foundation.ERROR_DS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DS_NOT_SUPPORTED_SORT_ORDER -Windows.Win32.Foundation.ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX -Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_PROCESS_ERROR -Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_SYNTAX_ERROR -Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_DEFINED -Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_SUBCLASS -Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_VIOLATION -Windows.Win32.Foundation.ERROR_DS_OBJ_GUID_EXISTS -Windows.Win32.Foundation.ERROR_DS_OBJ_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_OBJ_STRING_NAME_EXISTS -Windows.Win32.Foundation.ERROR_DS_OBJ_TOO_LARGE -Windows.Win32.Foundation.ERROR_DS_OBJECT_BEING_REMOVED -Windows.Win32.Foundation.ERROR_DS_OBJECT_CLASS_REQUIRED -Windows.Win32.Foundation.ERROR_DS_OBJECT_RESULTS_TOO_LARGE -Windows.Win32.Foundation.ERROR_DS_OFFSET_RANGE_ERROR -Windows.Win32.Foundation.ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS -Windows.Win32.Foundation.ERROR_DS_OID_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_OPERATIONS_ERROR -Windows.Win32.Foundation.ERROR_DS_OUT_OF_SCOPE -Windows.Win32.Foundation.ERROR_DS_OUT_OF_VERSION_STORE -Windows.Win32.Foundation.ERROR_DS_PARAM_ERROR -Windows.Win32.Foundation.ERROR_DS_PARENT_IS_AN_ALIAS -Windows.Win32.Foundation.ERROR_DS_PDC_OPERATION_IN_PROGRESS -Windows.Win32.Foundation.ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD -Windows.Win32.Foundation.ERROR_DS_POLICY_NOT_KNOWN -Windows.Win32.Foundation.ERROR_DS_PROTOCOL_ERROR -Windows.Win32.Foundation.ERROR_DS_RANGE_CONSTRAINT -Windows.Win32.Foundation.ERROR_DS_RDN_DOESNT_MATCH_SCHEMA -Windows.Win32.Foundation.ERROR_DS_RECALCSCHEMA_FAILED -Windows.Win32.Foundation.ERROR_DS_REFERRAL -Windows.Win32.Foundation.ERROR_DS_REFERRAL_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_REFUSING_FSMO_ROLES -Windows.Win32.Foundation.ERROR_DS_REMOTE_CROSSREF_OP_FAILED -Windows.Win32.Foundation.ERROR_DS_REPL_LIFETIME_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR -Windows.Win32.Foundation.ERROR_DS_REPLICATOR_ONLY -Windows.Win32.Foundation.ERROR_DS_RESERVED_LINK_ID -Windows.Win32.Foundation.ERROR_DS_RESERVED_MAPI_ID -Windows.Win32.Foundation.ERROR_DS_RIDMGR_DISABLED -Windows.Win32.Foundation.ERROR_DS_RIDMGR_INIT_ERROR -Windows.Win32.Foundation.ERROR_DS_ROLE_NOT_VERIFIED -Windows.Win32.Foundation.ERROR_DS_ROOT_CANT_BE_SUBREF -Windows.Win32.Foundation.ERROR_DS_ROOT_MUST_BE_NC -Windows.Win32.Foundation.ERROR_DS_ROOT_REQUIRES_CLASS_TOP -Windows.Win32.Foundation.ERROR_DS_SAM_INIT_FAILURE -Windows.Win32.Foundation.ERROR_DS_SAM_INIT_FAILURE_CONSOLE -Windows.Win32.Foundation.ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY -Windows.Win32.Foundation.ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD -Windows.Win32.Foundation.ERROR_DS_SCHEMA_ALLOC_FAILED -Windows.Win32.Foundation.ERROR_DS_SCHEMA_NOT_LOADED -Windows.Win32.Foundation.ERROR_DS_SCHEMA_UPDATE_DISALLOWED -Windows.Win32.Foundation.ERROR_DS_SEC_DESC_INVALID -Windows.Win32.Foundation.ERROR_DS_SEC_DESC_TOO_SHORT -Windows.Win32.Foundation.ERROR_DS_SECURITY_CHECKING_ERROR -Windows.Win32.Foundation.ERROR_DS_SECURITY_ILLEGAL_MODIFY -Windows.Win32.Foundation.ERROR_DS_SEMANTIC_ATT_TEST -Windows.Win32.Foundation.ERROR_DS_SENSITIVE_GROUP_VIOLATION -Windows.Win32.Foundation.ERROR_DS_SERVER_DOWN -Windows.Win32.Foundation.ERROR_DS_SHUTTING_DOWN -Windows.Win32.Foundation.ERROR_DS_SINGLE_USER_MODE_FAILED -Windows.Win32.Foundation.ERROR_DS_SINGLE_VALUE_CONSTRAINT -Windows.Win32.Foundation.ERROR_DS_SIZELIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_SORT_CONTROL_MISSING -Windows.Win32.Foundation.ERROR_DS_SOURCE_AUDITING_NOT_ENABLED -Windows.Win32.Foundation.ERROR_DS_SOURCE_DOMAIN_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_SRC_AND_DST_NC_IDENTICAL -Windows.Win32.Foundation.ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH -Windows.Win32.Foundation.ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER -Windows.Win32.Foundation.ERROR_DS_SRC_GUID_MISMATCH -Windows.Win32.Foundation.ERROR_DS_SRC_NAME_MISMATCH -Windows.Win32.Foundation.ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER -Windows.Win32.Foundation.ERROR_DS_SRC_SID_EXISTS_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_STRING_SD_CONVERSION_FAILED -Windows.Win32.Foundation.ERROR_DS_STRONG_AUTH_REQUIRED -Windows.Win32.Foundation.ERROR_DS_SUB_CLS_TEST_FAIL -Windows.Win32.Foundation.ERROR_DS_SUBREF_MUST_HAVE_PARENT -Windows.Win32.Foundation.ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD -Windows.Win32.Foundation.ERROR_DS_SYNTAX_MISMATCH -Windows.Win32.Foundation.ERROR_DS_THREAD_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_TIMELIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_DS_TREE_DELETE_NOT_FINISHED -Windows.Win32.Foundation.ERROR_DS_UNABLE_TO_SURRENDER_ROLES -Windows.Win32.Foundation.ERROR_DS_UNAVAILABLE -Windows.Win32.Foundation.ERROR_DS_UNAVAILABLE_CRIT_EXTENSION -Windows.Win32.Foundation.ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED -Windows.Win32.Foundation.ERROR_DS_UNICODEPWD_NOT_IN_QUOTES -Windows.Win32.Foundation.ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER -Windows.Win32.Foundation.ERROR_DS_UNKNOWN_ERROR -Windows.Win32.Foundation.ERROR_DS_UNKNOWN_OPERATION -Windows.Win32.Foundation.ERROR_DS_UNWILLING_TO_PERFORM -Windows.Win32.Foundation.ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST -Windows.Win32.Foundation.ERROR_DS_USER_BUFFER_TO_SMALL -Windows.Win32.Foundation.ERROR_DS_VALUE_KEY_NOT_UNIQUE -Windows.Win32.Foundation.ERROR_DS_VERSION_CHECK_FAILURE -Windows.Win32.Foundation.ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL -Windows.Win32.Foundation.ERROR_DS_WRONG_LINKED_ATT_SYNTAX -Windows.Win32.Foundation.ERROR_DS_WRONG_OM_OBJ_CLASS -Windows.Win32.Foundation.ERROR_DUP_DOMAINNAME -Windows.Win32.Foundation.ERROR_DUP_NAME -Windows.Win32.Foundation.ERROR_DUPLICATE_PRIVILEGES -Windows.Win32.Foundation.ERROR_DUPLICATE_SERVICE_NAME -Windows.Win32.Foundation.ERROR_DYNAMIC_CODE_BLOCKED -Windows.Win32.Foundation.ERROR_DYNLINK_FROM_INVALID_RING -Windows.Win32.Foundation.ERROR_EA_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_EA_FILE_CORRUPT -Windows.Win32.Foundation.ERROR_EA_LIST_INCONSISTENT -Windows.Win32.Foundation.ERROR_EA_TABLE_FULL -Windows.Win32.Foundation.ERROR_EAS_DIDNT_FIT -Windows.Win32.Foundation.ERROR_EAS_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED -Windows.Win32.Foundation.ERROR_EDP_POLICY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_EFS_ALG_BLOB_TOO_BIG -Windows.Win32.Foundation.ERROR_EFS_DISABLED -Windows.Win32.Foundation.ERROR_EFS_SERVER_NOT_TRUSTED -Windows.Win32.Foundation.ERROR_EFS_VERSION_NOT_SUPPORT -Windows.Win32.Foundation.ERROR_ELEVATION_REQUIRED -Windows.Win32.Foundation.ERROR_ENCLAVE_FAILURE -Windows.Win32.Foundation.ERROR_ENCLAVE_NOT_TERMINATED -Windows.Win32.Foundation.ERROR_ENCLAVE_VIOLATION -Windows.Win32.Foundation.ERROR_ENCRYPTED_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_ENCRYPTED_IO_NOT_POSSIBLE -Windows.Win32.Foundation.ERROR_ENCRYPTING_METADATA_DISALLOWED -Windows.Win32.Foundation.ERROR_ENCRYPTION_DISABLED -Windows.Win32.Foundation.ERROR_ENCRYPTION_FAILED -Windows.Win32.Foundation.ERROR_ENCRYPTION_POLICY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_END_OF_MEDIA -Windows.Win32.Foundation.ERROR_ENVVAR_NOT_FOUND -Windows.Win32.Foundation.ERROR_EOM_OVERFLOW -Windows.Win32.Foundation.ERROR_ERRORS_ENCOUNTERED -Windows.Win32.Foundation.ERROR_EVALUATION_EXPIRATION -Windows.Win32.Foundation.ERROR_EVENT_DONE -Windows.Win32.Foundation.ERROR_EVENT_PENDING -Windows.Win32.Foundation.ERROR_EVENTLOG_CANT_START -Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CHANGED -Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CORRUPT -Windows.Win32.Foundation.ERROR_EXCEPTION_IN_SERVICE -Windows.Win32.Foundation.ERROR_EXCL_SEM_ALREADY_OWNED -Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY -Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY -Windows.Win32.Foundation.ERROR_EXE_MACHINE_TYPE_MISMATCH -Windows.Win32.Foundation.ERROR_EXE_MARKED_INVALID -Windows.Win32.Foundation.ERROR_EXTENDED_ERROR -Windows.Win32.Foundation.ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN -Windows.Win32.Foundation.ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_EXTRANEOUS_INFORMATION -Windows.Win32.Foundation.ERROR_FAIL_FAST_EXCEPTION -Windows.Win32.Foundation.ERROR_FAIL_I24 -Windows.Win32.Foundation.ERROR_FAIL_NOACTION_REBOOT -Windows.Win32.Foundation.ERROR_FAIL_RESTART -Windows.Win32.Foundation.ERROR_FAIL_SHUTDOWN -Windows.Win32.Foundation.ERROR_FAILED_DRIVER_ENTRY -Windows.Win32.Foundation.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT -Windows.Win32.Foundation.ERROR_FATAL_APP_EXIT -Windows.Win32.Foundation.ERROR_FILE_CHECKED_OUT -Windows.Win32.Foundation.ERROR_FILE_CORRUPT -Windows.Win32.Foundation.ERROR_FILE_ENCRYPTED -Windows.Win32.Foundation.ERROR_FILE_EXISTS -Windows.Win32.Foundation.ERROR_FILE_HANDLE_REVOKED -Windows.Win32.Foundation.ERROR_FILE_INVALID -Windows.Win32.Foundation.ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS -Windows.Win32.Foundation.ERROR_FILE_NOT_ENCRYPTED -Windows.Win32.Foundation.ERROR_FILE_NOT_FOUND -Windows.Win32.Foundation.ERROR_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_OFFLINE -Windows.Win32.Foundation.ERROR_FILE_PROTECTED_UNDER_DPL -Windows.Win32.Foundation.ERROR_FILE_READ_ONLY -Windows.Win32.Foundation.ERROR_FILE_SNAP_IN_PROGRESS -Windows.Win32.Foundation.ERROR_FILE_SNAP_INVALID_PARAMETER -Windows.Win32.Foundation.ERROR_FILE_SNAP_IO_NOT_COORDINATED -Windows.Win32.Foundation.ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_SNAP_UNEXPECTED_ERROR -Windows.Win32.Foundation.ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_LIMITATION -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN -Windows.Win32.Foundation.ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE -Windows.Win32.Foundation.ERROR_FILE_TOO_LARGE -Windows.Win32.Foundation.ERROR_FILEMARK_DETECTED -Windows.Win32.Foundation.ERROR_FILENAME_EXCED_RANGE -Windows.Win32.Foundation.ERROR_FIRMWARE_UPDATED -Windows.Win32.Foundation.ERROR_FLOAT_MULTIPLE_FAULTS -Windows.Win32.Foundation.ERROR_FLOAT_MULTIPLE_TRAPS -Windows.Win32.Foundation.ERROR_FLOPPY_BAD_REGISTERS -Windows.Win32.Foundation.ERROR_FLOPPY_ID_MARK_NOT_FOUND -Windows.Win32.Foundation.ERROR_FLOPPY_UNKNOWN_ERROR -Windows.Win32.Foundation.ERROR_FLOPPY_VOLUME -Windows.Win32.Foundation.ERROR_FLOPPY_WRONG_CYLINDER -Windows.Win32.Foundation.ERROR_FORMS_AUTH_REQUIRED -Windows.Win32.Foundation.ERROR_FOUND_OUT_OF_SCOPE -Windows.Win32.Foundation.ERROR_FS_DRIVER_REQUIRED -Windows.Win32.Foundation.ERROR_FS_METADATA_INCONSISTENT -Windows.Win32.Foundation.ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY -Windows.Win32.Foundation.ERROR_FT_DI_SCAN_REQUIRED -Windows.Win32.Foundation.ERROR_FT_READ_FAILURE -Windows.Win32.Foundation.ERROR_FT_READ_FROM_COPY_FAILURE -Windows.Win32.Foundation.ERROR_FT_READ_RECOVERY_FROM_BACKUP -Windows.Win32.Foundation.ERROR_FT_WRITE_FAILURE -Windows.Win32.Foundation.ERROR_FT_WRITE_RECOVERY -Windows.Win32.Foundation.ERROR_FULLSCREEN_MODE -Windows.Win32.Foundation.ERROR_FUNCTION_FAILED -Windows.Win32.Foundation.ERROR_FUNCTION_NOT_CALLED -Windows.Win32.Foundation.ERROR_GDI_HANDLE_LEAK -Windows.Win32.Foundation.ERROR_GEN_FAILURE -Windows.Win32.Foundation.ERROR_GENERIC_NOT_MAPPED -Windows.Win32.Foundation.ERROR_GLOBAL_ONLY_HOOK -Windows.Win32.Foundation.ERROR_GRACEFUL_DISCONNECT -Windows.Win32.Foundation.ERROR_GROUP_EXISTS -Windows.Win32.Foundation.ERROR_GUID_SUBSTITUTION_MADE -Windows.Win32.Foundation.ERROR_HANDLE_DISK_FULL -Windows.Win32.Foundation.ERROR_HANDLE_EOF -Windows.Win32.Foundation.ERROR_HANDLE_REVOKED -Windows.Win32.Foundation.ERROR_HANDLES_CLOSED -Windows.Win32.Foundation.ERROR_HAS_SYSTEM_CRITICAL_FILES -Windows.Win32.Foundation.ERROR_HIBERNATED -Windows.Win32.Foundation.ERROR_HIBERNATION_FAILURE -Windows.Win32.Foundation.ERROR_HOOK_NEEDS_HMOD -Windows.Win32.Foundation.ERROR_HOOK_NOT_INSTALLED -Windows.Win32.Foundation.ERROR_HOOK_TYPE_NOT_ALLOWED -Windows.Win32.Foundation.ERROR_HOST_DOWN -Windows.Win32.Foundation.ERROR_HOST_UNREACHABLE -Windows.Win32.Foundation.ERROR_HOTKEY_ALREADY_REGISTERED -Windows.Win32.Foundation.ERROR_HOTKEY_NOT_REGISTERED -Windows.Win32.Foundation.ERROR_HWNDS_HAVE_DIFF_PARENT -Windows.Win32.Foundation.ERROR_ILL_FORMED_PASSWORD -Windows.Win32.Foundation.ERROR_ILLEGAL_CHARACTER -Windows.Win32.Foundation.ERROR_ILLEGAL_DLL_RELOCATION -Windows.Win32.Foundation.ERROR_ILLEGAL_ELEMENT_ADDRESS -Windows.Win32.Foundation.ERROR_ILLEGAL_FLOAT_CONTEXT -Windows.Win32.Foundation.ERROR_IMAGE_AT_DIFFERENT_BASE -Windows.Win32.Foundation.ERROR_IMAGE_MACHINE_TYPE_MISMATCH -Windows.Win32.Foundation.ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE -Windows.Win32.Foundation.ERROR_IMAGE_NOT_AT_BASE -Windows.Win32.Foundation.ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT -Windows.Win32.Foundation.ERROR_IMPLEMENTATION_LIMIT -Windows.Win32.Foundation.ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE -Windows.Win32.Foundation.ERROR_INCOMPATIBLE_SERVICE_SID_TYPE -Windows.Win32.Foundation.ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING -Windows.Win32.Foundation.ERROR_INCORRECT_ACCOUNT_TYPE -Windows.Win32.Foundation.ERROR_INCORRECT_ADDRESS -Windows.Win32.Foundation.ERROR_INCORRECT_SIZE -Windows.Win32.Foundation.ERROR_INDEX_ABSENT -Windows.Win32.Foundation.ERROR_INDEX_OUT_OF_BOUNDS -Windows.Win32.Foundation.ERROR_INFLOOP_IN_RELOC_CHAIN -Windows.Win32.Foundation.ERROR_INSTALL_ALREADY_RUNNING -Windows.Win32.Foundation.ERROR_INSTALL_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_LANGUAGE_UNSUPPORTED -Windows.Win32.Foundation.ERROR_INSTALL_LOG_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_NOTUSED -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_INVALID -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_OPEN_FAILED -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_REJECTED -Windows.Win32.Foundation.ERROR_INSTALL_PACKAGE_VERSION -Windows.Win32.Foundation.ERROR_INSTALL_PLATFORM_UNSUPPORTED -Windows.Win32.Foundation.ERROR_INSTALL_REJECTED -Windows.Win32.Foundation.ERROR_INSTALL_REMOTE_DISALLOWED -Windows.Win32.Foundation.ERROR_INSTALL_REMOTE_PROHIBITED -Windows.Win32.Foundation.ERROR_INSTALL_SERVICE_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_SERVICE_SAFEBOOT -Windows.Win32.Foundation.ERROR_INSTALL_SOURCE_ABSENT -Windows.Win32.Foundation.ERROR_INSTALL_SUSPEND -Windows.Win32.Foundation.ERROR_INSTALL_TEMP_UNWRITABLE -Windows.Win32.Foundation.ERROR_INSTALL_TRANSFORM_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_TRANSFORM_REJECTED -Windows.Win32.Foundation.ERROR_INSTALL_UI_FAILURE -Windows.Win32.Foundation.ERROR_INSTALL_USEREXIT -Windows.Win32.Foundation.ERROR_INSTRUCTION_MISALIGNMENT -Windows.Win32.Foundation.ERROR_INSUFFICIENT_BUFFER -Windows.Win32.Foundation.ERROR_INSUFFICIENT_LOGON_INFO -Windows.Win32.Foundation.ERROR_INSUFFICIENT_POWER -Windows.Win32.Foundation.ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE -Windows.Win32.Foundation.ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES -Windows.Win32.Foundation.ERROR_INTERMIXED_KERNEL_EA_OPERATION -Windows.Win32.Foundation.ERROR_INTERNAL_DB_CORRUPTION -Windows.Win32.Foundation.ERROR_INTERNAL_DB_ERROR -Windows.Win32.Foundation.ERROR_INTERNAL_ERROR -Windows.Win32.Foundation.ERROR_INTERRUPT_STILL_CONNECTED -Windows.Win32.Foundation.ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED -Windows.Win32.Foundation.ERROR_INVALID_ACCEL_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_ACCESS -Windows.Win32.Foundation.ERROR_INVALID_ACCOUNT_NAME -Windows.Win32.Foundation.ERROR_INVALID_ACE_CONDITION -Windows.Win32.Foundation.ERROR_INVALID_ACL -Windows.Win32.Foundation.ERROR_INVALID_ADDRESS -Windows.Win32.Foundation.ERROR_INVALID_AT_INTERRUPT_TIME -Windows.Win32.Foundation.ERROR_INVALID_BLOCK -Windows.Win32.Foundation.ERROR_INVALID_BLOCK_LENGTH -Windows.Win32.Foundation.ERROR_INVALID_CAP -Windows.Win32.Foundation.ERROR_INVALID_CATEGORY -Windows.Win32.Foundation.ERROR_INVALID_COMBOBOX_MESSAGE -Windows.Win32.Foundation.ERROR_INVALID_COMMAND_LINE -Windows.Win32.Foundation.ERROR_INVALID_COMPUTERNAME -Windows.Win32.Foundation.ERROR_INVALID_CRUNTIME_PARAMETER -Windows.Win32.Foundation.ERROR_INVALID_CURSOR_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_DATA -Windows.Win32.Foundation.ERROR_INVALID_DATATYPE -Windows.Win32.Foundation.ERROR_INVALID_DEVICE_OBJECT_PARAMETER -Windows.Win32.Foundation.ERROR_INVALID_DLL -Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_ROLE -Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_STATE -Windows.Win32.Foundation.ERROR_INVALID_DOMAINNAME -Windows.Win32.Foundation.ERROR_INVALID_DRIVE -Windows.Win32.Foundation.ERROR_INVALID_DWP_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_EA_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_EA_NAME -Windows.Win32.Foundation.ERROR_INVALID_EDIT_HEIGHT -Windows.Win32.Foundation.ERROR_INVALID_ENVIRONMENT -Windows.Win32.Foundation.ERROR_INVALID_EVENT_COUNT -Windows.Win32.Foundation.ERROR_INVALID_EVENTNAME -Windows.Win32.Foundation.ERROR_INVALID_EXCEPTION_HANDLER -Windows.Win32.Foundation.ERROR_INVALID_EXE_SIGNATURE -Windows.Win32.Foundation.ERROR_INVALID_FIELD -Windows.Win32.Foundation.ERROR_INVALID_FIELD_IN_PARAMETER_LIST -Windows.Win32.Foundation.ERROR_INVALID_FILTER_PROC -Windows.Win32.Foundation.ERROR_INVALID_FLAG_NUMBER -Windows.Win32.Foundation.ERROR_INVALID_FLAGS -Windows.Win32.Foundation.ERROR_INVALID_FORM_NAME -Windows.Win32.Foundation.ERROR_INVALID_FORM_SIZE -Windows.Win32.Foundation.ERROR_INVALID_FUNCTION -Windows.Win32.Foundation.ERROR_INVALID_GROUP_ATTRIBUTES -Windows.Win32.Foundation.ERROR_INVALID_GROUPNAME -Windows.Win32.Foundation.ERROR_INVALID_GW_COMMAND -Windows.Win32.Foundation.ERROR_INVALID_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_HANDLE_STATE -Windows.Win32.Foundation.ERROR_INVALID_HOOK_FILTER -Windows.Win32.Foundation.ERROR_INVALID_HOOK_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_HW_PROFILE -Windows.Win32.Foundation.ERROR_INVALID_ICON_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_ID_AUTHORITY -Windows.Win32.Foundation.ERROR_INVALID_IMAGE_HASH -Windows.Win32.Foundation.ERROR_INVALID_IMPORT_OF_NON_DLL -Windows.Win32.Foundation.ERROR_INVALID_INDEX -Windows.Win32.Foundation.ERROR_INVALID_KERNEL_INFO_VERSION -Windows.Win32.Foundation.ERROR_INVALID_KEYBOARD_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_LABEL -Windows.Win32.Foundation.ERROR_INVALID_LB_MESSAGE -Windows.Win32.Foundation.ERROR_INVALID_LDT_DESCRIPTOR -Windows.Win32.Foundation.ERROR_INVALID_LDT_OFFSET -Windows.Win32.Foundation.ERROR_INVALID_LDT_SIZE -Windows.Win32.Foundation.ERROR_INVALID_LEVEL -Windows.Win32.Foundation.ERROR_INVALID_LIST_FORMAT -Windows.Win32.Foundation.ERROR_INVALID_LOCK_RANGE -Windows.Win32.Foundation.ERROR_INVALID_LOGON_HOURS -Windows.Win32.Foundation.ERROR_INVALID_LOGON_TYPE -Windows.Win32.Foundation.ERROR_INVALID_MEMBER -Windows.Win32.Foundation.ERROR_INVALID_MENU_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_MESSAGE -Windows.Win32.Foundation.ERROR_INVALID_MESSAGEDEST -Windows.Win32.Foundation.ERROR_INVALID_MESSAGENAME -Windows.Win32.Foundation.ERROR_INVALID_MINALLOCSIZE -Windows.Win32.Foundation.ERROR_INVALID_MODULETYPE -Windows.Win32.Foundation.ERROR_INVALID_MONITOR_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_MSGBOX_STYLE -Windows.Win32.Foundation.ERROR_INVALID_NAME -Windows.Win32.Foundation.ERROR_INVALID_NETNAME -Windows.Win32.Foundation.ERROR_INVALID_OPLOCK_PROTOCOL -Windows.Win32.Foundation.ERROR_INVALID_ORDINAL -Windows.Win32.Foundation.ERROR_INVALID_OWNER -Windows.Win32.Foundation.ERROR_INVALID_PACKAGE_SID_LENGTH -Windows.Win32.Foundation.ERROR_INVALID_PARAMETER -Windows.Win32.Foundation.ERROR_INVALID_PASSWORD -Windows.Win32.Foundation.ERROR_INVALID_PASSWORDNAME -Windows.Win32.Foundation.ERROR_INVALID_PATCH_XML -Windows.Win32.Foundation.ERROR_INVALID_PEP_INFO_VERSION -Windows.Win32.Foundation.ERROR_INVALID_PLUGPLAY_DEVICE_PATH -Windows.Win32.Foundation.ERROR_INVALID_PORT_ATTRIBUTES -Windows.Win32.Foundation.ERROR_INVALID_PRIMARY_GROUP -Windows.Win32.Foundation.ERROR_INVALID_PRINTER_COMMAND -Windows.Win32.Foundation.ERROR_INVALID_PRINTER_NAME -Windows.Win32.Foundation.ERROR_INVALID_PRINTER_STATE -Windows.Win32.Foundation.ERROR_INVALID_PRIORITY -Windows.Win32.Foundation.ERROR_INVALID_QUOTA_LOWER -Windows.Win32.Foundation.ERROR_INVALID_REPARSE_DATA -Windows.Win32.Foundation.ERROR_INVALID_SCROLLBAR_RANGE -Windows.Win32.Foundation.ERROR_INVALID_SECURITY_DESCR -Windows.Win32.Foundation.ERROR_INVALID_SEGDPL -Windows.Win32.Foundation.ERROR_INVALID_SEGMENT_NUMBER -Windows.Win32.Foundation.ERROR_INVALID_SEPARATOR_FILE -Windows.Win32.Foundation.ERROR_INVALID_SERVER_STATE -Windows.Win32.Foundation.ERROR_INVALID_SERVICE_ACCOUNT -Windows.Win32.Foundation.ERROR_INVALID_SERVICE_CONTROL -Windows.Win32.Foundation.ERROR_INVALID_SERVICE_LOCK -Windows.Win32.Foundation.ERROR_INVALID_SERVICENAME -Windows.Win32.Foundation.ERROR_INVALID_SHARENAME -Windows.Win32.Foundation.ERROR_INVALID_SHOWWIN_COMMAND -Windows.Win32.Foundation.ERROR_INVALID_SID -Windows.Win32.Foundation.ERROR_INVALID_SIGNAL_NUMBER -Windows.Win32.Foundation.ERROR_INVALID_SPI_VALUE -Windows.Win32.Foundation.ERROR_INVALID_STACKSEG -Windows.Win32.Foundation.ERROR_INVALID_STARTING_CODESEG -Windows.Win32.Foundation.ERROR_INVALID_SUB_AUTHORITY -Windows.Win32.Foundation.ERROR_INVALID_TABLE -Windows.Win32.Foundation.ERROR_INVALID_TARGET_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_TASK_INDEX -Windows.Win32.Foundation.ERROR_INVALID_TASK_NAME -Windows.Win32.Foundation.ERROR_INVALID_THREAD_ID -Windows.Win32.Foundation.ERROR_INVALID_TIME -Windows.Win32.Foundation.ERROR_INVALID_TOKEN -Windows.Win32.Foundation.ERROR_INVALID_UNWIND_TARGET -Windows.Win32.Foundation.ERROR_INVALID_USER_BUFFER -Windows.Win32.Foundation.ERROR_INVALID_USER_PRINCIPAL_NAME -Windows.Win32.Foundation.ERROR_INVALID_VARIANT -Windows.Win32.Foundation.ERROR_INVALID_VERIFY_SWITCH -Windows.Win32.Foundation.ERROR_INVALID_WINDOW_HANDLE -Windows.Win32.Foundation.ERROR_INVALID_WORKSTATION -Windows.Win32.Foundation.ERROR_IO_DEVICE -Windows.Win32.Foundation.ERROR_IO_INCOMPLETE -Windows.Win32.Foundation.ERROR_IO_PENDING -Windows.Win32.Foundation.ERROR_IO_PRIVILEGE_FAILED -Windows.Win32.Foundation.ERROR_IO_REISSUE_AS_CACHED -Windows.Win32.Foundation.ERROR_IOPL_NOT_ENABLED -Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT1 -Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT2 -Windows.Win32.Foundation.ERROR_IPSEC_IKE_TIMED_OUT -Windows.Win32.Foundation.ERROR_IRQ_BUSY -Windows.Win32.Foundation.ERROR_IS_JOIN_PATH -Windows.Win32.Foundation.ERROR_IS_JOIN_TARGET -Windows.Win32.Foundation.ERROR_IS_JOINED -Windows.Win32.Foundation.ERROR_IS_SUBST_PATH -Windows.Win32.Foundation.ERROR_IS_SUBST_TARGET -Windows.Win32.Foundation.ERROR_IS_SUBSTED -Windows.Win32.Foundation.ERROR_ITERATED_DATA_EXCEEDS_64k -Windows.Win32.Foundation.ERROR_JOB_NO_CONTAINER -Windows.Win32.Foundation.ERROR_JOIN_TO_JOIN -Windows.Win32.Foundation.ERROR_JOIN_TO_SUBST -Windows.Win32.Foundation.ERROR_JOURNAL_DELETE_IN_PROGRESS -Windows.Win32.Foundation.ERROR_JOURNAL_ENTRY_DELETED -Windows.Win32.Foundation.ERROR_JOURNAL_HOOK_SET -Windows.Win32.Foundation.ERROR_JOURNAL_NOT_ACTIVE -Windows.Win32.Foundation.ERROR_KERNEL_APC -Windows.Win32.Foundation.ERROR_KEY_DELETED -Windows.Win32.Foundation.ERROR_KEY_HAS_CHILDREN -Windows.Win32.Foundation.ERROR_KM_DRIVER_BLOCKED -Windows.Win32.Foundation.ERROR_LABEL_TOO_LONG -Windows.Win32.Foundation.ERROR_LAST_ADMIN -Windows.Win32.Foundation.ERROR_LB_WITHOUT_TABSTOPS -Windows.Win32.Foundation.ERROR_LICENSE_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_LINUX_SUBSYSTEM_NOT_PRESENT -Windows.Win32.Foundation.ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED -Windows.Win32.Foundation.ERROR_LISTBOX_ID_NOT_FOUND -Windows.Win32.Foundation.ERROR_LM_CROSS_ENCRYPTION_REQUIRED -Windows.Win32.Foundation.ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_LOCAL_USER_SESSION_KEY -Windows.Win32.Foundation.ERROR_LOCK_FAILED -Windows.Win32.Foundation.ERROR_LOCK_VIOLATION -Windows.Win32.Foundation.ERROR_LOCKED -Windows.Win32.Foundation.ERROR_LOG_FILE_FULL -Windows.Win32.Foundation.ERROR_LOG_HARD_ERROR -Windows.Win32.Foundation.ERROR_LOGIN_TIME_RESTRICTION -Windows.Win32.Foundation.ERROR_LOGIN_WKSTA_RESTRICTION -Windows.Win32.Foundation.ERROR_LOGON_FAILURE -Windows.Win32.Foundation.ERROR_LOGON_NOT_GRANTED -Windows.Win32.Foundation.ERROR_LOGON_SERVER_CONFLICT -Windows.Win32.Foundation.ERROR_LOGON_SESSION_COLLISION -Windows.Win32.Foundation.ERROR_LOGON_SESSION_EXISTS -Windows.Win32.Foundation.ERROR_LOGON_TYPE_NOT_GRANTED -Windows.Win32.Foundation.ERROR_LONGJUMP -Windows.Win32.Foundation.ERROR_LOST_MODE_LOGON_RESTRICTION -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED -Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR -Windows.Win32.Foundation.ERROR_LUIDS_EXHAUSTED -Windows.Win32.Foundation.ERROR_MACHINE_LOCKED -Windows.Win32.Foundation.ERROR_MAGAZINE_NOT_PRESENT -Windows.Win32.Foundation.ERROR_MAPPED_ALIGNMENT -Windows.Win32.Foundation.ERROR_MARKED_TO_DISALLOW_WRITES -Windows.Win32.Foundation.ERROR_MARSHALL_OVERFLOW -Windows.Win32.Foundation.ERROR_MAX_SESSIONS_REACHED -Windows.Win32.Foundation.ERROR_MAX_THRDS_REACHED -Windows.Win32.Foundation.ERROR_MCA_EXCEPTION -Windows.Win32.Foundation.ERROR_MCA_OCCURED -Windows.Win32.Foundation.ERROR_MEDIA_CHANGED -Windows.Win32.Foundation.ERROR_MEDIA_CHECK -Windows.Win32.Foundation.ERROR_MEMBER_IN_ALIAS -Windows.Win32.Foundation.ERROR_MEMBER_IN_GROUP -Windows.Win32.Foundation.ERROR_MEMBER_NOT_IN_ALIAS -Windows.Win32.Foundation.ERROR_MEMBER_NOT_IN_GROUP -Windows.Win32.Foundation.ERROR_MEMBERS_PRIMARY_GROUP -Windows.Win32.Foundation.ERROR_MEMORY_HARDWARE -Windows.Win32.Foundation.ERROR_MENU_ITEM_NOT_FOUND -Windows.Win32.Foundation.ERROR_MESSAGE_SYNC_ONLY -Windows.Win32.Foundation.ERROR_META_EXPANSION_TOO_LONG -Windows.Win32.Foundation.ERROR_MISSING_SYSTEMFILE -Windows.Win32.Foundation.ERROR_MOD_NOT_FOUND -Windows.Win32.Foundation.ERROR_MORE_DATA -Windows.Win32.Foundation.ERROR_MORE_WRITES -Windows.Win32.Foundation.ERROR_MOUNT_POINT_NOT_RESOLVED -Windows.Win32.Foundation.ERROR_MP_PROCESSOR_MISMATCH -Windows.Win32.Foundation.ERROR_MR_MID_NOT_FOUND -Windows.Win32.Foundation.ERROR_MULTIPLE_FAULT_VIOLATION -Windows.Win32.Foundation.ERROR_MUTANT_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_MUTUAL_AUTH_FAILED -Windows.Win32.Foundation.ERROR_NEGATIVE_SEEK -Windows.Win32.Foundation.ERROR_NESTING_NOT_ALLOWED -Windows.Win32.Foundation.ERROR_NET_OPEN_FAILED -Windows.Win32.Foundation.ERROR_NET_WRITE_FAULT -Windows.Win32.Foundation.ERROR_NETLOGON_NOT_STARTED -Windows.Win32.Foundation.ERROR_NETNAME_DELETED -Windows.Win32.Foundation.ERROR_NETWORK_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_NETWORK_ACCESS_DENIED_EDP -Windows.Win32.Foundation.ERROR_NETWORK_BUSY -Windows.Win32.Foundation.ERROR_NETWORK_UNREACHABLE -Windows.Win32.Foundation.ERROR_NO_ACE_CONDITION -Windows.Win32.Foundation.ERROR_NO_ASSOCIATION -Windows.Win32.Foundation.ERROR_NO_BYPASSIO_DRIVER_SUPPORT -Windows.Win32.Foundation.ERROR_NO_CALLBACK_ACTIVE -Windows.Win32.Foundation.ERROR_NO_DATA -Windows.Win32.Foundation.ERROR_NO_DATA_DETECTED -Windows.Win32.Foundation.ERROR_NO_EFS -Windows.Win32.Foundation.ERROR_NO_EVENT_PAIR -Windows.Win32.Foundation.ERROR_NO_GUID_TRANSLATION -Windows.Win32.Foundation.ERROR_NO_IMPERSONATION_TOKEN -Windows.Win32.Foundation.ERROR_NO_INHERITANCE -Windows.Win32.Foundation.ERROR_NO_LOG_SPACE -Windows.Win32.Foundation.ERROR_NO_LOGON_SERVERS -Windows.Win32.Foundation.ERROR_NO_MATCH -Windows.Win32.Foundation.ERROR_NO_MEDIA_IN_DRIVE -Windows.Win32.Foundation.ERROR_NO_MORE_DEVICES -Windows.Win32.Foundation.ERROR_NO_MORE_FILES -Windows.Win32.Foundation.ERROR_NO_MORE_ITEMS -Windows.Win32.Foundation.ERROR_NO_MORE_MATCHES -Windows.Win32.Foundation.ERROR_NO_MORE_SEARCH_HANDLES -Windows.Win32.Foundation.ERROR_NO_MORE_USER_HANDLES -Windows.Win32.Foundation.ERROR_NO_NET_OR_BAD_PATH -Windows.Win32.Foundation.ERROR_NO_NETWORK -Windows.Win32.Foundation.ERROR_NO_NVRAM_RESOURCES -Windows.Win32.Foundation.ERROR_NO_PAGEFILE -Windows.Win32.Foundation.ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND -Windows.Win32.Foundation.ERROR_NO_PROC_SLOTS -Windows.Win32.Foundation.ERROR_NO_PROMOTION_ACTIVE -Windows.Win32.Foundation.ERROR_NO_QUOTAS_FOR_ACCOUNT -Windows.Win32.Foundation.ERROR_NO_RANGES_PROCESSED -Windows.Win32.Foundation.ERROR_NO_RECOVERY_POLICY -Windows.Win32.Foundation.ERROR_NO_RECOVERY_PROGRAM -Windows.Win32.Foundation.ERROR_NO_SCROLLBARS -Windows.Win32.Foundation.ERROR_NO_SECRETS -Windows.Win32.Foundation.ERROR_NO_SECURITY_ON_OBJECT -Windows.Win32.Foundation.ERROR_NO_SHUTDOWN_IN_PROGRESS -Windows.Win32.Foundation.ERROR_NO_SIGNAL_SENT -Windows.Win32.Foundation.ERROR_NO_SITE_SETTINGS_OBJECT -Windows.Win32.Foundation.ERROR_NO_SITENAME -Windows.Win32.Foundation.ERROR_NO_SPOOL_SPACE -Windows.Win32.Foundation.ERROR_NO_SUCH_ALIAS -Windows.Win32.Foundation.ERROR_NO_SUCH_DEVICE -Windows.Win32.Foundation.ERROR_NO_SUCH_DOMAIN -Windows.Win32.Foundation.ERROR_NO_SUCH_GROUP -Windows.Win32.Foundation.ERROR_NO_SUCH_LOGON_SESSION -Windows.Win32.Foundation.ERROR_NO_SUCH_MEMBER -Windows.Win32.Foundation.ERROR_NO_SUCH_PACKAGE -Windows.Win32.Foundation.ERROR_NO_SUCH_PRIVILEGE -Windows.Win32.Foundation.ERROR_NO_SUCH_SITE -Windows.Win32.Foundation.ERROR_NO_SUCH_USER -Windows.Win32.Foundation.ERROR_NO_SYSTEM_MENU -Windows.Win32.Foundation.ERROR_NO_SYSTEM_RESOURCES -Windows.Win32.Foundation.ERROR_NO_TASK_QUEUE -Windows.Win32.Foundation.ERROR_NO_TOKEN -Windows.Win32.Foundation.ERROR_NO_TRACKING_SERVICE -Windows.Win32.Foundation.ERROR_NO_TRUST_LSA_SECRET -Windows.Win32.Foundation.ERROR_NO_TRUST_SAM_ACCOUNT -Windows.Win32.Foundation.ERROR_NO_UNICODE_TRANSLATION -Windows.Win32.Foundation.ERROR_NO_USER_KEYS -Windows.Win32.Foundation.ERROR_NO_USER_SESSION_KEY -Windows.Win32.Foundation.ERROR_NO_VOLUME_ID -Windows.Win32.Foundation.ERROR_NO_VOLUME_LABEL -Windows.Win32.Foundation.ERROR_NO_WILDCARD_CHARACTERS -Windows.Win32.Foundation.ERROR_NO_WORK_DONE -Windows.Win32.Foundation.ERROR_NO_WRITABLE_DC_FOUND -Windows.Win32.Foundation.ERROR_NO_YIELD_PERFORMED -Windows.Win32.Foundation.ERROR_NOACCESS -Windows.Win32.Foundation.ERROR_NOINTERFACE -Windows.Win32.Foundation.ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT -Windows.Win32.Foundation.ERROR_NOLOGON_SERVER_TRUST_ACCOUNT -Windows.Win32.Foundation.ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT -Windows.Win32.Foundation.ERROR_NON_ACCOUNT_SID -Windows.Win32.Foundation.ERROR_NON_DOMAIN_SID -Windows.Win32.Foundation.ERROR_NON_MDICHILD_WINDOW -Windows.Win32.Foundation.ERROR_NONE_MAPPED -Windows.Win32.Foundation.ERROR_NONPAGED_SYSTEM_RESOURCES -Windows.Win32.Foundation.ERROR_NOT_A_CLOUD_FILE -Windows.Win32.Foundation.ERROR_NOT_A_CLOUD_SYNC_ROOT -Windows.Win32.Foundation.ERROR_NOT_A_DAX_VOLUME -Windows.Win32.Foundation.ERROR_NOT_A_REPARSE_POINT -Windows.Win32.Foundation.ERROR_NOT_ALL_ASSIGNED -Windows.Win32.Foundation.ERROR_NOT_ALLOWED_ON_SYSTEM_FILE -Windows.Win32.Foundation.ERROR_NOT_APPCONTAINER -Windows.Win32.Foundation.ERROR_NOT_AUTHENTICATED -Windows.Win32.Foundation.ERROR_NOT_CAPABLE -Windows.Win32.Foundation.ERROR_NOT_CHILD_WINDOW -Windows.Win32.Foundation.ERROR_NOT_CONNECTED -Windows.Win32.Foundation.ERROR_NOT_CONTAINER -Windows.Win32.Foundation.ERROR_NOT_DAX_MAPPABLE -Windows.Win32.Foundation.ERROR_NOT_DOS_DISK -Windows.Win32.Foundation.ERROR_NOT_ENOUGH_MEMORY -Windows.Win32.Foundation.ERROR_NOT_ENOUGH_QUOTA -Windows.Win32.Foundation.ERROR_NOT_ENOUGH_SERVER_MEMORY -Windows.Win32.Foundation.ERROR_NOT_EXPORT_FORMAT -Windows.Win32.Foundation.ERROR_NOT_FOUND -Windows.Win32.Foundation.ERROR_NOT_GUI_PROCESS -Windows.Win32.Foundation.ERROR_NOT_JOINED -Windows.Win32.Foundation.ERROR_NOT_LOCKED -Windows.Win32.Foundation.ERROR_NOT_LOGGED_ON -Windows.Win32.Foundation.ERROR_NOT_LOGON_PROCESS -Windows.Win32.Foundation.ERROR_NOT_OWNER -Windows.Win32.Foundation.ERROR_NOT_READ_FROM_COPY -Windows.Win32.Foundation.ERROR_NOT_READY -Windows.Win32.Foundation.ERROR_NOT_REDUNDANT_STORAGE -Windows.Win32.Foundation.ERROR_NOT_REGISTRY_FILE -Windows.Win32.Foundation.ERROR_NOT_SAFE_MODE_DRIVER -Windows.Win32.Foundation.ERROR_NOT_SAFEBOOT_SERVICE -Windows.Win32.Foundation.ERROR_NOT_SAME_DEVICE -Windows.Win32.Foundation.ERROR_NOT_SAME_OBJECT -Windows.Win32.Foundation.ERROR_NOT_SUBSTED -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_IN_APPCONTAINER -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_DAX -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_SBS -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_AUDITING -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_BTT -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_BYPASSIO -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_COMPRESSION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_ENCRYPTION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_MONITORING -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_REPLICATION -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_SNAPSHOT -Windows.Win32.Foundation.ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION -Windows.Win32.Foundation.ERROR_NOT_TINY_STREAM -Windows.Win32.Foundation.ERROR_NOTHING_TO_TERMINATE -Windows.Win32.Foundation.ERROR_NOTIFICATION_GUID_ALREADY_DEFINED -Windows.Win32.Foundation.ERROR_NOTIFY_CLEANUP -Windows.Win32.Foundation.ERROR_NOTIFY_ENUM_DIR -Windows.Win32.Foundation.ERROR_NT_CROSS_ENCRYPTION_REQUIRED -Windows.Win32.Foundation.ERROR_NTLM_BLOCKED -Windows.Win32.Foundation.ERROR_NULL_LM_PASSWORD -Windows.Win32.Foundation.ERROR_OBJECT_IS_IMMUTABLE -Windows.Win32.Foundation.ERROR_OBJECT_NAME_EXISTS -Windows.Win32.Foundation.ERROR_OBJECT_NOT_EXTERNALLY_BACKED -Windows.Win32.Foundation.ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_OFFSET_ALIGNMENT_VIOLATION -Windows.Win32.Foundation.ERROR_OLD_WIN_VERSION -Windows.Win32.Foundation.ERROR_ONLY_IF_CONNECTED -Windows.Win32.Foundation.ERROR_OPEN_FAILED -Windows.Win32.Foundation.ERROR_OPEN_FILES -Windows.Win32.Foundation.ERROR_OPERATION_ABORTED -Windows.Win32.Foundation.ERROR_OPERATION_IN_PROGRESS -Windows.Win32.Foundation.ERROR_OPLOCK_BREAK_IN_PROGRESS -Windows.Win32.Foundation.ERROR_OPLOCK_HANDLE_CLOSED -Windows.Win32.Foundation.ERROR_OPLOCK_NOT_GRANTED -Windows.Win32.Foundation.ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE -Windows.Win32.Foundation.ERROR_ORPHAN_NAME_EXHAUSTED -Windows.Win32.Foundation.ERROR_OUT_OF_PAPER -Windows.Win32.Foundation.ERROR_OUT_OF_STRUCTURES -Windows.Win32.Foundation.ERROR_OUTOFMEMORY -Windows.Win32.Foundation.ERROR_OVERRIDE_NOCHANGES -Windows.Win32.Foundation.ERROR_PAGE_FAULT_COPY_ON_WRITE -Windows.Win32.Foundation.ERROR_PAGE_FAULT_DEMAND_ZERO -Windows.Win32.Foundation.ERROR_PAGE_FAULT_GUARD_PAGE -Windows.Win32.Foundation.ERROR_PAGE_FAULT_PAGING_FILE -Windows.Win32.Foundation.ERROR_PAGE_FAULT_TRANSITION -Windows.Win32.Foundation.ERROR_PAGED_SYSTEM_RESOURCES -Windows.Win32.Foundation.ERROR_PAGEFILE_CREATE_FAILED -Windows.Win32.Foundation.ERROR_PAGEFILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_PAGEFILE_QUOTA -Windows.Win32.Foundation.ERROR_PAGEFILE_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_PARAMETER_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_PARTIAL_COPY -Windows.Win32.Foundation.ERROR_PARTITION_FAILURE -Windows.Win32.Foundation.ERROR_PARTITION_TERMINATING -Windows.Win32.Foundation.ERROR_PASSWORD_CHANGE_REQUIRED -Windows.Win32.Foundation.ERROR_PASSWORD_EXPIRED -Windows.Win32.Foundation.ERROR_PASSWORD_MUST_CHANGE -Windows.Win32.Foundation.ERROR_PASSWORD_RESTRICTION -Windows.Win32.Foundation.ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT -Windows.Win32.Foundation.ERROR_PATCH_NO_SEQUENCE -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_INVALID -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_OPEN_FAILED -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_REJECTED -Windows.Win32.Foundation.ERROR_PATCH_PACKAGE_UNSUPPORTED -Windows.Win32.Foundation.ERROR_PATCH_REMOVAL_DISALLOWED -Windows.Win32.Foundation.ERROR_PATCH_REMOVAL_UNSUPPORTED -Windows.Win32.Foundation.ERROR_PATCH_TARGET_NOT_FOUND -Windows.Win32.Foundation.ERROR_PATH_BUSY -Windows.Win32.Foundation.ERROR_PATH_NOT_FOUND -Windows.Win32.Foundation.ERROR_PER_USER_TRUST_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_PIPE_BUSY -Windows.Win32.Foundation.ERROR_PIPE_CONNECTED -Windows.Win32.Foundation.ERROR_PIPE_LISTENING -Windows.Win32.Foundation.ERROR_PIPE_LOCAL -Windows.Win32.Foundation.ERROR_PIPE_NOT_CONNECTED -Windows.Win32.Foundation.ERROR_PKINIT_FAILURE -Windows.Win32.Foundation.ERROR_PLUGPLAY_QUERY_VETOED -Windows.Win32.Foundation.ERROR_PNP_BAD_MPS_TABLE -Windows.Win32.Foundation.ERROR_PNP_INVALID_ID -Windows.Win32.Foundation.ERROR_PNP_IRQ_TRANSLATION_FAILED -Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT -Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT -Windows.Win32.Foundation.ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT -Windows.Win32.Foundation.ERROR_PNP_REBOOT_REQUIRED -Windows.Win32.Foundation.ERROR_PNP_RESTART_ENUMERATION -Windows.Win32.Foundation.ERROR_PNP_TRANSLATION_FAILED -Windows.Win32.Foundation.ERROR_POINT_NOT_FOUND -Windows.Win32.Foundation.ERROR_POLICY_OBJECT_NOT_FOUND -Windows.Win32.Foundation.ERROR_POLICY_ONLY_IN_DS -Windows.Win32.Foundation.ERROR_POPUP_ALREADY_ACTIVE -Windows.Win32.Foundation.ERROR_PORT_MESSAGE_TOO_LONG -Windows.Win32.Foundation.ERROR_PORT_NOT_SET -Windows.Win32.Foundation.ERROR_PORT_UNREACHABLE -Windows.Win32.Foundation.ERROR_POSSIBLE_DEADLOCK -Windows.Win32.Foundation.ERROR_POTENTIAL_FILE_FOUND -Windows.Win32.Foundation.ERROR_PREDEFINED_HANDLE -Windows.Win32.Foundation.ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED -Windows.Win32.Foundation.ERROR_PRINT_CANCELLED -Windows.Win32.Foundation.ERROR_PRINTER_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_PRINTER_DELETED -Windows.Win32.Foundation.ERROR_PRINTER_DRIVER_ALREADY_INSTALLED -Windows.Win32.Foundation.ERROR_PRINTQ_FULL -Windows.Win32.Foundation.ERROR_PRIVATE_DIALOG_INDEX -Windows.Win32.Foundation.ERROR_PRIVILEGE_NOT_HELD -Windows.Win32.Foundation.ERROR_PROC_NOT_FOUND -Windows.Win32.Foundation.ERROR_PROCESS_ABORTED -Windows.Win32.Foundation.ERROR_PROCESS_IN_JOB -Windows.Win32.Foundation.ERROR_PROCESS_IS_PROTECTED -Windows.Win32.Foundation.ERROR_PROCESS_MODE_ALREADY_BACKGROUND -Windows.Win32.Foundation.ERROR_PROCESS_MODE_NOT_BACKGROUND -Windows.Win32.Foundation.ERROR_PROCESS_NOT_IN_JOB -Windows.Win32.Foundation.ERROR_PRODUCT_UNINSTALLED -Windows.Win32.Foundation.ERROR_PRODUCT_VERSION -Windows.Win32.Foundation.ERROR_PROFILING_AT_LIMIT -Windows.Win32.Foundation.ERROR_PROFILING_NOT_STARTED -Windows.Win32.Foundation.ERROR_PROFILING_NOT_STOPPED -Windows.Win32.Foundation.ERROR_PROMOTION_ACTIVE -Windows.Win32.Foundation.ERROR_PROTOCOL_UNREACHABLE -Windows.Win32.Foundation.ERROR_PWD_HISTORY_CONFLICT -Windows.Win32.Foundation.ERROR_PWD_TOO_LONG -Windows.Win32.Foundation.ERROR_PWD_TOO_RECENT -Windows.Win32.Foundation.ERROR_PWD_TOO_SHORT -Windows.Win32.Foundation.ERROR_QUOTA_ACTIVITY -Windows.Win32.Foundation.ERROR_QUOTA_LIST_INCONSISTENT -Windows.Win32.Foundation.ERROR_RANGE_LIST_CONFLICT -Windows.Win32.Foundation.ERROR_RANGE_NOT_FOUND -Windows.Win32.Foundation.ERROR_READ_FAULT -Windows.Win32.Foundation.ERROR_RECEIVE_EXPEDITED -Windows.Win32.Foundation.ERROR_RECEIVE_PARTIAL -Windows.Win32.Foundation.ERROR_RECEIVE_PARTIAL_EXPEDITED -Windows.Win32.Foundation.ERROR_RECOVERY_FAILURE -Windows.Win32.Foundation.ERROR_REDIR_PAUSED -Windows.Win32.Foundation.ERROR_REDIRECTOR_HAS_OPEN_HANDLES -Windows.Win32.Foundation.ERROR_REG_NAT_CONSUMPTION -Windows.Win32.Foundation.ERROR_REGISTRY_CORRUPT -Windows.Win32.Foundation.ERROR_REGISTRY_HIVE_RECOVERED -Windows.Win32.Foundation.ERROR_REGISTRY_IO_FAILED -Windows.Win32.Foundation.ERROR_REGISTRY_QUOTA_LIMIT -Windows.Win32.Foundation.ERROR_REGISTRY_RECOVERED -Windows.Win32.Foundation.ERROR_RELOC_CHAIN_XEEDS_SEGLIM -Windows.Win32.Foundation.ERROR_REM_NOT_LIST -Windows.Win32.Foundation.ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED -Windows.Win32.Foundation.ERROR_REMOTE_SESSION_LIMIT_EXCEEDED -Windows.Win32.Foundation.ERROR_REMOTE_STORAGE_MEDIA_ERROR -Windows.Win32.Foundation.ERROR_REMOTE_STORAGE_NOT_ACTIVE -Windows.Win32.Foundation.ERROR_REPARSE -Windows.Win32.Foundation.ERROR_REPARSE_ATTRIBUTE_CONFLICT -Windows.Win32.Foundation.ERROR_REPARSE_OBJECT -Windows.Win32.Foundation.ERROR_REPARSE_POINT_ENCOUNTERED -Windows.Win32.Foundation.ERROR_REPARSE_TAG_INVALID -Windows.Win32.Foundation.ERROR_REPARSE_TAG_MISMATCH -Windows.Win32.Foundation.ERROR_REPLY_MESSAGE_MISMATCH -Windows.Win32.Foundation.ERROR_REQ_NOT_ACCEP -Windows.Win32.Foundation.ERROR_REQUEST_ABORTED -Windows.Win32.Foundation.ERROR_REQUEST_OUT_OF_SEQUENCE -Windows.Win32.Foundation.ERROR_REQUEST_PAUSED -Windows.Win32.Foundation.ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION -Windows.Win32.Foundation.ERROR_RESIDENT_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_RESOURCE_CALL_TIMED_OUT -Windows.Win32.Foundation.ERROR_RESOURCE_DATA_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESOURCE_LANG_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESOURCE_NAME_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESOURCE_REQUIREMENTS_CHANGED -Windows.Win32.Foundation.ERROR_RESOURCE_TYPE_NOT_FOUND -Windows.Win32.Foundation.ERROR_RESTART_APPLICATION -Windows.Win32.Foundation.ERROR_RESUME_HIBERNATION -Windows.Win32.Foundation.ERROR_RETRY -Windows.Win32.Foundation.ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT -Windows.Win32.Foundation.ERROR_REVISION_MISMATCH -Windows.Win32.Foundation.ERROR_RING2_STACK_IN_USE -Windows.Win32.Foundation.ERROR_RING2SEG_MUST_BE_MOVABLE -Windows.Win32.Foundation.ERROR_RMODE_APP -Windows.Win32.Foundation.ERROR_ROWSNOTRELEASED -Windows.Win32.Foundation.ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT -Windows.Win32.Foundation.ERROR_RUNLEVEL_SWITCH_TIMEOUT -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE -Windows.Win32.Foundation.ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER -Windows.Win32.Foundation.ERROR_RXACT_COMMIT_FAILURE -Windows.Win32.Foundation.ERROR_RXACT_COMMIT_NECESSARY -Windows.Win32.Foundation.ERROR_RXACT_COMMITTED -Windows.Win32.Foundation.ERROR_RXACT_INVALID_STATE -Windows.Win32.Foundation.ERROR_RXACT_STATE_CREATED -Windows.Win32.Foundation.ERROR_SAM_INIT_FAILURE -Windows.Win32.Foundation.ERROR_SAME_DRIVE -Windows.Win32.Foundation.ERROR_SCOPE_NOT_FOUND -Windows.Win32.Foundation.ERROR_SCREEN_ALREADY_LOCKED -Windows.Win32.Foundation.ERROR_SCRUB_DATA_DISABLED -Windows.Win32.Foundation.ERROR_SECRET_TOO_LONG -Windows.Win32.Foundation.ERROR_SECTION_DIRECT_MAP_ONLY -Windows.Win32.Foundation.ERROR_SECTOR_NOT_FOUND -Windows.Win32.Foundation.ERROR_SECURITY_DENIES_OPERATION -Windows.Win32.Foundation.ERROR_SECURITY_STREAM_IS_INCONSISTENT -Windows.Win32.Foundation.ERROR_SEEK -Windows.Win32.Foundation.ERROR_SEEK_ON_DEVICE -Windows.Win32.Foundation.ERROR_SEGMENT_NOTIFICATION -Windows.Win32.Foundation.ERROR_SEM_IS_SET -Windows.Win32.Foundation.ERROR_SEM_NOT_FOUND -Windows.Win32.Foundation.ERROR_SEM_OWNER_DIED -Windows.Win32.Foundation.ERROR_SEM_TIMEOUT -Windows.Win32.Foundation.ERROR_SEM_USER_LIMIT -Windows.Win32.Foundation.ERROR_SERIAL_NO_DEVICE -Windows.Win32.Foundation.ERROR_SERVER_DISABLED -Windows.Win32.Foundation.ERROR_SERVER_HAS_OPEN_HANDLES -Windows.Win32.Foundation.ERROR_SERVER_NOT_DISABLED -Windows.Win32.Foundation.ERROR_SERVER_SHUTDOWN_IN_PROGRESS -Windows.Win32.Foundation.ERROR_SERVER_SID_MISMATCH -Windows.Win32.Foundation.ERROR_SERVER_TRANSPORT_CONFLICT -Windows.Win32.Foundation.ERROR_SERVICE_ALREADY_RUNNING -Windows.Win32.Foundation.ERROR_SERVICE_CANNOT_ACCEPT_CTRL -Windows.Win32.Foundation.ERROR_SERVICE_DATABASE_LOCKED -Windows.Win32.Foundation.ERROR_SERVICE_DEPENDENCY_DELETED -Windows.Win32.Foundation.ERROR_SERVICE_DEPENDENCY_FAIL -Windows.Win32.Foundation.ERROR_SERVICE_DISABLED -Windows.Win32.Foundation.ERROR_SERVICE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_SERVICE_EXISTS -Windows.Win32.Foundation.ERROR_SERVICE_LOGON_FAILED -Windows.Win32.Foundation.ERROR_SERVICE_MARKED_FOR_DELETE -Windows.Win32.Foundation.ERROR_SERVICE_NEVER_STARTED -Windows.Win32.Foundation.ERROR_SERVICE_NO_THREAD -Windows.Win32.Foundation.ERROR_SERVICE_NOT_ACTIVE -Windows.Win32.Foundation.ERROR_SERVICE_NOT_FOUND -Windows.Win32.Foundation.ERROR_SERVICE_NOT_IN_EXE -Windows.Win32.Foundation.ERROR_SERVICE_NOTIFICATION -Windows.Win32.Foundation.ERROR_SERVICE_NOTIFY_CLIENT_LAGGING -Windows.Win32.Foundation.ERROR_SERVICE_REQUEST_TIMEOUT -Windows.Win32.Foundation.ERROR_SERVICE_SPECIFIC_ERROR -Windows.Win32.Foundation.ERROR_SERVICE_START_HANG -Windows.Win32.Foundation.ERROR_SESSION_CREDENTIAL_CONFLICT -Windows.Win32.Foundation.ERROR_SESSION_KEY_TOO_SHORT -Windows.Win32.Foundation.ERROR_SET_CONTEXT_DENIED -Windows.Win32.Foundation.ERROR_SET_NOT_FOUND -Windows.Win32.Foundation.ERROR_SET_POWER_STATE_FAILED -Windows.Win32.Foundation.ERROR_SET_POWER_STATE_VETOED -Windows.Win32.Foundation.ERROR_SETCOUNT_ON_BAD_LB -Windows.Win32.Foundation.ERROR_SETMARK_DETECTED -Windows.Win32.Foundation.ERROR_SHARED_POLICY -Windows.Win32.Foundation.ERROR_SHARING_BUFFER_EXCEEDED -Windows.Win32.Foundation.ERROR_SHARING_PAUSED -Windows.Win32.Foundation.ERROR_SHARING_VIOLATION -Windows.Win32.Foundation.ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME -Windows.Win32.Foundation.ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE -Windows.Win32.Foundation.ERROR_SHUTDOWN_IN_PROGRESS -Windows.Win32.Foundation.ERROR_SHUTDOWN_IS_SCHEDULED -Windows.Win32.Foundation.ERROR_SHUTDOWN_USERS_LOGGED_ON -Windows.Win32.Foundation.ERROR_SIGNAL_PENDING -Windows.Win32.Foundation.ERROR_SIGNAL_REFUSED -Windows.Win32.Foundation.ERROR_SINGLE_INSTANCE_APP -Windows.Win32.Foundation.ERROR_SMARTCARD_SUBSYSTEM_FAILURE -Windows.Win32.Foundation.ERROR_SMB1_NOT_AVAILABLE -Windows.Win32.Foundation.ERROR_SMB_GUEST_LOGON_BLOCKED -Windows.Win32.Foundation.ERROR_SMR_GARBAGE_COLLECTION_REQUIRED -Windows.Win32.Foundation.ERROR_SOME_NOT_MAPPED -Windows.Win32.Foundation.ERROR_SOURCE_ELEMENT_EMPTY -Windows.Win32.Foundation.ERROR_SPARSE_FILE_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_SPECIAL_ACCOUNT -Windows.Win32.Foundation.ERROR_SPECIAL_GROUP -Windows.Win32.Foundation.ERROR_SPECIAL_USER -Windows.Win32.Foundation.ERROR_SRC_SRV_DLL_LOAD_FAILED -Windows.Win32.Foundation.ERROR_STACK_BUFFER_OVERRUN -Windows.Win32.Foundation.ERROR_STACK_OVERFLOW -Windows.Win32.Foundation.ERROR_STACK_OVERFLOW_READ -Windows.Win32.Foundation.ERROR_STOPPED_ON_SYMLINK -Windows.Win32.Foundation.ERROR_STORAGE_LOST_DATA_PERSISTENCE -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_ALREADY_EXISTS -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_ID_INVALID -Windows.Win32.Foundation.ERROR_STORAGE_RESERVE_NOT_EMPTY -Windows.Win32.Foundation.ERROR_STORAGE_STACK_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_STORAGE_TOPOLOGY_ID_MISMATCH -Windows.Win32.Foundation.ERROR_STRICT_CFG_VIOLATION -Windows.Win32.Foundation.ERROR_SUBST_TO_JOIN -Windows.Win32.Foundation.ERROR_SUBST_TO_SUBST -Windows.Win32.Foundation.ERROR_SUCCESS -Windows.Win32.Foundation.ERROR_SUCCESS_REBOOT_INITIATED -Windows.Win32.Foundation.ERROR_SWAPERROR -Windows.Win32.Foundation.ERROR_SYMLINK_CLASS_DISABLED -Windows.Win32.Foundation.ERROR_SYMLINK_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED -Windows.Win32.Foundation.ERROR_SYNCHRONIZATION_REQUIRED -Windows.Win32.Foundation.ERROR_SYSTEM_HIVE_TOO_LARGE -Windows.Win32.Foundation.ERROR_SYSTEM_IMAGE_BAD_SIGNATURE -Windows.Win32.Foundation.ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION -Windows.Win32.Foundation.ERROR_SYSTEM_POWERSTATE_TRANSITION -Windows.Win32.Foundation.ERROR_SYSTEM_PROCESS_TERMINATED -Windows.Win32.Foundation.ERROR_SYSTEM_SHUTDOWN -Windows.Win32.Foundation.ERROR_SYSTEM_TRACE -Windows.Win32.Foundation.ERROR_THREAD_1_INACTIVE -Windows.Win32.Foundation.ERROR_THREAD_ALREADY_IN_TASK -Windows.Win32.Foundation.ERROR_THREAD_MODE_ALREADY_BACKGROUND -Windows.Win32.Foundation.ERROR_THREAD_MODE_NOT_BACKGROUND -Windows.Win32.Foundation.ERROR_THREAD_NOT_IN_PROCESS -Windows.Win32.Foundation.ERROR_THREAD_WAS_SUSPENDED -Windows.Win32.Foundation.ERROR_TIME_SENSITIVE_THREAD -Windows.Win32.Foundation.ERROR_TIME_SKEW -Windows.Win32.Foundation.ERROR_TIMEOUT -Windows.Win32.Foundation.ERROR_TIMER_NOT_CANCELED -Windows.Win32.Foundation.ERROR_TIMER_RESOLUTION_NOT_SET -Windows.Win32.Foundation.ERROR_TIMER_RESUME_IGNORED -Windows.Win32.Foundation.ERROR_TLW_WITH_WSCHILD -Windows.Win32.Foundation.ERROR_TOKEN_ALREADY_IN_USE -Windows.Win32.Foundation.ERROR_TOO_MANY_CMDS -Windows.Win32.Foundation.ERROR_TOO_MANY_CONTEXT_IDS -Windows.Win32.Foundation.ERROR_TOO_MANY_DESCRIPTORS -Windows.Win32.Foundation.ERROR_TOO_MANY_LINKS -Windows.Win32.Foundation.ERROR_TOO_MANY_LUIDS_REQUESTED -Windows.Win32.Foundation.ERROR_TOO_MANY_MODULES -Windows.Win32.Foundation.ERROR_TOO_MANY_MUXWAITERS -Windows.Win32.Foundation.ERROR_TOO_MANY_NAMES -Windows.Win32.Foundation.ERROR_TOO_MANY_OPEN_FILES -Windows.Win32.Foundation.ERROR_TOO_MANY_POSTS -Windows.Win32.Foundation.ERROR_TOO_MANY_SECRETS -Windows.Win32.Foundation.ERROR_TOO_MANY_SEM_REQUESTS -Windows.Win32.Foundation.ERROR_TOO_MANY_SEMAPHORES -Windows.Win32.Foundation.ERROR_TOO_MANY_SESS -Windows.Win32.Foundation.ERROR_TOO_MANY_SIDS -Windows.Win32.Foundation.ERROR_TOO_MANY_TCBS -Windows.Win32.Foundation.ERROR_TOO_MANY_THREADS -Windows.Win32.Foundation.ERROR_TRANSLATION_COMPLETE -Windows.Win32.Foundation.ERROR_TRUST_FAILURE -Windows.Win32.Foundation.ERROR_TRUSTED_DOMAIN_FAILURE -Windows.Win32.Foundation.ERROR_TRUSTED_RELATIONSHIP_FAILURE -Windows.Win32.Foundation.ERROR_UNABLE_TO_LOCK_MEDIA -Windows.Win32.Foundation.ERROR_UNABLE_TO_MOVE_REPLACEMENT -Windows.Win32.Foundation.ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 -Windows.Win32.Foundation.ERROR_UNABLE_TO_REMOVE_REPLACED -Windows.Win32.Foundation.ERROR_UNABLE_TO_UNLOAD_MEDIA -Windows.Win32.Foundation.ERROR_UNDEFINED_CHARACTER -Windows.Win32.Foundation.ERROR_UNDEFINED_SCOPE -Windows.Win32.Foundation.ERROR_UNEXP_NET_ERR -Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_CREATE_ERR -Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_EXTEND_ERR -Windows.Win32.Foundation.ERROR_UNEXPECTED_MM_MAP_ERROR -Windows.Win32.Foundation.ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR -Windows.Win32.Foundation.ERROR_UNHANDLED_EXCEPTION -Windows.Win32.Foundation.ERROR_UNIDENTIFIED_ERROR -Windows.Win32.Foundation.ERROR_UNKNOWN_COMPONENT -Windows.Win32.Foundation.ERROR_UNKNOWN_FEATURE -Windows.Win32.Foundation.ERROR_UNKNOWN_PATCH -Windows.Win32.Foundation.ERROR_UNKNOWN_PORT -Windows.Win32.Foundation.ERROR_UNKNOWN_PRINTER_DRIVER -Windows.Win32.Foundation.ERROR_UNKNOWN_PRINTPROCESSOR -Windows.Win32.Foundation.ERROR_UNKNOWN_PRODUCT -Windows.Win32.Foundation.ERROR_UNKNOWN_PROPERTY -Windows.Win32.Foundation.ERROR_UNKNOWN_REVISION -Windows.Win32.Foundation.ERROR_UNRECOGNIZED_MEDIA -Windows.Win32.Foundation.ERROR_UNRECOGNIZED_VOLUME -Windows.Win32.Foundation.ERROR_UNSATISFIED_DEPENDENCIES -Windows.Win32.Foundation.ERROR_UNSUPPORTED_COMPRESSION -Windows.Win32.Foundation.ERROR_UNSUPPORTED_TYPE -Windows.Win32.Foundation.ERROR_UNTRUSTED_MOUNT_POINT -Windows.Win32.Foundation.ERROR_UNWIND -Windows.Win32.Foundation.ERROR_UNWIND_CONSOLIDATE -Windows.Win32.Foundation.ERROR_USER_APC -Windows.Win32.Foundation.ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED -Windows.Win32.Foundation.ERROR_USER_EXISTS -Windows.Win32.Foundation.ERROR_USER_MAPPED_FILE -Windows.Win32.Foundation.ERROR_USER_PROFILE_LOAD -Windows.Win32.Foundation.ERROR_VALIDATE_CONTINUE -Windows.Win32.Foundation.ERROR_VC_DISCONNECTED -Windows.Win32.Foundation.ERROR_VDM_DISALLOWED -Windows.Win32.Foundation.ERROR_VDM_HARD_ERROR -Windows.Win32.Foundation.ERROR_VERIFIER_STOP -Windows.Win32.Foundation.ERROR_VERSION_PARSE_ERROR -Windows.Win32.Foundation.ERROR_VIRUS_DELETED -Windows.Win32.Foundation.ERROR_VIRUS_INFECTED -Windows.Win32.Foundation.ERROR_VOLSNAP_HIBERNATE_READY -Windows.Win32.Foundation.ERROR_VOLSNAP_PREPARE_HIBERNATE -Windows.Win32.Foundation.ERROR_VOLUME_MOUNTED -Windows.Win32.Foundation.ERROR_VOLUME_NOT_CLUSTER_ALIGNED -Windows.Win32.Foundation.ERROR_VOLUME_NOT_SIS_ENABLED -Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORT_EFS -Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_VOLUME_WRITE_ACCESS_DENIED -Windows.Win32.Foundation.ERROR_WAIT_1 -Windows.Win32.Foundation.ERROR_WAIT_2 -Windows.Win32.Foundation.ERROR_WAIT_3 -Windows.Win32.Foundation.ERROR_WAIT_63 -Windows.Win32.Foundation.ERROR_WAIT_FOR_OPLOCK -Windows.Win32.Foundation.ERROR_WAIT_NO_CHILDREN -Windows.Win32.Foundation.ERROR_WAKE_SYSTEM -Windows.Win32.Foundation.ERROR_WAKE_SYSTEM_DEBUGGER -Windows.Win32.Foundation.ERROR_WAS_LOCKED -Windows.Win32.Foundation.ERROR_WAS_UNLOCKED -Windows.Win32.Foundation.ERROR_WEAK_WHFBKEY_BLOCKED -Windows.Win32.Foundation.ERROR_WINDOW_NOT_COMBOBOX -Windows.Win32.Foundation.ERROR_WINDOW_NOT_DIALOG -Windows.Win32.Foundation.ERROR_WINDOW_OF_OTHER_THREAD -Windows.Win32.Foundation.ERROR_WIP_ENCRYPTION_FAILED -Windows.Win32.Foundation.ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT -Windows.Win32.Foundation.ERROR_WOF_WIM_HEADER_CORRUPT -Windows.Win32.Foundation.ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT -Windows.Win32.Foundation.ERROR_WORKING_SET_QUOTA -Windows.Win32.Foundation.ERROR_WOW_ASSERTION -Windows.Win32.Foundation.ERROR_WRITE_FAULT -Windows.Win32.Foundation.ERROR_WRITE_PROTECT -Windows.Win32.Foundation.ERROR_WRONG_COMPARTMENT -Windows.Win32.Foundation.ERROR_WRONG_DISK -Windows.Win32.Foundation.ERROR_WRONG_EFS -Windows.Win32.Foundation.ERROR_WRONG_PASSWORD -Windows.Win32.Foundation.ERROR_WRONG_TARGET_NAME -Windows.Win32.Foundation.ERROR_WX86_ERROR -Windows.Win32.Foundation.ERROR_WX86_WARNING -Windows.Win32.Foundation.ERROR_XML_PARSE_ERROR -Windows.Win32.Foundation.ERROR_XMLDSIG_ERROR -Windows.Win32.Foundation.EXCEPTION_STACK_OVERFLOW -Windows.Win32.Foundation.FALSE -Windows.Win32.Foundation.FARPROC -Windows.Win32.Foundation.FILETIME -Windows.Win32.Foundation.FRS_ERR_SYSVOL_POPULATE_TIMEOUT -Windows.Win32.Foundation.GENERIC_ACCESS_RIGHTS -Windows.Win32.Foundation.GENERIC_ALL -Windows.Win32.Foundation.GENERIC_EXECUTE -Windows.Win32.Foundation.GENERIC_READ -Windows.Win32.Foundation.GENERIC_WRITE -Windows.Win32.Foundation.GetLastError -Windows.Win32.Foundation.HANDLE -Windows.Win32.Foundation.HANDLE_FLAG_INHERIT -Windows.Win32.Foundation.HANDLE_FLAG_PROTECT_FROM_CLOSE -Windows.Win32.Foundation.HANDLE_FLAGS -Windows.Win32.Foundation.HMODULE -Windows.Win32.Foundation.MAX_PATH -Windows.Win32.Foundation.NO_ERROR -Windows.Win32.Foundation.NTSTATUS -Windows.Win32.Foundation.RtlNtStatusToDosError -Windows.Win32.Foundation.SetHandleInformation -Windows.Win32.Foundation.SetLastError -Windows.Win32.Foundation.STATUS_DELETE_PENDING -Windows.Win32.Foundation.STATUS_END_OF_FILE -Windows.Win32.Foundation.STATUS_INVALID_PARAMETER -Windows.Win32.Foundation.STATUS_NOT_IMPLEMENTED -Windows.Win32.Foundation.STATUS_PENDING -Windows.Win32.Foundation.STATUS_SUCCESS -Windows.Win32.Foundation.TRUE -Windows.Win32.Foundation.UNICODE_STRING -Windows.Win32.Foundation.WAIT_ABANDONED -Windows.Win32.Foundation.WAIT_ABANDONED_0 -Windows.Win32.Foundation.WAIT_FAILED -Windows.Win32.Foundation.WAIT_IO_COMPLETION -Windows.Win32.Foundation.WAIT_OBJECT_0 -Windows.Win32.Foundation.WAIT_TIMEOUT -Windows.Win32.Foundation.WIN32_ERROR -Windows.Win32.Globalization.COMPARESTRING_RESULT -Windows.Win32.Globalization.CompareStringOrdinal -Windows.Win32.Globalization.CP_UTF8 -Windows.Win32.Globalization.CSTR_EQUAL -Windows.Win32.Globalization.CSTR_GREATER_THAN -Windows.Win32.Globalization.CSTR_LESS_THAN -Windows.Win32.Globalization.MB_COMPOSITE -Windows.Win32.Globalization.MB_ERR_INVALID_CHARS -Windows.Win32.Globalization.MB_PRECOMPOSED -Windows.Win32.Globalization.MB_USEGLYPHCHARS -Windows.Win32.Globalization.MULTI_BYTE_TO_WIDE_CHAR_FLAGS -Windows.Win32.Globalization.MultiByteToWideChar -Windows.Win32.Globalization.WC_ERR_INVALID_CHARS -Windows.Win32.Globalization.WideCharToMultiByte -Windows.Win32.Networking.WinSock.accept -Windows.Win32.Networking.WinSock.ADDRESS_FAMILY -Windows.Win32.Networking.WinSock.ADDRINFOA -Windows.Win32.Networking.WinSock.AF_INET -Windows.Win32.Networking.WinSock.AF_INET6 -Windows.Win32.Networking.WinSock.AF_UNIX -Windows.Win32.Networking.WinSock.AF_UNSPEC -Windows.Win32.Networking.WinSock.bind -Windows.Win32.Networking.WinSock.closesocket -Windows.Win32.Networking.WinSock.connect -Windows.Win32.Networking.WinSock.FD_SET -Windows.Win32.Networking.WinSock.FIONBIO -Windows.Win32.Networking.WinSock.freeaddrinfo -Windows.Win32.Networking.WinSock.getaddrinfo -Windows.Win32.Networking.WinSock.getpeername -Windows.Win32.Networking.WinSock.getsockname -Windows.Win32.Networking.WinSock.getsockopt -Windows.Win32.Networking.WinSock.IN6_ADDR -Windows.Win32.Networking.WinSock.IN_ADDR -Windows.Win32.Networking.WinSock.INVALID_SOCKET -Windows.Win32.Networking.WinSock.ioctlsocket -Windows.Win32.Networking.WinSock.IP_ADD_MEMBERSHIP -Windows.Win32.Networking.WinSock.IP_DROP_MEMBERSHIP -Windows.Win32.Networking.WinSock.IP_MREQ -Windows.Win32.Networking.WinSock.IP_MULTICAST_LOOP -Windows.Win32.Networking.WinSock.IP_MULTICAST_TTL -Windows.Win32.Networking.WinSock.IP_TTL -Windows.Win32.Networking.WinSock.IPPROTO -Windows.Win32.Networking.WinSock.IPPROTO_AH -Windows.Win32.Networking.WinSock.IPPROTO_CBT -Windows.Win32.Networking.WinSock.IPPROTO_DSTOPTS -Windows.Win32.Networking.WinSock.IPPROTO_EGP -Windows.Win32.Networking.WinSock.IPPROTO_ESP -Windows.Win32.Networking.WinSock.IPPROTO_FRAGMENT -Windows.Win32.Networking.WinSock.IPPROTO_GGP -Windows.Win32.Networking.WinSock.IPPROTO_HOPOPTS -Windows.Win32.Networking.WinSock.IPPROTO_ICLFXBM -Windows.Win32.Networking.WinSock.IPPROTO_ICMP -Windows.Win32.Networking.WinSock.IPPROTO_ICMPV6 -Windows.Win32.Networking.WinSock.IPPROTO_IDP -Windows.Win32.Networking.WinSock.IPPROTO_IGMP -Windows.Win32.Networking.WinSock.IPPROTO_IGP -Windows.Win32.Networking.WinSock.IPPROTO_IP -Windows.Win32.Networking.WinSock.IPPROTO_IPV4 -Windows.Win32.Networking.WinSock.IPPROTO_IPV6 -Windows.Win32.Networking.WinSock.IPPROTO_L2TP -Windows.Win32.Networking.WinSock.IPPROTO_MAX -Windows.Win32.Networking.WinSock.IPPROTO_ND -Windows.Win32.Networking.WinSock.IPPROTO_NONE -Windows.Win32.Networking.WinSock.IPPROTO_PGM -Windows.Win32.Networking.WinSock.IPPROTO_PIM -Windows.Win32.Networking.WinSock.IPPROTO_PUP -Windows.Win32.Networking.WinSock.IPPROTO_RAW -Windows.Win32.Networking.WinSock.IPPROTO_RDP -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_IPSEC -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_IPSECOFFLOAD -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_MAX -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_RAW -Windows.Win32.Networking.WinSock.IPPROTO_RESERVED_WNV -Windows.Win32.Networking.WinSock.IPPROTO_RM -Windows.Win32.Networking.WinSock.IPPROTO_ROUTING -Windows.Win32.Networking.WinSock.IPPROTO_SCTP -Windows.Win32.Networking.WinSock.IPPROTO_ST -Windows.Win32.Networking.WinSock.IPPROTO_TCP -Windows.Win32.Networking.WinSock.IPPROTO_UDP -Windows.Win32.Networking.WinSock.IPV6_ADD_MEMBERSHIP -Windows.Win32.Networking.WinSock.IPV6_DROP_MEMBERSHIP -Windows.Win32.Networking.WinSock.IPV6_MREQ -Windows.Win32.Networking.WinSock.IPV6_MULTICAST_LOOP -Windows.Win32.Networking.WinSock.IPV6_V6ONLY -Windows.Win32.Networking.WinSock.LINGER -Windows.Win32.Networking.WinSock.listen -Windows.Win32.Networking.WinSock.LPWSAOVERLAPPED_COMPLETION_ROUTINE -Windows.Win32.Networking.WinSock.MSG_DONTROUTE -Windows.Win32.Networking.WinSock.MSG_OOB -Windows.Win32.Networking.WinSock.MSG_PEEK -Windows.Win32.Networking.WinSock.MSG_PUSH_IMMEDIATE -Windows.Win32.Networking.WinSock.MSG_WAITALL -Windows.Win32.Networking.WinSock.recv -Windows.Win32.Networking.WinSock.recvfrom -Windows.Win32.Networking.WinSock.SD_BOTH -Windows.Win32.Networking.WinSock.SD_RECEIVE -Windows.Win32.Networking.WinSock.SD_SEND -Windows.Win32.Networking.WinSock.select -Windows.Win32.Networking.WinSock.send -Windows.Win32.Networking.WinSock.SEND_RECV_FLAGS -Windows.Win32.Networking.WinSock.sendto -Windows.Win32.Networking.WinSock.setsockopt -Windows.Win32.Networking.WinSock.shutdown -Windows.Win32.Networking.WinSock.SO_BROADCAST -Windows.Win32.Networking.WinSock.SO_ERROR -Windows.Win32.Networking.WinSock.SO_LINGER -Windows.Win32.Networking.WinSock.SO_RCVTIMEO -Windows.Win32.Networking.WinSock.SO_SNDTIMEO -Windows.Win32.Networking.WinSock.SOCK_DGRAM -Windows.Win32.Networking.WinSock.SOCK_RAW -Windows.Win32.Networking.WinSock.SOCK_RDM -Windows.Win32.Networking.WinSock.SOCK_SEQPACKET -Windows.Win32.Networking.WinSock.SOCK_STREAM -Windows.Win32.Networking.WinSock.SOCKADDR -Windows.Win32.Networking.WinSock.SOCKADDR_UN -Windows.Win32.Networking.WinSock.SOCKET -Windows.Win32.Networking.WinSock.SOCKET_ERROR -Windows.Win32.Networking.WinSock.SOL_SOCKET -Windows.Win32.Networking.WinSock.TCP_NODELAY -Windows.Win32.Networking.WinSock.TIMEVAL -Windows.Win32.Networking.WinSock.WINSOCK_SHUTDOWN_HOW -Windows.Win32.Networking.WinSock.WINSOCK_SOCKET_TYPE -Windows.Win32.Networking.WinSock.WSA_E_CANCELLED -Windows.Win32.Networking.WinSock.WSA_E_NO_MORE -Windows.Win32.Networking.WinSock.WSA_ERROR -Windows.Win32.Networking.WinSock.WSA_FLAG_NO_HANDLE_INHERIT -Windows.Win32.Networking.WinSock.WSA_FLAG_OVERLAPPED -Windows.Win32.Networking.WinSock.WSA_INVALID_HANDLE -Windows.Win32.Networking.WinSock.WSA_INVALID_PARAMETER -Windows.Win32.Networking.WinSock.WSA_IO_INCOMPLETE -Windows.Win32.Networking.WinSock.WSA_IO_PENDING -Windows.Win32.Networking.WinSock.WSA_IPSEC_NAME_POLICY_ERROR -Windows.Win32.Networking.WinSock.WSA_NOT_ENOUGH_MEMORY -Windows.Win32.Networking.WinSock.WSA_OPERATION_ABORTED -Windows.Win32.Networking.WinSock.WSA_QOS_ADMISSION_FAILURE -Windows.Win32.Networking.WinSock.WSA_QOS_BAD_OBJECT -Windows.Win32.Networking.WinSock.WSA_QOS_BAD_STYLE -Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERCOUNT -Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERSTYLE -Windows.Win32.Networking.WinSock.WSA_QOS_EFILTERTYPE -Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWCOUNT -Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWDESC -Windows.Win32.Networking.WinSock.WSA_QOS_EFLOWSPEC -Windows.Win32.Networking.WinSock.WSA_QOS_EOBJLENGTH -Windows.Win32.Networking.WinSock.WSA_QOS_EPOLICYOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_EPROVSPECBUF -Windows.Win32.Networking.WinSock.WSA_QOS_EPSFILTERSPEC -Windows.Win32.Networking.WinSock.WSA_QOS_EPSFLOWSPEC -Windows.Win32.Networking.WinSock.WSA_QOS_ESDMODEOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_ESERVICETYPE -Windows.Win32.Networking.WinSock.WSA_QOS_ESHAPERATEOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_EUNKOWNPSOBJ -Windows.Win32.Networking.WinSock.WSA_QOS_GENERIC_ERROR -Windows.Win32.Networking.WinSock.WSA_QOS_NO_RECEIVERS -Windows.Win32.Networking.WinSock.WSA_QOS_NO_SENDERS -Windows.Win32.Networking.WinSock.WSA_QOS_POLICY_FAILURE -Windows.Win32.Networking.WinSock.WSA_QOS_RECEIVERS -Windows.Win32.Networking.WinSock.WSA_QOS_REQUEST_CONFIRMED -Windows.Win32.Networking.WinSock.WSA_QOS_RESERVED_PETYPE -Windows.Win32.Networking.WinSock.WSA_QOS_SENDERS -Windows.Win32.Networking.WinSock.WSA_QOS_TRAFFIC_CTRL_ERROR -Windows.Win32.Networking.WinSock.WSA_SECURE_HOST_NOT_FOUND -Windows.Win32.Networking.WinSock.WSA_WAIT_EVENT_0 -Windows.Win32.Networking.WinSock.WSA_WAIT_IO_COMPLETION -Windows.Win32.Networking.WinSock.WSABASEERR -Windows.Win32.Networking.WinSock.WSABUF -Windows.Win32.Networking.WinSock.WSACleanup -Windows.Win32.Networking.WinSock.WSADATA -Windows.Win32.Networking.WinSock.WSADuplicateSocketW -Windows.Win32.Networking.WinSock.WSAEACCES -Windows.Win32.Networking.WinSock.WSAEADDRINUSE -Windows.Win32.Networking.WinSock.WSAEADDRNOTAVAIL -Windows.Win32.Networking.WinSock.WSAEAFNOSUPPORT -Windows.Win32.Networking.WinSock.WSAEALREADY -Windows.Win32.Networking.WinSock.WSAEBADF -Windows.Win32.Networking.WinSock.WSAECANCELLED -Windows.Win32.Networking.WinSock.WSAECONNABORTED -Windows.Win32.Networking.WinSock.WSAECONNREFUSED -Windows.Win32.Networking.WinSock.WSAECONNRESET -Windows.Win32.Networking.WinSock.WSAEDESTADDRREQ -Windows.Win32.Networking.WinSock.WSAEDISCON -Windows.Win32.Networking.WinSock.WSAEDQUOT -Windows.Win32.Networking.WinSock.WSAEFAULT -Windows.Win32.Networking.WinSock.WSAEHOSTDOWN -Windows.Win32.Networking.WinSock.WSAEHOSTUNREACH -Windows.Win32.Networking.WinSock.WSAEINPROGRESS -Windows.Win32.Networking.WinSock.WSAEINTR -Windows.Win32.Networking.WinSock.WSAEINVAL -Windows.Win32.Networking.WinSock.WSAEINVALIDPROCTABLE -Windows.Win32.Networking.WinSock.WSAEINVALIDPROVIDER -Windows.Win32.Networking.WinSock.WSAEISCONN -Windows.Win32.Networking.WinSock.WSAELOOP -Windows.Win32.Networking.WinSock.WSAEMFILE -Windows.Win32.Networking.WinSock.WSAEMSGSIZE -Windows.Win32.Networking.WinSock.WSAENAMETOOLONG -Windows.Win32.Networking.WinSock.WSAENETDOWN -Windows.Win32.Networking.WinSock.WSAENETRESET -Windows.Win32.Networking.WinSock.WSAENETUNREACH -Windows.Win32.Networking.WinSock.WSAENOBUFS -Windows.Win32.Networking.WinSock.WSAENOMORE -Windows.Win32.Networking.WinSock.WSAENOPROTOOPT -Windows.Win32.Networking.WinSock.WSAENOTCONN -Windows.Win32.Networking.WinSock.WSAENOTEMPTY -Windows.Win32.Networking.WinSock.WSAENOTSOCK -Windows.Win32.Networking.WinSock.WSAEOPNOTSUPP -Windows.Win32.Networking.WinSock.WSAEPFNOSUPPORT -Windows.Win32.Networking.WinSock.WSAEPROCLIM -Windows.Win32.Networking.WinSock.WSAEPROTONOSUPPORT -Windows.Win32.Networking.WinSock.WSAEPROTOTYPE -Windows.Win32.Networking.WinSock.WSAEPROVIDERFAILEDINIT -Windows.Win32.Networking.WinSock.WSAEREFUSED -Windows.Win32.Networking.WinSock.WSAEREMOTE -Windows.Win32.Networking.WinSock.WSAESHUTDOWN -Windows.Win32.Networking.WinSock.WSAESOCKTNOSUPPORT -Windows.Win32.Networking.WinSock.WSAESTALE -Windows.Win32.Networking.WinSock.WSAETIMEDOUT -Windows.Win32.Networking.WinSock.WSAETOOMANYREFS -Windows.Win32.Networking.WinSock.WSAEUSERS -Windows.Win32.Networking.WinSock.WSAEWOULDBLOCK -Windows.Win32.Networking.WinSock.WSAGetLastError -Windows.Win32.Networking.WinSock.WSAHOST_NOT_FOUND -Windows.Win32.Networking.WinSock.WSANO_DATA -Windows.Win32.Networking.WinSock.WSANO_RECOVERY -Windows.Win32.Networking.WinSock.WSANOTINITIALISED -Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOW -Windows.Win32.Networking.WinSock.WSAPROTOCOLCHAIN -Windows.Win32.Networking.WinSock.WSARecv -Windows.Win32.Networking.WinSock.WSASend -Windows.Win32.Networking.WinSock.WSASERVICE_NOT_FOUND -Windows.Win32.Networking.WinSock.WSASocketW -Windows.Win32.Networking.WinSock.WSASYSCALLFAILURE -Windows.Win32.Networking.WinSock.WSASYSNOTREADY -Windows.Win32.Networking.WinSock.WSATRY_AGAIN -Windows.Win32.Networking.WinSock.WSATYPE_NOT_FOUND -Windows.Win32.Networking.WinSock.WSAVERNOTSUPPORTED -Windows.Win32.Security.Authentication.Identity.RtlGenRandom -Windows.Win32.Security.Cryptography.BCRYPT_ALG_HANDLE -Windows.Win32.Security.Cryptography.BCRYPT_USE_SYSTEM_PREFERRED_RNG -Windows.Win32.Security.Cryptography.BCryptGenRandom -Windows.Win32.Security.Cryptography.BCRYPTGENRANDOM_FLAGS -Windows.Win32.Security.SECURITY_ATTRIBUTES -Windows.Win32.Security.TOKEN_ACCESS_MASK -Windows.Win32.Security.TOKEN_ACCESS_PSEUDO_HANDLE -Windows.Win32.Security.TOKEN_ACCESS_PSEUDO_HANDLE_WIN8 -Windows.Win32.Security.TOKEN_ACCESS_SYSTEM_SECURITY -Windows.Win32.Security.TOKEN_ADJUST_DEFAULT -Windows.Win32.Security.TOKEN_ADJUST_GROUPS -Windows.Win32.Security.TOKEN_ADJUST_PRIVILEGES -Windows.Win32.Security.TOKEN_ADJUST_SESSIONID -Windows.Win32.Security.TOKEN_ALL_ACCESS -Windows.Win32.Security.TOKEN_ASSIGN_PRIMARY -Windows.Win32.Security.TOKEN_DELETE -Windows.Win32.Security.TOKEN_DUPLICATE -Windows.Win32.Security.TOKEN_EXECUTE -Windows.Win32.Security.TOKEN_IMPERSONATE -Windows.Win32.Security.TOKEN_QUERY -Windows.Win32.Security.TOKEN_QUERY_SOURCE -Windows.Win32.Security.TOKEN_READ -Windows.Win32.Security.TOKEN_READ_CONTROL -Windows.Win32.Security.TOKEN_TRUST_CONSTRAINT_MASK -Windows.Win32.Security.TOKEN_WRITE -Windows.Win32.Security.TOKEN_WRITE_DAC -Windows.Win32.Security.TOKEN_WRITE_OWNER -Windows.Win32.Storage.FileSystem.BY_HANDLE_FILE_INFORMATION -Windows.Win32.Storage.FileSystem.CALLBACK_CHUNK_FINISHED -Windows.Win32.Storage.FileSystem.CALLBACK_STREAM_SWITCH -Windows.Win32.Storage.FileSystem.CopyFileExW -Windows.Win32.Storage.FileSystem.CREATE_ALWAYS -Windows.Win32.Storage.FileSystem.CREATE_NEW -Windows.Win32.Storage.FileSystem.CreateDirectoryW -Windows.Win32.Storage.FileSystem.CreateFileW -Windows.Win32.Storage.FileSystem.CreateHardLinkW -Windows.Win32.Storage.FileSystem.CreateSymbolicLinkW -Windows.Win32.Storage.FileSystem.DELETE -Windows.Win32.Storage.FileSystem.DeleteFileW -Windows.Win32.Storage.FileSystem.FILE_ACCESS_RIGHTS -Windows.Win32.Storage.FileSystem.FILE_ADD_FILE -Windows.Win32.Storage.FileSystem.FILE_ADD_SUBDIRECTORY -Windows.Win32.Storage.FileSystem.FILE_ALL_ACCESS -Windows.Win32.Storage.FileSystem.FILE_ALLOCATION_INFO -Windows.Win32.Storage.FileSystem.FILE_APPEND_DATA -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_ARCHIVE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_COMPRESSED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DEVICE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DIRECTORY -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_EA -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_ENCRYPTED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_HIDDEN -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_INTEGRITY_STREAM -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NO_SCRUB_DATA -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NORMAL -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_OFFLINE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_PINNED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_READONLY -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_RECALL_ON_OPEN -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_REPARSE_POINT -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_SPARSE_FILE -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_SYSTEM -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TAG_INFO -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TEMPORARY -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_UNPINNED -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_VIRTUAL -Windows.Win32.Storage.FileSystem.FILE_BASIC_INFO -Windows.Win32.Storage.FileSystem.FILE_BEGIN -Windows.Win32.Storage.FileSystem.FILE_CREATE_PIPE_INSTANCE -Windows.Win32.Storage.FileSystem.FILE_CREATION_DISPOSITION -Windows.Win32.Storage.FileSystem.FILE_CURRENT -Windows.Win32.Storage.FileSystem.FILE_DELETE_CHILD -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_DELETE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_DO_NOT_DELETE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_ON_CLOSE -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_FLAG_POSIX_SEMANTICS -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO_EX -Windows.Win32.Storage.FileSystem.FILE_DISPOSITION_INFO_EX_FLAGS -Windows.Win32.Storage.FileSystem.FILE_END -Windows.Win32.Storage.FileSystem.FILE_END_OF_FILE_INFO -Windows.Win32.Storage.FileSystem.FILE_EXECUTE -Windows.Win32.Storage.FileSystem.FILE_FLAG_BACKUP_SEMANTICS -Windows.Win32.Storage.FileSystem.FILE_FLAG_DELETE_ON_CLOSE -Windows.Win32.Storage.FileSystem.FILE_FLAG_FIRST_PIPE_INSTANCE -Windows.Win32.Storage.FileSystem.FILE_FLAG_NO_BUFFERING -Windows.Win32.Storage.FileSystem.FILE_FLAG_OPEN_NO_RECALL -Windows.Win32.Storage.FileSystem.FILE_FLAG_OPEN_REPARSE_POINT -Windows.Win32.Storage.FileSystem.FILE_FLAG_OVERLAPPED -Windows.Win32.Storage.FileSystem.FILE_FLAG_POSIX_SEMANTICS -Windows.Win32.Storage.FileSystem.FILE_FLAG_RANDOM_ACCESS -Windows.Win32.Storage.FileSystem.FILE_FLAG_SEQUENTIAL_SCAN -Windows.Win32.Storage.FileSystem.FILE_FLAG_SESSION_AWARE -Windows.Win32.Storage.FileSystem.FILE_FLAG_WRITE_THROUGH -Windows.Win32.Storage.FileSystem.FILE_FLAGS_AND_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_GENERIC_EXECUTE -Windows.Win32.Storage.FileSystem.FILE_GENERIC_READ -Windows.Win32.Storage.FileSystem.FILE_GENERIC_WRITE -Windows.Win32.Storage.FileSystem.FILE_ID_BOTH_DIR_INFO -Windows.Win32.Storage.FileSystem.FILE_INFO_BY_HANDLE_CLASS -Windows.Win32.Storage.FileSystem.FILE_IO_PRIORITY_HINT_INFO -Windows.Win32.Storage.FileSystem.FILE_LIST_DIRECTORY -Windows.Win32.Storage.FileSystem.FILE_NAME_NORMALIZED -Windows.Win32.Storage.FileSystem.FILE_NAME_OPENED -Windows.Win32.Storage.FileSystem.FILE_READ_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_READ_DATA -Windows.Win32.Storage.FileSystem.FILE_READ_EA -Windows.Win32.Storage.FileSystem.FILE_SHARE_DELETE -Windows.Win32.Storage.FileSystem.FILE_SHARE_MODE -Windows.Win32.Storage.FileSystem.FILE_SHARE_NONE -Windows.Win32.Storage.FileSystem.FILE_SHARE_READ -Windows.Win32.Storage.FileSystem.FILE_SHARE_WRITE -Windows.Win32.Storage.FileSystem.FILE_STANDARD_INFO -Windows.Win32.Storage.FileSystem.FILE_TRAVERSE -Windows.Win32.Storage.FileSystem.FILE_TYPE -Windows.Win32.Storage.FileSystem.FILE_TYPE_CHAR -Windows.Win32.Storage.FileSystem.FILE_TYPE_DISK -Windows.Win32.Storage.FileSystem.FILE_TYPE_PIPE -Windows.Win32.Storage.FileSystem.FILE_TYPE_REMOTE -Windows.Win32.Storage.FileSystem.FILE_TYPE_UNKNOWN -Windows.Win32.Storage.FileSystem.FILE_WRITE_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_WRITE_DATA -Windows.Win32.Storage.FileSystem.FILE_WRITE_EA -Windows.Win32.Storage.FileSystem.FileAlignmentInfo -Windows.Win32.Storage.FileSystem.FileAllocationInfo -Windows.Win32.Storage.FileSystem.FileAttributeTagInfo -Windows.Win32.Storage.FileSystem.FileBasicInfo -Windows.Win32.Storage.FileSystem.FileCaseSensitiveInfo -Windows.Win32.Storage.FileSystem.FileCompressionInfo -Windows.Win32.Storage.FileSystem.FileDispositionInfo -Windows.Win32.Storage.FileSystem.FileDispositionInfoEx -Windows.Win32.Storage.FileSystem.FileEndOfFileInfo -Windows.Win32.Storage.FileSystem.FileFullDirectoryInfo -Windows.Win32.Storage.FileSystem.FileFullDirectoryRestartInfo -Windows.Win32.Storage.FileSystem.FileIdBothDirectoryInfo -Windows.Win32.Storage.FileSystem.FileIdBothDirectoryRestartInfo -Windows.Win32.Storage.FileSystem.FileIdExtdDirectoryInfo -Windows.Win32.Storage.FileSystem.FileIdExtdDirectoryRestartInfo -Windows.Win32.Storage.FileSystem.FileIdInfo -Windows.Win32.Storage.FileSystem.FileIoPriorityHintInfo -Windows.Win32.Storage.FileSystem.FileNameInfo -Windows.Win32.Storage.FileSystem.FileNormalizedNameInfo -Windows.Win32.Storage.FileSystem.FileRemoteProtocolInfo -Windows.Win32.Storage.FileSystem.FileRenameInfo -Windows.Win32.Storage.FileSystem.FileRenameInfoEx -Windows.Win32.Storage.FileSystem.FileStandardInfo -Windows.Win32.Storage.FileSystem.FileStorageInfo -Windows.Win32.Storage.FileSystem.FileStreamInfo -Windows.Win32.Storage.FileSystem.FindClose -Windows.Win32.Storage.FileSystem.FindFirstFileW -Windows.Win32.Storage.FileSystem.FindNextFileW -Windows.Win32.Storage.FileSystem.FlushFileBuffers -Windows.Win32.Storage.FileSystem.GetFileAttributesW -Windows.Win32.Storage.FileSystem.GetFileInformationByHandle -Windows.Win32.Storage.FileSystem.GetFileInformationByHandleEx -Windows.Win32.Storage.FileSystem.GetFileType -Windows.Win32.Storage.FileSystem.GETFINALPATHNAMEBYHANDLE_FLAGS -Windows.Win32.Storage.FileSystem.GetFinalPathNameByHandleW -Windows.Win32.Storage.FileSystem.GetFullPathNameW -Windows.Win32.Storage.FileSystem.GetTempPathW -Windows.Win32.Storage.FileSystem.INVALID_FILE_ATTRIBUTES -Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE -Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE_CALLBACK_REASON -Windows.Win32.Storage.FileSystem.MAXIMUM_REPARSE_DATA_BUFFER_SIZE -Windows.Win32.Storage.FileSystem.MaximumFileInfoByHandleClass -Windows.Win32.Storage.FileSystem.MOVE_FILE_FLAGS -Windows.Win32.Storage.FileSystem.MOVEFILE_COPY_ALLOWED -Windows.Win32.Storage.FileSystem.MOVEFILE_CREATE_HARDLINK -Windows.Win32.Storage.FileSystem.MOVEFILE_DELAY_UNTIL_REBOOT -Windows.Win32.Storage.FileSystem.MOVEFILE_FAIL_IF_NOT_TRACKABLE -Windows.Win32.Storage.FileSystem.MOVEFILE_REPLACE_EXISTING -Windows.Win32.Storage.FileSystem.MOVEFILE_WRITE_THROUGH -Windows.Win32.Storage.FileSystem.MoveFileExW -Windows.Win32.Storage.FileSystem.OPEN_ALWAYS -Windows.Win32.Storage.FileSystem.OPEN_EXISTING -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_DUPLEX -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_INBOUND -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_OUTBOUND -Windows.Win32.Storage.FileSystem.READ_CONTROL -Windows.Win32.Storage.FileSystem.ReadFile -Windows.Win32.Storage.FileSystem.ReadFileEx -Windows.Win32.Storage.FileSystem.RemoveDirectoryW -Windows.Win32.Storage.FileSystem.SECURITY_ANONYMOUS -Windows.Win32.Storage.FileSystem.SECURITY_CONTEXT_TRACKING -Windows.Win32.Storage.FileSystem.SECURITY_DELEGATION -Windows.Win32.Storage.FileSystem.SECURITY_EFFECTIVE_ONLY -Windows.Win32.Storage.FileSystem.SECURITY_IDENTIFICATION -Windows.Win32.Storage.FileSystem.SECURITY_IMPERSONATION -Windows.Win32.Storage.FileSystem.SECURITY_SQOS_PRESENT -Windows.Win32.Storage.FileSystem.SECURITY_VALID_SQOS_FLAGS -Windows.Win32.Storage.FileSystem.SET_FILE_POINTER_MOVE_METHOD -Windows.Win32.Storage.FileSystem.SetFileAttributesW -Windows.Win32.Storage.FileSystem.SetFileInformationByHandle -Windows.Win32.Storage.FileSystem.SetFilePointerEx -Windows.Win32.Storage.FileSystem.SetFileTime -Windows.Win32.Storage.FileSystem.SPECIFIC_RIGHTS_ALL -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_ALL -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_EXECUTE -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_READ -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_REQUIRED -Windows.Win32.Storage.FileSystem.STANDARD_RIGHTS_WRITE -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_DIRECTORY -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAGS -Windows.Win32.Storage.FileSystem.SYNCHRONIZE -Windows.Win32.Storage.FileSystem.TRUNCATE_EXISTING -Windows.Win32.Storage.FileSystem.VOLUME_NAME_DOS -Windows.Win32.Storage.FileSystem.VOLUME_NAME_GUID -Windows.Win32.Storage.FileSystem.VOLUME_NAME_NONE -Windows.Win32.Storage.FileSystem.WIN32_FIND_DATAW -Windows.Win32.Storage.FileSystem.WRITE_DAC -Windows.Win32.Storage.FileSystem.WRITE_OWNER -Windows.Win32.Storage.FileSystem.WriteFileEx -Windows.Win32.System.Console.CONSOLE_MODE -Windows.Win32.System.Console.CONSOLE_READCONSOLE_CONTROL -Windows.Win32.System.Console.DISABLE_NEWLINE_AUTO_RETURN -Windows.Win32.System.Console.ENABLE_AUTO_POSITION -Windows.Win32.System.Console.ENABLE_ECHO_INPUT -Windows.Win32.System.Console.ENABLE_EXTENDED_FLAGS -Windows.Win32.System.Console.ENABLE_INSERT_MODE -Windows.Win32.System.Console.ENABLE_LINE_INPUT -Windows.Win32.System.Console.ENABLE_LVB_GRID_WORLDWIDE -Windows.Win32.System.Console.ENABLE_MOUSE_INPUT -Windows.Win32.System.Console.ENABLE_PROCESSED_INPUT -Windows.Win32.System.Console.ENABLE_PROCESSED_OUTPUT -Windows.Win32.System.Console.ENABLE_QUICK_EDIT_MODE -Windows.Win32.System.Console.ENABLE_VIRTUAL_TERMINAL_INPUT -Windows.Win32.System.Console.ENABLE_VIRTUAL_TERMINAL_PROCESSING -Windows.Win32.System.Console.ENABLE_WINDOW_INPUT -Windows.Win32.System.Console.ENABLE_WRAP_AT_EOL_OUTPUT -Windows.Win32.System.Console.GetConsoleMode -Windows.Win32.System.Console.GetStdHandle -Windows.Win32.System.Console.ReadConsoleW -Windows.Win32.System.Console.STD_ERROR_HANDLE -Windows.Win32.System.Console.STD_HANDLE -Windows.Win32.System.Console.STD_INPUT_HANDLE -Windows.Win32.System.Console.STD_OUTPUT_HANDLE -Windows.Win32.System.Console.WriteConsoleW -Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128 -Windows.Win32.System.Diagnostics.Debug.CONTEXT -Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD -Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE -Windows.Win32.System.Diagnostics.Debug.FACILITY_NT_BIT -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_ALLOCATE_BUFFER -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_ARGUMENT_ARRAY -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_HMODULE -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_STRING -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_FROM_SYSTEM -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_IGNORE_INSERTS -Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_OPTIONS -Windows.Win32.System.Diagnostics.Debug.FormatMessageW -Windows.Win32.System.Diagnostics.Debug.M128A -Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT -Windows.Win32.System.Environment.FreeEnvironmentStringsW -Windows.Win32.System.Environment.GetCommandLineW -Windows.Win32.System.Environment.GetCurrentDirectoryW -Windows.Win32.System.Environment.GetEnvironmentStringsW -Windows.Win32.System.Environment.GetEnvironmentVariableW -Windows.Win32.System.Environment.SetCurrentDirectoryW -Windows.Win32.System.Environment.SetEnvironmentVariableW -Windows.Win32.System.IO.CancelIo -Windows.Win32.System.IO.DeviceIoControl -Windows.Win32.System.IO.GetOverlappedResult -Windows.Win32.System.IO.LPOVERLAPPED_COMPLETION_ROUTINE -Windows.Win32.System.IO.OVERLAPPED -Windows.Win32.System.Ioctl.FSCTL_GET_REPARSE_POINT -Windows.Win32.System.Ioctl.FSCTL_SET_REPARSE_POINT -Windows.Win32.System.Kernel.EXCEPTION_DISPOSITION -Windows.Win32.System.Kernel.ExceptionCollidedUnwind -Windows.Win32.System.Kernel.ExceptionContinueExecution -Windows.Win32.System.Kernel.ExceptionContinueSearch -Windows.Win32.System.Kernel.ExceptionNestedException -Windows.Win32.System.Kernel.FLOATING_SAVE_AREA -Windows.Win32.System.Kernel.OBJ_DONT_REPARSE -Windows.Win32.System.LibraryLoader.GetModuleFileNameW -Windows.Win32.System.LibraryLoader.GetModuleHandleA -Windows.Win32.System.LibraryLoader.GetModuleHandleW -Windows.Win32.System.LibraryLoader.GetProcAddress -Windows.Win32.System.Performance.QueryPerformanceCounter -Windows.Win32.System.Performance.QueryPerformanceFrequency -Windows.Win32.System.Pipes.CreateNamedPipeW -Windows.Win32.System.Pipes.NAMED_PIPE_MODE -Windows.Win32.System.Pipes.PIPE_ACCEPT_REMOTE_CLIENTS -Windows.Win32.System.Pipes.PIPE_CLIENT_END -Windows.Win32.System.Pipes.PIPE_NOWAIT -Windows.Win32.System.Pipes.PIPE_READMODE_BYTE -Windows.Win32.System.Pipes.PIPE_READMODE_MESSAGE -Windows.Win32.System.Pipes.PIPE_REJECT_REMOTE_CLIENTS -Windows.Win32.System.Pipes.PIPE_SERVER_END -Windows.Win32.System.Pipes.PIPE_TYPE_BYTE -Windows.Win32.System.Pipes.PIPE_TYPE_MESSAGE -Windows.Win32.System.Pipes.PIPE_WAIT -Windows.Win32.System.SystemInformation.GetSystemDirectoryW -Windows.Win32.System.SystemInformation.GetSystemInfo -Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime -Windows.Win32.System.SystemInformation.GetWindowsDirectoryW -Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE -Windows.Win32.System.SystemInformation.SYSTEM_INFO -Windows.Win32.System.SystemServices.DLL_PROCESS_DETACH -Windows.Win32.System.SystemServices.DLL_THREAD_DETACH -Windows.Win32.System.SystemServices.EXCEPTION_MAXIMUM_PARAMETERS -Windows.Win32.System.SystemServices.IO_REPARSE_TAG_MOUNT_POINT -Windows.Win32.System.SystemServices.IO_REPARSE_TAG_SYMLINK -Windows.Win32.System.Threading.ABOVE_NORMAL_PRIORITY_CLASS -Windows.Win32.System.Threading.AcquireSRWLockExclusive -Windows.Win32.System.Threading.AcquireSRWLockShared -Windows.Win32.System.Threading.ALL_PROCESSOR_GROUPS -Windows.Win32.System.Threading.BELOW_NORMAL_PRIORITY_CLASS -Windows.Win32.System.Threading.CREATE_BREAKAWAY_FROM_JOB -Windows.Win32.System.Threading.CREATE_DEFAULT_ERROR_MODE -Windows.Win32.System.Threading.CREATE_FORCEDOS -Windows.Win32.System.Threading.CREATE_IGNORE_SYSTEM_DEFAULT -Windows.Win32.System.Threading.CREATE_NEW_CONSOLE -Windows.Win32.System.Threading.CREATE_NEW_PROCESS_GROUP -Windows.Win32.System.Threading.CREATE_NO_WINDOW -Windows.Win32.System.Threading.CREATE_PRESERVE_CODE_AUTHZ_LEVEL -Windows.Win32.System.Threading.CREATE_PROTECTED_PROCESS -Windows.Win32.System.Threading.CREATE_SECURE_PROCESS -Windows.Win32.System.Threading.CREATE_SEPARATE_WOW_VDM -Windows.Win32.System.Threading.CREATE_SHARED_WOW_VDM -Windows.Win32.System.Threading.CREATE_SUSPENDED -Windows.Win32.System.Threading.CREATE_UNICODE_ENVIRONMENT -Windows.Win32.System.Threading.CREATE_WAITABLE_TIMER_HIGH_RESOLUTION -Windows.Win32.System.Threading.CREATE_WAITABLE_TIMER_MANUAL_RESET -Windows.Win32.System.Threading.CreateEventW -Windows.Win32.System.Threading.CreateProcessW -Windows.Win32.System.Threading.CreateThread -Windows.Win32.System.Threading.CreateWaitableTimerExW -Windows.Win32.System.Threading.DEBUG_ONLY_THIS_PROCESS -Windows.Win32.System.Threading.DEBUG_PROCESS -Windows.Win32.System.Threading.DeleteProcThreadAttributeList -Windows.Win32.System.Threading.DETACHED_PROCESS -Windows.Win32.System.Threading.ExitProcess -Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT -Windows.Win32.System.Threading.GetActiveProcessorCount -Windows.Win32.System.Threading.GetCurrentProcess -Windows.Win32.System.Threading.GetCurrentProcessId -Windows.Win32.System.Threading.GetCurrentThread -Windows.Win32.System.Threading.GetExitCodeProcess -Windows.Win32.System.Threading.GetProcessId -Windows.Win32.System.Threading.HIGH_PRIORITY_CLASS -Windows.Win32.System.Threading.IDLE_PRIORITY_CLASS -Windows.Win32.System.Threading.INFINITE -Windows.Win32.System.Threading.INHERIT_CALLER_PRIORITY -Windows.Win32.System.Threading.INHERIT_PARENT_AFFINITY -Windows.Win32.System.Threading.INIT_ONCE_INIT_FAILED -Windows.Win32.System.Threading.InitializeProcThreadAttributeList -Windows.Win32.System.Threading.InitOnceBeginInitialize -Windows.Win32.System.Threading.InitOnceComplete -Windows.Win32.System.Threading.LPPROC_THREAD_ATTRIBUTE_LIST -Windows.Win32.System.Threading.LPTHREAD_START_ROUTINE -Windows.Win32.System.Threading.NORMAL_PRIORITY_CLASS -Windows.Win32.System.Threading.OpenProcessToken -Windows.Win32.System.Threading.PROCESS_CREATION_FLAGS -Windows.Win32.System.Threading.PROCESS_INFORMATION -Windows.Win32.System.Threading.PROCESS_MODE_BACKGROUND_BEGIN -Windows.Win32.System.Threading.PROCESS_MODE_BACKGROUND_END -Windows.Win32.System.Threading.PROFILE_KERNEL -Windows.Win32.System.Threading.PROFILE_SERVER -Windows.Win32.System.Threading.PROFILE_USER -Windows.Win32.System.Threading.REALTIME_PRIORITY_CLASS -Windows.Win32.System.Threading.ReleaseSRWLockExclusive -Windows.Win32.System.Threading.ReleaseSRWLockShared -Windows.Win32.System.Threading.SetThreadStackGuarantee -Windows.Win32.System.Threading.SetWaitableTimer -Windows.Win32.System.Threading.Sleep -Windows.Win32.System.Threading.SleepConditionVariableSRW -Windows.Win32.System.Threading.SleepEx -Windows.Win32.System.Threading.STACK_SIZE_PARAM_IS_A_RESERVATION -Windows.Win32.System.Threading.STARTF_FORCEOFFFEEDBACK -Windows.Win32.System.Threading.STARTF_FORCEONFEEDBACK -Windows.Win32.System.Threading.STARTF_PREVENTPINNING -Windows.Win32.System.Threading.STARTF_RUNFULLSCREEN -Windows.Win32.System.Threading.STARTF_TITLEISAPPID -Windows.Win32.System.Threading.STARTF_TITLEISLINKNAME -Windows.Win32.System.Threading.STARTF_UNTRUSTEDSOURCE -Windows.Win32.System.Threading.STARTF_USECOUNTCHARS -Windows.Win32.System.Threading.STARTF_USEFILLATTRIBUTE -Windows.Win32.System.Threading.STARTF_USEHOTKEY -Windows.Win32.System.Threading.STARTF_USEPOSITION -Windows.Win32.System.Threading.STARTF_USESHOWWINDOW -Windows.Win32.System.Threading.STARTF_USESIZE -Windows.Win32.System.Threading.STARTF_USESTDHANDLES -Windows.Win32.System.Threading.STARTUPINFOEXW -Windows.Win32.System.Threading.STARTUPINFOW -Windows.Win32.System.Threading.STARTUPINFOW_FLAGS -Windows.Win32.System.Threading.SwitchToThread -Windows.Win32.System.Threading.TerminateProcess -Windows.Win32.System.Threading.THREAD_CREATE_RUN_IMMEDIATELY -Windows.Win32.System.Threading.THREAD_CREATE_SUSPENDED -Windows.Win32.System.Threading.THREAD_CREATION_FLAGS -Windows.Win32.System.Threading.TIMER_ALL_ACCESS -Windows.Win32.System.Threading.TIMER_MODIFY_STATE -Windows.Win32.System.Threading.TLS_OUT_OF_INDEXES -Windows.Win32.System.Threading.TlsAlloc -Windows.Win32.System.Threading.TlsFree -Windows.Win32.System.Threading.TlsGetValue -Windows.Win32.System.Threading.TlsSetValue -Windows.Win32.System.Threading.TryAcquireSRWLockExclusive -Windows.Win32.System.Threading.TryAcquireSRWLockShared -Windows.Win32.System.Threading.UpdateProcThreadAttribute -Windows.Win32.System.Threading.WaitForMultipleObjects -Windows.Win32.System.Threading.WaitForSingleObject -Windows.Win32.System.Threading.WakeAllConditionVariable -Windows.Win32.System.Threading.WakeConditionVariable -Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE -Windows.Win32.UI.Shell.GetUserProfileDirectoryW -// tidy-alphabetical-end - diff --git a/library/std/src/sys/windows/c/windows_sys.rs b/library/std/src/sys/windows/c/windows_sys.rs deleted file mode 100644 index b38b70c8983..00000000000 --- a/library/std/src/sys/windows/c/windows_sys.rs +++ /dev/null @@ -1,4353 +0,0 @@ -// This file is autogenerated. -// -// To add bindings, edit windows_sys.lst then use `./x run generate-windows-sys` to -// regenerate the bindings. -// -// ignore-tidy-filelength -// Bindings generated by `windows-bindgen` 0.52.0 - -#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] -#[link(name = "advapi32")] -extern "system" { - pub fn OpenProcessToken( - processhandle: HANDLE, - desiredaccess: TOKEN_ACCESS_MASK, - tokenhandle: *mut HANDLE, - ) -> BOOL; -} -#[link(name = "advapi32")] -extern "system" { - #[link_name = "SystemFunction036"] - pub fn RtlGenRandom(randombuffer: *mut ::core::ffi::c_void, randombufferlength: u32) - -> BOOLEAN; -} -#[link(name = "bcrypt")] -extern "system" { - pub fn BCryptGenRandom( - halgorithm: BCRYPT_ALG_HANDLE, - pbbuffer: *mut u8, - cbbuffer: u32, - dwflags: BCRYPTGENRANDOM_FLAGS, - ) -> NTSTATUS; -} -#[link(name = "kernel32")] -extern "system" { - pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn CancelIo(hfile: HANDLE) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CloseHandle(hobject: HANDLE) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CompareStringOrdinal( - lpstring1: PCWSTR, - cchcount1: i32, - lpstring2: PCWSTR, - cchcount2: i32, - bignorecase: BOOL, - ) -> COMPARESTRING_RESULT; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CopyFileExW( - lpexistingfilename: PCWSTR, - lpnewfilename: PCWSTR, - lpprogressroutine: LPPROGRESS_ROUTINE, - lpdata: *const ::core::ffi::c_void, - pbcancel: *mut BOOL, - dwcopyflags: u32, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateDirectoryW( - lppathname: PCWSTR, - lpsecurityattributes: *const SECURITY_ATTRIBUTES, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateEventW( - lpeventattributes: *const SECURITY_ATTRIBUTES, - bmanualreset: BOOL, - binitialstate: BOOL, - lpname: PCWSTR, - ) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateFileW( - lpfilename: PCWSTR, - dwdesiredaccess: u32, - dwsharemode: FILE_SHARE_MODE, - lpsecurityattributes: *const SECURITY_ATTRIBUTES, - dwcreationdisposition: FILE_CREATION_DISPOSITION, - dwflagsandattributes: FILE_FLAGS_AND_ATTRIBUTES, - htemplatefile: HANDLE, - ) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateHardLinkW( - lpfilename: PCWSTR, - lpexistingfilename: PCWSTR, - lpsecurityattributes: *const SECURITY_ATTRIBUTES, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateNamedPipeW( - lpname: PCWSTR, - dwopenmode: FILE_FLAGS_AND_ATTRIBUTES, - dwpipemode: NAMED_PIPE_MODE, - nmaxinstances: u32, - noutbuffersize: u32, - ninbuffersize: u32, - ndefaulttimeout: u32, - lpsecurityattributes: *const SECURITY_ATTRIBUTES, - ) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateProcessW( - lpapplicationname: PCWSTR, - lpcommandline: PWSTR, - lpprocessattributes: *const SECURITY_ATTRIBUTES, - lpthreadattributes: *const SECURITY_ATTRIBUTES, - binherithandles: BOOL, - dwcreationflags: PROCESS_CREATION_FLAGS, - lpenvironment: *const ::core::ffi::c_void, - lpcurrentdirectory: PCWSTR, - lpstartupinfo: *const STARTUPINFOW, - lpprocessinformation: *mut PROCESS_INFORMATION, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateSymbolicLinkW( - lpsymlinkfilename: PCWSTR, - lptargetfilename: PCWSTR, - dwflags: SYMBOLIC_LINK_FLAGS, - ) -> BOOLEAN; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateThread( - lpthreadattributes: *const SECURITY_ATTRIBUTES, - dwstacksize: usize, - lpstartaddress: LPTHREAD_START_ROUTINE, - lpparameter: *const ::core::ffi::c_void, - dwcreationflags: THREAD_CREATION_FLAGS, - lpthreadid: *mut u32, - ) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn CreateWaitableTimerExW( - lptimerattributes: *const SECURITY_ATTRIBUTES, - lptimername: PCWSTR, - dwflags: u32, - dwdesiredaccess: u32, - ) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn DeleteFileW(lpfilename: PCWSTR) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn DeviceIoControl( - hdevice: HANDLE, - dwiocontrolcode: u32, - lpinbuffer: *const ::core::ffi::c_void, - ninbuffersize: u32, - lpoutbuffer: *mut ::core::ffi::c_void, - noutbuffersize: u32, - lpbytesreturned: *mut u32, - lpoverlapped: *mut OVERLAPPED, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn DuplicateHandle( - hsourceprocesshandle: HANDLE, - hsourcehandle: HANDLE, - htargetprocesshandle: HANDLE, - lptargethandle: *mut HANDLE, - dwdesiredaccess: u32, - binherithandle: BOOL, - dwoptions: DUPLICATE_HANDLE_OPTIONS, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn ExitProcess(uexitcode: u32) -> !; -} -#[link(name = "kernel32")] -extern "system" { - pub fn FindClose(hfindfile: HANDLE) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn FindFirstFileW(lpfilename: PCWSTR, lpfindfiledata: *mut WIN32_FIND_DATAW) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn FindNextFileW(hfindfile: HANDLE, lpfindfiledata: *mut WIN32_FIND_DATAW) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn FlushFileBuffers(hfile: HANDLE) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn FormatMessageW( - dwflags: FORMAT_MESSAGE_OPTIONS, - lpsource: *const ::core::ffi::c_void, - dwmessageid: u32, - dwlanguageid: u32, - lpbuffer: PWSTR, - nsize: u32, - arguments: *const *const i8, - ) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetActiveProcessorCount(groupnumber: u16) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetCommandLineW() -> PCWSTR; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetConsoleMode(hconsolehandle: HANDLE, lpmode: *mut CONSOLE_MODE) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetCurrentDirectoryW(nbufferlength: u32, lpbuffer: PWSTR) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetCurrentProcess() -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetCurrentProcessId() -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetCurrentThread() -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetEnvironmentStringsW() -> PWSTR; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetEnvironmentVariableW(lpname: PCWSTR, lpbuffer: PWSTR, nsize: u32) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetExitCodeProcess(hprocess: HANDLE, lpexitcode: *mut u32) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetFileAttributesW(lpfilename: PCWSTR) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetFileInformationByHandle( - hfile: HANDLE, - lpfileinformation: *mut BY_HANDLE_FILE_INFORMATION, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetFileInformationByHandleEx( - hfile: HANDLE, - fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, - lpfileinformation: *mut ::core::ffi::c_void, - dwbuffersize: u32, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetFileType(hfile: HANDLE) -> FILE_TYPE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetFinalPathNameByHandleW( - hfile: HANDLE, - lpszfilepath: PWSTR, - cchfilepath: u32, - dwflags: GETFINALPATHNAMEBYHANDLE_FLAGS, - ) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetFullPathNameW( - lpfilename: PCWSTR, - nbufferlength: u32, - lpbuffer: PWSTR, - lpfilepart: *mut PWSTR, - ) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetLastError() -> WIN32_ERROR; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetModuleFileNameW(hmodule: HMODULE, lpfilename: PWSTR, nsize: u32) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetModuleHandleA(lpmodulename: PCSTR) -> HMODULE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetModuleHandleW(lpmodulename: PCWSTR) -> HMODULE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetOverlappedResult( - hfile: HANDLE, - lpoverlapped: *const OVERLAPPED, - lpnumberofbytestransferred: *mut u32, - bwait: BOOL, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetProcAddress(hmodule: HMODULE, lpprocname: PCSTR) -> FARPROC; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetProcessId(process: HANDLE) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetStdHandle(nstdhandle: STD_HANDLE) -> HANDLE; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetSystemDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetTempPathW(nbufferlength: u32, lpbuffer: PWSTR) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn GetWindowsDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn InitOnceBeginInitialize( - lpinitonce: *mut INIT_ONCE, - dwflags: u32, - fpending: *mut BOOL, - lpcontext: *mut *mut ::core::ffi::c_void, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn InitOnceComplete( - lpinitonce: *mut INIT_ONCE, - dwflags: u32, - lpcontext: *const ::core::ffi::c_void, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn InitializeProcThreadAttributeList( - lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST, - dwattributecount: u32, - dwflags: u32, - lpsize: *mut usize, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn MoveFileExW( - lpexistingfilename: PCWSTR, - lpnewfilename: PCWSTR, - dwflags: MOVE_FILE_FLAGS, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn MultiByteToWideChar( - codepage: u32, - dwflags: MULTI_BYTE_TO_WIDE_CHAR_FLAGS, - lpmultibytestr: PCSTR, - cbmultibyte: i32, - lpwidecharstr: PWSTR, - cchwidechar: i32, - ) -> i32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn QueryPerformanceCounter(lpperformancecount: *mut i64) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn QueryPerformanceFrequency(lpfrequency: *mut i64) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn ReadConsoleW( - hconsoleinput: HANDLE, - lpbuffer: *mut ::core::ffi::c_void, - nnumberofcharstoread: u32, - lpnumberofcharsread: *mut u32, - pinputcontrol: *const CONSOLE_READCONSOLE_CONTROL, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn ReadFile( - hfile: HANDLE, - lpbuffer: *mut u8, - nnumberofbytestoread: u32, - lpnumberofbytesread: *mut u32, - lpoverlapped: *mut OVERLAPPED, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn ReadFileEx( - hfile: HANDLE, - lpbuffer: *mut u8, - nnumberofbytestoread: u32, - lpoverlapped: *mut OVERLAPPED, - lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn RemoveDirectoryW(lppathname: PCWSTR) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetCurrentDirectoryW(lppathname: PCWSTR) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetEnvironmentVariableW(lpname: PCWSTR, lpvalue: PCWSTR) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetFileAttributesW( - lpfilename: PCWSTR, - dwfileattributes: FILE_FLAGS_AND_ATTRIBUTES, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetFileInformationByHandle( - hfile: HANDLE, - fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, - lpfileinformation: *const ::core::ffi::c_void, - dwbuffersize: u32, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetFilePointerEx( - hfile: HANDLE, - lidistancetomove: i64, - lpnewfilepointer: *mut i64, - dwmovemethod: SET_FILE_POINTER_MOVE_METHOD, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetFileTime( - hfile: HANDLE, - lpcreationtime: *const FILETIME, - lplastaccesstime: *const FILETIME, - lplastwritetime: *const FILETIME, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetHandleInformation(hobject: HANDLE, dwmask: u32, dwflags: HANDLE_FLAGS) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetLastError(dwerrcode: WIN32_ERROR) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetThreadStackGuarantee(stacksizeinbytes: *mut u32) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SetWaitableTimer( - htimer: HANDLE, - lpduetime: *const i64, - lperiod: i32, - pfncompletionroutine: PTIMERAPCROUTINE, - lpargtocompletionroutine: *const ::core::ffi::c_void, - fresume: BOOL, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn Sleep(dwmilliseconds: u32) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn SleepConditionVariableSRW( - conditionvariable: *mut CONDITION_VARIABLE, - srwlock: *mut SRWLOCK, - dwmilliseconds: u32, - flags: u32, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SleepEx(dwmilliseconds: u32, balertable: BOOL) -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn SwitchToThread() -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TerminateProcess(hprocess: HANDLE, uexitcode: u32) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TlsAlloc() -> u32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TlsFree(dwtlsindex: u32) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TlsGetValue(dwtlsindex: u32) -> *mut ::core::ffi::c_void; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const ::core::ffi::c_void) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TryAcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> BOOLEAN; -} -#[link(name = "kernel32")] -extern "system" { - pub fn TryAcquireSRWLockShared(srwlock: *mut SRWLOCK) -> BOOLEAN; -} -#[link(name = "kernel32")] -extern "system" { - pub fn UpdateProcThreadAttribute( - lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST, - dwflags: u32, - attribute: usize, - lpvalue: *const ::core::ffi::c_void, - cbsize: usize, - lppreviousvalue: *mut ::core::ffi::c_void, - lpreturnsize: *const usize, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn WaitForMultipleObjects( - ncount: u32, - lphandles: *const HANDLE, - bwaitall: BOOL, - dwmilliseconds: u32, - ) -> WAIT_EVENT; -} -#[link(name = "kernel32")] -extern "system" { - pub fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> WAIT_EVENT; -} -#[link(name = "kernel32")] -extern "system" { - pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> (); -} -#[link(name = "kernel32")] -extern "system" { - pub fn WideCharToMultiByte( - codepage: u32, - dwflags: u32, - lpwidecharstr: PCWSTR, - cchwidechar: i32, - lpmultibytestr: PSTR, - cbmultibyte: i32, - lpdefaultchar: PCSTR, - lpuseddefaultchar: *mut BOOL, - ) -> i32; -} -#[link(name = "kernel32")] -extern "system" { - pub fn WriteConsoleW( - hconsoleoutput: HANDLE, - lpbuffer: *const ::core::ffi::c_void, - nnumberofcharstowrite: u32, - lpnumberofcharswritten: *mut u32, - lpreserved: *const ::core::ffi::c_void, - ) -> BOOL; -} -#[link(name = "kernel32")] -extern "system" { - pub fn WriteFileEx( - hfile: HANDLE, - lpbuffer: *const u8, - nnumberofbytestowrite: u32, - lpoverlapped: *mut OVERLAPPED, - lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; -} -#[link(name = "ntdll")] -extern "system" { - pub fn NtCreateFile( - filehandle: *mut HANDLE, - desiredaccess: FILE_ACCESS_RIGHTS, - objectattributes: *const OBJECT_ATTRIBUTES, - iostatusblock: *mut IO_STATUS_BLOCK, - allocationsize: *const i64, - fileattributes: FILE_FLAGS_AND_ATTRIBUTES, - shareaccess: FILE_SHARE_MODE, - createdisposition: NTCREATEFILE_CREATE_DISPOSITION, - createoptions: NTCREATEFILE_CREATE_OPTIONS, - eabuffer: *const ::core::ffi::c_void, - ealength: u32, - ) -> NTSTATUS; -} -#[link(name = "ntdll")] -extern "system" { - pub fn NtReadFile( - filehandle: HANDLE, - event: HANDLE, - apcroutine: PIO_APC_ROUTINE, - apccontext: *const ::core::ffi::c_void, - iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *mut ::core::ffi::c_void, - length: u32, - byteoffset: *const i64, - key: *const u32, - ) -> NTSTATUS; -} -#[link(name = "ntdll")] -extern "system" { - pub fn NtWriteFile( - filehandle: HANDLE, - event: HANDLE, - apcroutine: PIO_APC_ROUTINE, - apccontext: *const ::core::ffi::c_void, - iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *const ::core::ffi::c_void, - length: u32, - byteoffset: *const i64, - key: *const u32, - ) -> NTSTATUS; -} -#[link(name = "ntdll")] -extern "system" { - pub fn RtlNtStatusToDosError(status: NTSTATUS) -> u32; -} -#[link(name = "userenv")] -extern "system" { - pub fn GetUserProfileDirectoryW( - htoken: HANDLE, - lpprofiledir: PWSTR, - lpcchsize: *mut u32, - ) -> BOOL; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn WSACleanup() -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn WSADuplicateSocketW( - s: SOCKET, - dwprocessid: u32, - lpprotocolinfo: *mut WSAPROTOCOL_INFOW, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn WSAGetLastError() -> WSA_ERROR; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn WSARecv( - s: SOCKET, - lpbuffers: *const WSABUF, - dwbuffercount: u32, - lpnumberofbytesrecvd: *mut u32, - lpflags: *mut u32, - lpoverlapped: *mut OVERLAPPED, - lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn WSASend( - s: SOCKET, - lpbuffers: *const WSABUF, - dwbuffercount: u32, - lpnumberofbytessent: *mut u32, - dwflags: u32, - lpoverlapped: *mut OVERLAPPED, - lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn WSASocketW( - af: i32, - r#type: i32, - protocol: i32, - lpprotocolinfo: *const WSAPROTOCOL_INFOW, - g: u32, - dwflags: u32, - ) -> SOCKET; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn accept(s: SOCKET, addr: *mut SOCKADDR, addrlen: *mut i32) -> SOCKET; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn bind(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn closesocket(s: SOCKET) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn connect(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA) -> (); -} -#[link(name = "ws2_32")] -extern "system" { - pub fn getaddrinfo( - pnodename: PCSTR, - pservicename: PCSTR, - phints: *const ADDRINFOA, - ppresult: *mut *mut ADDRINFOA, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn getpeername(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn getsockname(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn getsockopt(s: SOCKET, level: i32, optname: i32, optval: PSTR, optlen: *mut i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn ioctlsocket(s: SOCKET, cmd: i32, argp: *mut u32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn listen(s: SOCKET, backlog: i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn recv(s: SOCKET, buf: PSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn recvfrom( - s: SOCKET, - buf: PSTR, - len: i32, - flags: i32, - from: *mut SOCKADDR, - fromlen: *mut i32, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn select( - nfds: i32, - readfds: *mut FD_SET, - writefds: *mut FD_SET, - exceptfds: *mut FD_SET, - timeout: *const TIMEVAL, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn send(s: SOCKET, buf: PCSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn sendto( - s: SOCKET, - buf: PCSTR, - len: i32, - flags: i32, - to: *const SOCKADDR, - tolen: i32, - ) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn setsockopt(s: SOCKET, level: i32, optname: i32, optval: PCSTR, optlen: i32) -> i32; -} -#[link(name = "ws2_32")] -extern "system" { - pub fn shutdown(s: SOCKET, how: WINSOCK_SHUTDOWN_HOW) -> i32; -} -pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32; -pub type ADDRESS_FAMILY = u16; -#[repr(C)] -pub struct ADDRINFOA { - pub ai_flags: i32, - pub ai_family: i32, - pub ai_socktype: i32, - pub ai_protocol: i32, - pub ai_addrlen: usize, - pub ai_canonname: PSTR, - pub ai_addr: *mut SOCKADDR, - pub ai_next: *mut ADDRINFOA, -} -impl ::core::marker::Copy for ADDRINFOA {} -impl ::core::clone::Clone for ADDRINFOA { - fn clone(&self) -> Self { - *self - } -} -pub const AF_INET: ADDRESS_FAMILY = 2u16; -pub const AF_INET6: ADDRESS_FAMILY = 23u16; -pub const AF_UNIX: u16 = 1u16; -pub const AF_UNSPEC: ADDRESS_FAMILY = 0u16; -pub const ALL_PROCESSOR_GROUPS: u16 = 65535u16; -#[repr(C)] -pub union ARM64_NT_NEON128 { - pub Anonymous: ARM64_NT_NEON128_0, - pub D: [f64; 2], - pub S: [f32; 4], - pub H: [u16; 8], - pub B: [u8; 16], -} -impl ::core::marker::Copy for ARM64_NT_NEON128 {} -impl ::core::clone::Clone for ARM64_NT_NEON128 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct ARM64_NT_NEON128_0 { - pub Low: u64, - pub High: i64, -} -impl ::core::marker::Copy for ARM64_NT_NEON128_0 {} -impl ::core::clone::Clone for ARM64_NT_NEON128_0 { - fn clone(&self) -> Self { - *self - } -} -pub type BCRYPTGENRANDOM_FLAGS = u32; -pub type BCRYPT_ALG_HANDLE = *mut ::core::ffi::c_void; -pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: BCRYPTGENRANDOM_FLAGS = 2u32; -pub const BELOW_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 16384u32; -pub type BOOL = i32; -pub type BOOLEAN = u8; -#[repr(C)] -pub struct BY_HANDLE_FILE_INFORMATION { - pub dwFileAttributes: u32, - pub ftCreationTime: FILETIME, - pub ftLastAccessTime: FILETIME, - pub ftLastWriteTime: FILETIME, - pub dwVolumeSerialNumber: u32, - pub nFileSizeHigh: u32, - pub nFileSizeLow: u32, - pub nNumberOfLinks: u32, - pub nFileIndexHigh: u32, - pub nFileIndexLow: u32, -} -impl ::core::marker::Copy for BY_HANDLE_FILE_INFORMATION {} -impl ::core::clone::Clone for BY_HANDLE_FILE_INFORMATION { - fn clone(&self) -> Self { - *self - } -} -pub const CALLBACK_CHUNK_FINISHED: LPPROGRESS_ROUTINE_CALLBACK_REASON = 0u32; -pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32; -pub type COMPARESTRING_RESULT = i32; -#[repr(C)] -pub struct CONDITION_VARIABLE { - pub Ptr: *mut ::core::ffi::c_void, -} -impl ::core::marker::Copy for CONDITION_VARIABLE {} -impl ::core::clone::Clone for CONDITION_VARIABLE { - fn clone(&self) -> Self { - *self - } -} -pub type CONSOLE_MODE = u32; -#[repr(C)] -pub struct CONSOLE_READCONSOLE_CONTROL { - pub nLength: u32, - pub nInitialChars: u32, - pub dwCtrlWakeupMask: u32, - pub dwControlKeyState: u32, -} -impl ::core::marker::Copy for CONSOLE_READCONSOLE_CONTROL {} -impl ::core::clone::Clone for CONSOLE_READCONSOLE_CONTROL { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -pub struct CONTEXT { - pub ContextFlags: CONTEXT_FLAGS, - pub Cpsr: u32, - pub Anonymous: CONTEXT_0, - pub Sp: u64, - pub Pc: u64, - pub V: [ARM64_NT_NEON128; 32], - pub Fpcr: u32, - pub Fpsr: u32, - pub Bcr: [u32; 8], - pub Bvr: [u64; 8], - pub Wcr: [u32; 2], - pub Wvr: [u64; 2], -} -#[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT {} -#[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -pub union CONTEXT_0 { - pub Anonymous: CONTEXT_0_0, - pub X: [u64; 31], -} -#[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT_0 {} -#[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -pub struct CONTEXT_0_0 { - pub X0: u64, - pub X1: u64, - pub X2: u64, - pub X3: u64, - pub X4: u64, - pub X5: u64, - pub X6: u64, - pub X7: u64, - pub X8: u64, - pub X9: u64, - pub X10: u64, - pub X11: u64, - pub X12: u64, - pub X13: u64, - pub X14: u64, - pub X15: u64, - pub X16: u64, - pub X17: u64, - pub X18: u64, - pub X19: u64, - pub X20: u64, - pub X21: u64, - pub X22: u64, - pub X23: u64, - pub X24: u64, - pub X25: u64, - pub X26: u64, - pub X27: u64, - pub X28: u64, - pub Fp: u64, - pub Lr: u64, -} -#[cfg(target_arch = "aarch64")] -impl ::core::marker::Copy for CONTEXT_0_0 {} -#[cfg(target_arch = "aarch64")] -impl ::core::clone::Clone for CONTEXT_0_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86_64")] -pub struct CONTEXT { - pub P1Home: u64, - pub P2Home: u64, - pub P3Home: u64, - pub P4Home: u64, - pub P5Home: u64, - pub P6Home: u64, - pub ContextFlags: CONTEXT_FLAGS, - pub MxCsr: u32, - pub SegCs: u16, - pub SegDs: u16, - pub SegEs: u16, - pub SegFs: u16, - pub SegGs: u16, - pub SegSs: u16, - pub EFlags: u32, - pub Dr0: u64, - pub Dr1: u64, - pub Dr2: u64, - pub Dr3: u64, - pub Dr6: u64, - pub Dr7: u64, - pub Rax: u64, - pub Rcx: u64, - pub Rdx: u64, - pub Rbx: u64, - pub Rsp: u64, - pub Rbp: u64, - pub Rsi: u64, - pub Rdi: u64, - pub R8: u64, - pub R9: u64, - pub R10: u64, - pub R11: u64, - pub R12: u64, - pub R13: u64, - pub R14: u64, - pub R15: u64, - pub Rip: u64, - pub Anonymous: CONTEXT_0, - pub VectorRegister: [M128A; 26], - pub VectorControl: u64, - pub DebugControl: u64, - pub LastBranchToRip: u64, - pub LastBranchFromRip: u64, - pub LastExceptionToRip: u64, - pub LastExceptionFromRip: u64, -} -#[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT {} -#[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86_64")] -pub union CONTEXT_0 { - pub FltSave: XSAVE_FORMAT, - pub Anonymous: CONTEXT_0_0, -} -#[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT_0 {} -#[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86_64")] -pub struct CONTEXT_0_0 { - pub Header: [M128A; 2], - pub Legacy: [M128A; 8], - pub Xmm0: M128A, - pub Xmm1: M128A, - pub Xmm2: M128A, - pub Xmm3: M128A, - pub Xmm4: M128A, - pub Xmm5: M128A, - pub Xmm6: M128A, - pub Xmm7: M128A, - pub Xmm8: M128A, - pub Xmm9: M128A, - pub Xmm10: M128A, - pub Xmm11: M128A, - pub Xmm12: M128A, - pub Xmm13: M128A, - pub Xmm14: M128A, - pub Xmm15: M128A, -} -#[cfg(target_arch = "x86_64")] -impl ::core::marker::Copy for CONTEXT_0_0 {} -#[cfg(target_arch = "x86_64")] -impl ::core::clone::Clone for CONTEXT_0_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86")] -pub struct CONTEXT { - pub ContextFlags: CONTEXT_FLAGS, - pub Dr0: u32, - pub Dr1: u32, - pub Dr2: u32, - pub Dr3: u32, - pub Dr6: u32, - pub Dr7: u32, - pub FloatSave: FLOATING_SAVE_AREA, - pub SegGs: u32, - pub SegFs: u32, - pub SegEs: u32, - pub SegDs: u32, - pub Edi: u32, - pub Esi: u32, - pub Ebx: u32, - pub Edx: u32, - pub Ecx: u32, - pub Eax: u32, - pub Ebp: u32, - pub Eip: u32, - pub SegCs: u32, - pub EFlags: u32, - pub Esp: u32, - pub SegSs: u32, - pub ExtendedRegisters: [u8; 512], -} -#[cfg(target_arch = "x86")] -impl ::core::marker::Copy for CONTEXT {} -#[cfg(target_arch = "x86")] -impl ::core::clone::Clone for CONTEXT { - fn clone(&self) -> Self { - *self - } -} -pub type CONTEXT_FLAGS = u32; -pub const CP_UTF8: u32 = 65001u32; -pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32; -pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32; -pub const CREATE_DEFAULT_ERROR_MODE: PROCESS_CREATION_FLAGS = 67108864u32; -pub const CREATE_FORCEDOS: PROCESS_CREATION_FLAGS = 8192u32; -pub const CREATE_IGNORE_SYSTEM_DEFAULT: PROCESS_CREATION_FLAGS = 2147483648u32; -pub const CREATE_NEW: FILE_CREATION_DISPOSITION = 1u32; -pub const CREATE_NEW_CONSOLE: PROCESS_CREATION_FLAGS = 16u32; -pub const CREATE_NEW_PROCESS_GROUP: PROCESS_CREATION_FLAGS = 512u32; -pub const CREATE_NO_WINDOW: PROCESS_CREATION_FLAGS = 134217728u32; -pub const CREATE_PRESERVE_CODE_AUTHZ_LEVEL: PROCESS_CREATION_FLAGS = 33554432u32; -pub const CREATE_PROTECTED_PROCESS: PROCESS_CREATION_FLAGS = 262144u32; -pub const CREATE_SECURE_PROCESS: PROCESS_CREATION_FLAGS = 4194304u32; -pub const CREATE_SEPARATE_WOW_VDM: PROCESS_CREATION_FLAGS = 2048u32; -pub const CREATE_SHARED_WOW_VDM: PROCESS_CREATION_FLAGS = 4096u32; -pub const CREATE_SUSPENDED: PROCESS_CREATION_FLAGS = 4u32; -pub const CREATE_UNICODE_ENVIRONMENT: PROCESS_CREATION_FLAGS = 1024u32; -pub const CREATE_WAITABLE_TIMER_HIGH_RESOLUTION: u32 = 2u32; -pub const CREATE_WAITABLE_TIMER_MANUAL_RESET: u32 = 1u32; -pub const CSTR_EQUAL: COMPARESTRING_RESULT = 2i32; -pub const CSTR_GREATER_THAN: COMPARESTRING_RESULT = 3i32; -pub const CSTR_LESS_THAN: COMPARESTRING_RESULT = 1i32; -pub const DEBUG_ONLY_THIS_PROCESS: PROCESS_CREATION_FLAGS = 2u32; -pub const DEBUG_PROCESS: PROCESS_CREATION_FLAGS = 1u32; -pub const DELETE: FILE_ACCESS_RIGHTS = 65536u32; -pub const DETACHED_PROCESS: PROCESS_CREATION_FLAGS = 8u32; -pub const DISABLE_NEWLINE_AUTO_RETURN: CONSOLE_MODE = 8u32; -pub const DLL_PROCESS_DETACH: u32 = 0u32; -pub const DLL_THREAD_DETACH: u32 = 3u32; -pub const DNS_ERROR_ADDRESS_REQUIRED: WIN32_ERROR = 9573u32; -pub const DNS_ERROR_ALIAS_LOOP: WIN32_ERROR = 9722u32; -pub const DNS_ERROR_AUTOZONE_ALREADY_EXISTS: WIN32_ERROR = 9610u32; -pub const DNS_ERROR_AXFR: WIN32_ERROR = 9752u32; -pub const DNS_ERROR_BACKGROUND_LOADING: WIN32_ERROR = 9568u32; -pub const DNS_ERROR_BAD_KEYMASTER: WIN32_ERROR = 9122u32; -pub const DNS_ERROR_BAD_PACKET: WIN32_ERROR = 9502u32; -pub const DNS_ERROR_CANNOT_FIND_ROOT_HINTS: WIN32_ERROR = 9564u32; -pub const DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS: WIN32_ERROR = 9977u32; -pub const DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST: WIN32_ERROR = 9976u32; -pub const DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED: WIN32_ERROR = 9975u32; -pub const DNS_ERROR_CNAME_COLLISION: WIN32_ERROR = 9709u32; -pub const DNS_ERROR_CNAME_LOOP: WIN32_ERROR = 9707u32; -pub const DNS_ERROR_DATAFILE_OPEN_FAILURE: WIN32_ERROR = 9653u32; -pub const DNS_ERROR_DATAFILE_PARSING: WIN32_ERROR = 9655u32; -pub const DNS_ERROR_DEFAULT_SCOPE: WIN32_ERROR = 9960u32; -pub const DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE: WIN32_ERROR = 9925u32; -pub const DNS_ERROR_DEFAULT_ZONESCOPE: WIN32_ERROR = 9953u32; -pub const DNS_ERROR_DELEGATION_REQUIRED: WIN32_ERROR = 9571u32; -pub const DNS_ERROR_DNAME_COLLISION: WIN32_ERROR = 9721u32; -pub const DNS_ERROR_DNSSEC_IS_DISABLED: WIN32_ERROR = 9125u32; -pub const DNS_ERROR_DP_ALREADY_ENLISTED: WIN32_ERROR = 9904u32; -pub const DNS_ERROR_DP_ALREADY_EXISTS: WIN32_ERROR = 9902u32; -pub const DNS_ERROR_DP_DOES_NOT_EXIST: WIN32_ERROR = 9901u32; -pub const DNS_ERROR_DP_FSMO_ERROR: WIN32_ERROR = 9906u32; -pub const DNS_ERROR_DP_NOT_AVAILABLE: WIN32_ERROR = 9905u32; -pub const DNS_ERROR_DP_NOT_ENLISTED: WIN32_ERROR = 9903u32; -pub const DNS_ERROR_DS_UNAVAILABLE: WIN32_ERROR = 9717u32; -pub const DNS_ERROR_DS_ZONE_ALREADY_EXISTS: WIN32_ERROR = 9718u32; -pub const DNS_ERROR_DWORD_VALUE_TOO_LARGE: WIN32_ERROR = 9567u32; -pub const DNS_ERROR_DWORD_VALUE_TOO_SMALL: WIN32_ERROR = 9566u32; -pub const DNS_ERROR_FILE_WRITEBACK_FAILED: WIN32_ERROR = 9654u32; -pub const DNS_ERROR_FORWARDER_ALREADY_EXISTS: WIN32_ERROR = 9619u32; -pub const DNS_ERROR_INCONSISTENT_ROOT_HINTS: WIN32_ERROR = 9565u32; -pub const DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME: WIN32_ERROR = 9924u32; -pub const DNS_ERROR_INVALID_CLIENT_SUBNET_NAME: WIN32_ERROR = 9984u32; -pub const DNS_ERROR_INVALID_DATA: WIN32_ERROR = 13u32; -pub const DNS_ERROR_INVALID_DATAFILE_NAME: WIN32_ERROR = 9652u32; -pub const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET: WIN32_ERROR = 9115u32; -pub const DNS_ERROR_INVALID_IP_ADDRESS: WIN32_ERROR = 9552u32; -pub const DNS_ERROR_INVALID_KEY_SIZE: WIN32_ERROR = 9106u32; -pub const DNS_ERROR_INVALID_NAME: WIN32_ERROR = 123u32; -pub const DNS_ERROR_INVALID_NAME_CHAR: WIN32_ERROR = 9560u32; -pub const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT: WIN32_ERROR = 9124u32; -pub const DNS_ERROR_INVALID_POLICY_TABLE: WIN32_ERROR = 9572u32; -pub const DNS_ERROR_INVALID_PROPERTY: WIN32_ERROR = 9553u32; -pub const DNS_ERROR_INVALID_ROLLOVER_PERIOD: WIN32_ERROR = 9114u32; -pub const DNS_ERROR_INVALID_SCOPE_NAME: WIN32_ERROR = 9958u32; -pub const DNS_ERROR_INVALID_SCOPE_OPERATION: WIN32_ERROR = 9961u32; -pub const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD: WIN32_ERROR = 9123u32; -pub const DNS_ERROR_INVALID_TYPE: WIN32_ERROR = 9551u32; -pub const DNS_ERROR_INVALID_XML: WIN32_ERROR = 9126u32; -pub const DNS_ERROR_INVALID_ZONESCOPE_NAME: WIN32_ERROR = 9954u32; -pub const DNS_ERROR_INVALID_ZONE_OPERATION: WIN32_ERROR = 9603u32; -pub const DNS_ERROR_INVALID_ZONE_TYPE: WIN32_ERROR = 9611u32; -pub const DNS_ERROR_KEYMASTER_REQUIRED: WIN32_ERROR = 9101u32; -pub const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION: WIN32_ERROR = 9108u32; -pub const DNS_ERROR_KSP_NOT_ACCESSIBLE: WIN32_ERROR = 9112u32; -pub const DNS_ERROR_LOAD_ZONESCOPE_FAILED: WIN32_ERROR = 9956u32; -pub const DNS_ERROR_NAME_DOES_NOT_EXIST: WIN32_ERROR = 9714u32; -pub const DNS_ERROR_NAME_NOT_IN_ZONE: WIN32_ERROR = 9706u32; -pub const DNS_ERROR_NBSTAT_INIT_FAILED: WIN32_ERROR = 9617u32; -pub const DNS_ERROR_NEED_SECONDARY_ADDRESSES: WIN32_ERROR = 9614u32; -pub const DNS_ERROR_NEED_WINS_SERVERS: WIN32_ERROR = 9616u32; -pub const DNS_ERROR_NODE_CREATION_FAILED: WIN32_ERROR = 9703u32; -pub const DNS_ERROR_NODE_IS_CNAME: WIN32_ERROR = 9708u32; -pub const DNS_ERROR_NODE_IS_DNAME: WIN32_ERROR = 9720u32; -pub const DNS_ERROR_NON_RFC_NAME: WIN32_ERROR = 9556u32; -pub const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD: WIN32_ERROR = 9119u32; -pub const DNS_ERROR_NOT_ALLOWED_ON_RODC: WIN32_ERROR = 9569u32; -pub const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER: WIN32_ERROR = 9562u32; -pub const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE: WIN32_ERROR = 9102u32; -pub const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE: WIN32_ERROR = 9121u32; -pub const DNS_ERROR_NOT_ALLOWED_ON_ZSK: WIN32_ERROR = 9118u32; -pub const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION: WIN32_ERROR = 9563u32; -pub const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME: WIN32_ERROR = 9570u32; -pub const DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES: WIN32_ERROR = 9955u32; -pub const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS: WIN32_ERROR = 9104u32; -pub const DNS_ERROR_NOT_UNIQUE: WIN32_ERROR = 9555u32; -pub const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE: WIN32_ERROR = 9719u32; -pub const DNS_ERROR_NO_CREATE_CACHE_DATA: WIN32_ERROR = 9713u32; -pub const DNS_ERROR_NO_DNS_SERVERS: WIN32_ERROR = 9852u32; -pub const DNS_ERROR_NO_MEMORY: WIN32_ERROR = 14u32; -pub const DNS_ERROR_NO_PACKET: WIN32_ERROR = 9503u32; -pub const DNS_ERROR_NO_TCPIP: WIN32_ERROR = 9851u32; -pub const DNS_ERROR_NO_VALID_TRUST_ANCHORS: WIN32_ERROR = 9127u32; -pub const DNS_ERROR_NO_ZONE_INFO: WIN32_ERROR = 9602u32; -pub const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1: WIN32_ERROR = 9103u32; -pub const DNS_ERROR_NSEC3_NAME_COLLISION: WIN32_ERROR = 9129u32; -pub const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1: WIN32_ERROR = 9130u32; -pub const DNS_ERROR_NUMERIC_NAME: WIN32_ERROR = 9561u32; -pub const DNS_ERROR_POLICY_ALREADY_EXISTS: WIN32_ERROR = 9971u32; -pub const DNS_ERROR_POLICY_DOES_NOT_EXIST: WIN32_ERROR = 9972u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA: WIN32_ERROR = 9973u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET: WIN32_ERROR = 9990u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN: WIN32_ERROR = 9994u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE: WIN32_ERROR = 9993u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL: WIN32_ERROR = 9992u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE: WIN32_ERROR = 9995u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY: WIN32_ERROR = 9996u32; -pub const DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL: WIN32_ERROR = 9991u32; -pub const DNS_ERROR_POLICY_INVALID_NAME: WIN32_ERROR = 9982u32; -pub const DNS_ERROR_POLICY_INVALID_SETTINGS: WIN32_ERROR = 9974u32; -pub const DNS_ERROR_POLICY_INVALID_WEIGHT: WIN32_ERROR = 9981u32; -pub const DNS_ERROR_POLICY_LOCKED: WIN32_ERROR = 9980u32; -pub const DNS_ERROR_POLICY_MISSING_CRITERIA: WIN32_ERROR = 9983u32; -pub const DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID: WIN32_ERROR = 9985u32; -pub const DNS_ERROR_POLICY_SCOPE_MISSING: WIN32_ERROR = 9986u32; -pub const DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED: WIN32_ERROR = 9987u32; -pub const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE: WIN32_ERROR = 9651u32; -pub const DNS_ERROR_RCODE: WIN32_ERROR = 9504u32; -pub const DNS_ERROR_RCODE_BADKEY: WIN32_ERROR = 9017u32; -pub const DNS_ERROR_RCODE_BADSIG: WIN32_ERROR = 9016u32; -pub const DNS_ERROR_RCODE_BADTIME: WIN32_ERROR = 9018u32; -pub const DNS_ERROR_RCODE_FORMAT_ERROR: WIN32_ERROR = 9001u32; -pub const DNS_ERROR_RCODE_NAME_ERROR: WIN32_ERROR = 9003u32; -pub const DNS_ERROR_RCODE_NOTAUTH: WIN32_ERROR = 9009u32; -pub const DNS_ERROR_RCODE_NOTZONE: WIN32_ERROR = 9010u32; -pub const DNS_ERROR_RCODE_NOT_IMPLEMENTED: WIN32_ERROR = 9004u32; -pub const DNS_ERROR_RCODE_NXRRSET: WIN32_ERROR = 9008u32; -pub const DNS_ERROR_RCODE_REFUSED: WIN32_ERROR = 9005u32; -pub const DNS_ERROR_RCODE_SERVER_FAILURE: WIN32_ERROR = 9002u32; -pub const DNS_ERROR_RCODE_YXDOMAIN: WIN32_ERROR = 9006u32; -pub const DNS_ERROR_RCODE_YXRRSET: WIN32_ERROR = 9007u32; -pub const DNS_ERROR_RECORD_ALREADY_EXISTS: WIN32_ERROR = 9711u32; -pub const DNS_ERROR_RECORD_DOES_NOT_EXIST: WIN32_ERROR = 9701u32; -pub const DNS_ERROR_RECORD_FORMAT: WIN32_ERROR = 9702u32; -pub const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT: WIN32_ERROR = 9710u32; -pub const DNS_ERROR_RECORD_TIMED_OUT: WIN32_ERROR = 9705u32; -pub const DNS_ERROR_ROLLOVER_ALREADY_QUEUED: WIN32_ERROR = 9120u32; -pub const DNS_ERROR_ROLLOVER_IN_PROGRESS: WIN32_ERROR = 9116u32; -pub const DNS_ERROR_ROLLOVER_NOT_POKEABLE: WIN32_ERROR = 9128u32; -pub const DNS_ERROR_RRL_INVALID_IPV4_PREFIX: WIN32_ERROR = 9913u32; -pub const DNS_ERROR_RRL_INVALID_IPV6_PREFIX: WIN32_ERROR = 9914u32; -pub const DNS_ERROR_RRL_INVALID_LEAK_RATE: WIN32_ERROR = 9916u32; -pub const DNS_ERROR_RRL_INVALID_TC_RATE: WIN32_ERROR = 9915u32; -pub const DNS_ERROR_RRL_INVALID_WINDOW_SIZE: WIN32_ERROR = 9912u32; -pub const DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE: WIN32_ERROR = 9917u32; -pub const DNS_ERROR_RRL_NOT_ENABLED: WIN32_ERROR = 9911u32; -pub const DNS_ERROR_SCOPE_ALREADY_EXISTS: WIN32_ERROR = 9963u32; -pub const DNS_ERROR_SCOPE_DOES_NOT_EXIST: WIN32_ERROR = 9959u32; -pub const DNS_ERROR_SCOPE_LOCKED: WIN32_ERROR = 9962u32; -pub const DNS_ERROR_SECONDARY_DATA: WIN32_ERROR = 9712u32; -pub const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP: WIN32_ERROR = 9612u32; -pub const DNS_ERROR_SERVERSCOPE_IS_REFERENCED: WIN32_ERROR = 9988u32; -pub const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE: WIN32_ERROR = 9107u32; -pub const DNS_ERROR_SOA_DELETE_INVALID: WIN32_ERROR = 9618u32; -pub const DNS_ERROR_STANDBY_KEY_NOT_PRESENT: WIN32_ERROR = 9117u32; -pub const DNS_ERROR_SUBNET_ALREADY_EXISTS: WIN32_ERROR = 9979u32; -pub const DNS_ERROR_SUBNET_DOES_NOT_EXIST: WIN32_ERROR = 9978u32; -pub const DNS_ERROR_TOO_MANY_SKDS: WIN32_ERROR = 9113u32; -pub const DNS_ERROR_TRY_AGAIN_LATER: WIN32_ERROR = 9554u32; -pub const DNS_ERROR_UNEXPECTED_CNG_ERROR: WIN32_ERROR = 9110u32; -pub const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR: WIN32_ERROR = 9109u32; -pub const DNS_ERROR_UNKNOWN_RECORD_TYPE: WIN32_ERROR = 9704u32; -pub const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION: WIN32_ERROR = 9111u32; -pub const DNS_ERROR_UNSECURE_PACKET: WIN32_ERROR = 9505u32; -pub const DNS_ERROR_UNSUPPORTED_ALGORITHM: WIN32_ERROR = 9105u32; -pub const DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS: WIN32_ERROR = 9921u32; -pub const DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST: WIN32_ERROR = 9922u32; -pub const DNS_ERROR_VIRTUALIZATION_TREE_LOCKED: WIN32_ERROR = 9923u32; -pub const DNS_ERROR_WINS_INIT_FAILED: WIN32_ERROR = 9615u32; -pub const DNS_ERROR_ZONESCOPE_ALREADY_EXISTS: WIN32_ERROR = 9951u32; -pub const DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST: WIN32_ERROR = 9952u32; -pub const DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED: WIN32_ERROR = 9957u32; -pub const DNS_ERROR_ZONESCOPE_IS_REFERENCED: WIN32_ERROR = 9989u32; -pub const DNS_ERROR_ZONE_ALREADY_EXISTS: WIN32_ERROR = 9609u32; -pub const DNS_ERROR_ZONE_CONFIGURATION_ERROR: WIN32_ERROR = 9604u32; -pub const DNS_ERROR_ZONE_CREATION_FAILED: WIN32_ERROR = 9608u32; -pub const DNS_ERROR_ZONE_DOES_NOT_EXIST: WIN32_ERROR = 9601u32; -pub const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS: WIN32_ERROR = 9606u32; -pub const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD: WIN32_ERROR = 9605u32; -pub const DNS_ERROR_ZONE_IS_SHUTDOWN: WIN32_ERROR = 9621u32; -pub const DNS_ERROR_ZONE_LOCKED: WIN32_ERROR = 9607u32; -pub const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING: WIN32_ERROR = 9622u32; -pub const DNS_ERROR_ZONE_NOT_SECONDARY: WIN32_ERROR = 9613u32; -pub const DNS_ERROR_ZONE_REQUIRES_MASTER_IP: WIN32_ERROR = 9620u32; -pub const DUPLICATE_CLOSE_SOURCE: DUPLICATE_HANDLE_OPTIONS = 1u32; -pub type DUPLICATE_HANDLE_OPTIONS = u32; -pub const DUPLICATE_SAME_ACCESS: DUPLICATE_HANDLE_OPTIONS = 2u32; -pub const ENABLE_AUTO_POSITION: CONSOLE_MODE = 256u32; -pub const ENABLE_ECHO_INPUT: CONSOLE_MODE = 4u32; -pub const ENABLE_EXTENDED_FLAGS: CONSOLE_MODE = 128u32; -pub const ENABLE_INSERT_MODE: CONSOLE_MODE = 32u32; -pub const ENABLE_LINE_INPUT: CONSOLE_MODE = 2u32; -pub const ENABLE_LVB_GRID_WORLDWIDE: CONSOLE_MODE = 16u32; -pub const ENABLE_MOUSE_INPUT: CONSOLE_MODE = 16u32; -pub const ENABLE_PROCESSED_INPUT: CONSOLE_MODE = 1u32; -pub const ENABLE_PROCESSED_OUTPUT: CONSOLE_MODE = 1u32; -pub const ENABLE_QUICK_EDIT_MODE: CONSOLE_MODE = 64u32; -pub const ENABLE_VIRTUAL_TERMINAL_INPUT: CONSOLE_MODE = 512u32; -pub const ENABLE_VIRTUAL_TERMINAL_PROCESSING: CONSOLE_MODE = 4u32; -pub const ENABLE_WINDOW_INPUT: CONSOLE_MODE = 8u32; -pub const ENABLE_WRAP_AT_EOL_OUTPUT: CONSOLE_MODE = 2u32; -pub const ERROR_ABANDONED_WAIT_0: WIN32_ERROR = 735u32; -pub const ERROR_ABANDONED_WAIT_63: WIN32_ERROR = 736u32; -pub const ERROR_ABANDON_HIBERFILE: WIN32_ERROR = 787u32; -pub const ERROR_ABIOS_ERROR: WIN32_ERROR = 538u32; -pub const ERROR_ACCESS_AUDIT_BY_POLICY: WIN32_ERROR = 785u32; -pub const ERROR_ACCESS_DENIED: WIN32_ERROR = 5u32; -pub const ERROR_ACCESS_DENIED_APPDATA: WIN32_ERROR = 502u32; -pub const ERROR_ACCESS_DISABLED_BY_POLICY: WIN32_ERROR = 1260u32; -pub const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: WIN32_ERROR = 786u32; -pub const ERROR_ACCESS_DISABLED_WEBBLADE: WIN32_ERROR = 1277u32; -pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: WIN32_ERROR = 1278u32; -pub const ERROR_ACCOUNT_DISABLED: WIN32_ERROR = 1331u32; -pub const ERROR_ACCOUNT_EXPIRED: WIN32_ERROR = 1793u32; -pub const ERROR_ACCOUNT_LOCKED_OUT: WIN32_ERROR = 1909u32; -pub const ERROR_ACCOUNT_RESTRICTION: WIN32_ERROR = 1327u32; -pub const ERROR_ACPI_ERROR: WIN32_ERROR = 669u32; -pub const ERROR_ACTIVE_CONNECTIONS: WIN32_ERROR = 2402u32; -pub const ERROR_ADAP_HDW_ERR: WIN32_ERROR = 57u32; -pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: WIN32_ERROR = 1227u32; -pub const ERROR_ADDRESS_NOT_ASSOCIATED: WIN32_ERROR = 1228u32; -pub const ERROR_ALERTED: WIN32_ERROR = 739u32; -pub const ERROR_ALIAS_EXISTS: WIN32_ERROR = 1379u32; -pub const ERROR_ALLOCATE_BUCKET: WIN32_ERROR = 602u32; -pub const ERROR_ALLOTTED_SPACE_EXCEEDED: WIN32_ERROR = 1344u32; -pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1933u32; -pub const ERROR_ALREADY_ASSIGNED: WIN32_ERROR = 85u32; -pub const ERROR_ALREADY_EXISTS: WIN32_ERROR = 183u32; -pub const ERROR_ALREADY_FIBER: WIN32_ERROR = 1280u32; -pub const ERROR_ALREADY_HAS_STREAM_ID: WIN32_ERROR = 4444u32; -pub const ERROR_ALREADY_INITIALIZED: WIN32_ERROR = 1247u32; -pub const ERROR_ALREADY_REGISTERED: WIN32_ERROR = 1242u32; -pub const ERROR_ALREADY_RUNNING_LKG: WIN32_ERROR = 1074u32; -pub const ERROR_ALREADY_THREAD: WIN32_ERROR = 1281u32; -pub const ERROR_ALREADY_WAITING: WIN32_ERROR = 1904u32; -pub const ERROR_ALREADY_WIN32: WIN32_ERROR = 719u32; -pub const ERROR_API_UNAVAILABLE: WIN32_ERROR = 15841u32; -pub const ERROR_APPCONTAINER_REQUIRED: WIN32_ERROR = 4251u32; -pub const ERROR_APPEXEC_APP_COMPAT_BLOCK: WIN32_ERROR = 3068u32; -pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT: WIN32_ERROR = 3069u32; -pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING: WIN32_ERROR = 3071u32; -pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES: WIN32_ERROR = 3072u32; -pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION: WIN32_ERROR = 3070u32; -pub const ERROR_APPEXEC_CONDITION_NOT_SATISFIED: WIN32_ERROR = 3060u32; -pub const ERROR_APPEXEC_HANDLE_INVALIDATED: WIN32_ERROR = 3061u32; -pub const ERROR_APPEXEC_HOST_ID_MISMATCH: WIN32_ERROR = 3066u32; -pub const ERROR_APPEXEC_INVALID_HOST_GENERATION: WIN32_ERROR = 3062u32; -pub const ERROR_APPEXEC_INVALID_HOST_STATE: WIN32_ERROR = 3064u32; -pub const ERROR_APPEXEC_NO_DONOR: WIN32_ERROR = 3065u32; -pub const ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION: WIN32_ERROR = 3063u32; -pub const ERROR_APPEXEC_UNKNOWN_USER: WIN32_ERROR = 3067u32; -pub const ERROR_APPHELP_BLOCK: WIN32_ERROR = 1259u32; -pub const ERROR_APPX_FILE_NOT_ENCRYPTED: WIN32_ERROR = 409u32; -pub const ERROR_APP_HANG: WIN32_ERROR = 1298u32; -pub const ERROR_APP_INIT_FAILURE: WIN32_ERROR = 575u32; -pub const ERROR_APP_WRONG_OS: WIN32_ERROR = 1151u32; -pub const ERROR_ARBITRATION_UNHANDLED: WIN32_ERROR = 723u32; -pub const ERROR_ARENA_TRASHED: WIN32_ERROR = 7u32; -pub const ERROR_ARITHMETIC_OVERFLOW: WIN32_ERROR = 534u32; -pub const ERROR_ASSERTION_FAILURE: WIN32_ERROR = 668u32; -pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: WIN32_ERROR = 174u32; -pub const ERROR_AUDIT_FAILED: WIN32_ERROR = 606u32; -pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: WIN32_ERROR = 1935u32; -pub const ERROR_AUTHIP_FAILURE: WIN32_ERROR = 1469u32; -pub const ERROR_AUTODATASEG_EXCEEDS_64k: WIN32_ERROR = 199u32; -pub const ERROR_BACKUP_CONTROLLER: WIN32_ERROR = 586u32; -pub const ERROR_BADDB: WIN32_ERROR = 1009u32; -pub const ERROR_BADKEY: WIN32_ERROR = 1010u32; -pub const ERROR_BADSTARTPOSITION: WIN32_ERROR = 778u32; -pub const ERROR_BAD_ACCESSOR_FLAGS: WIN32_ERROR = 773u32; -pub const ERROR_BAD_ARGUMENTS: WIN32_ERROR = 160u32; -pub const ERROR_BAD_COMMAND: WIN32_ERROR = 22u32; -pub const ERROR_BAD_COMPRESSION_BUFFER: WIN32_ERROR = 605u32; -pub const ERROR_BAD_CONFIGURATION: WIN32_ERROR = 1610u32; -pub const ERROR_BAD_CURRENT_DIRECTORY: WIN32_ERROR = 703u32; -pub const ERROR_BAD_DESCRIPTOR_FORMAT: WIN32_ERROR = 1361u32; -pub const ERROR_BAD_DEVICE: WIN32_ERROR = 1200u32; -pub const ERROR_BAD_DEVICE_PATH: WIN32_ERROR = 330u32; -pub const ERROR_BAD_DEV_TYPE: WIN32_ERROR = 66u32; -pub const ERROR_BAD_DLL_ENTRYPOINT: WIN32_ERROR = 609u32; -pub const ERROR_BAD_DRIVER_LEVEL: WIN32_ERROR = 119u32; -pub const ERROR_BAD_ENVIRONMENT: WIN32_ERROR = 10u32; -pub const ERROR_BAD_EXE_FORMAT: WIN32_ERROR = 193u32; -pub const ERROR_BAD_FILE_TYPE: WIN32_ERROR = 222u32; -pub const ERROR_BAD_FORMAT: WIN32_ERROR = 11u32; -pub const ERROR_BAD_FUNCTION_TABLE: WIN32_ERROR = 559u32; -pub const ERROR_BAD_IMPERSONATION_LEVEL: WIN32_ERROR = 1346u32; -pub const ERROR_BAD_INHERITANCE_ACL: WIN32_ERROR = 1340u32; -pub const ERROR_BAD_LENGTH: WIN32_ERROR = 24u32; -pub const ERROR_BAD_LOGON_SESSION_STATE: WIN32_ERROR = 1365u32; -pub const ERROR_BAD_MCFG_TABLE: WIN32_ERROR = 791u32; -pub const ERROR_BAD_NETPATH: WIN32_ERROR = 53u32; -pub const ERROR_BAD_NET_NAME: WIN32_ERROR = 67u32; -pub const ERROR_BAD_NET_RESP: WIN32_ERROR = 58u32; -pub const ERROR_BAD_PATHNAME: WIN32_ERROR = 161u32; -pub const ERROR_BAD_PIPE: WIN32_ERROR = 230u32; -pub const ERROR_BAD_PROFILE: WIN32_ERROR = 1206u32; -pub const ERROR_BAD_PROVIDER: WIN32_ERROR = 1204u32; -pub const ERROR_BAD_QUERY_SYNTAX: WIN32_ERROR = 1615u32; -pub const ERROR_BAD_RECOVERY_POLICY: WIN32_ERROR = 6012u32; -pub const ERROR_BAD_REM_ADAP: WIN32_ERROR = 60u32; -pub const ERROR_BAD_SERVICE_ENTRYPOINT: WIN32_ERROR = 610u32; -pub const ERROR_BAD_STACK: WIN32_ERROR = 543u32; -pub const ERROR_BAD_THREADID_ADDR: WIN32_ERROR = 159u32; -pub const ERROR_BAD_TOKEN_TYPE: WIN32_ERROR = 1349u32; -pub const ERROR_BAD_UNIT: WIN32_ERROR = 20u32; -pub const ERROR_BAD_USERNAME: WIN32_ERROR = 2202u32; -pub const ERROR_BAD_USER_PROFILE: WIN32_ERROR = 1253u32; -pub const ERROR_BAD_VALIDATION_CLASS: WIN32_ERROR = 1348u32; -pub const ERROR_BEGINNING_OF_MEDIA: WIN32_ERROR = 1102u32; -pub const ERROR_BEYOND_VDL: WIN32_ERROR = 1289u32; -pub const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: WIN32_ERROR = 585u32; -pub const ERROR_BLOCKED_BY_PARENTAL_CONTROLS: WIN32_ERROR = 346u32; -pub const ERROR_BLOCK_SHARED: WIN32_ERROR = 514u32; -pub const ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID: WIN32_ERROR = 512u32; -pub const ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID: WIN32_ERROR = 513u32; -pub const ERROR_BLOCK_TOO_MANY_REFERENCES: WIN32_ERROR = 347u32; -pub const ERROR_BLOCK_WEAK_REFERENCE_INVALID: WIN32_ERROR = 511u32; -pub const ERROR_BOOT_ALREADY_ACCEPTED: WIN32_ERROR = 1076u32; -pub const ERROR_BROKEN_PIPE: WIN32_ERROR = 109u32; -pub const ERROR_BUFFER_ALL_ZEROS: WIN32_ERROR = 754u32; -pub const ERROR_BUFFER_OVERFLOW: WIN32_ERROR = 111u32; -pub const ERROR_BUSY: WIN32_ERROR = 170u32; -pub const ERROR_BUSY_DRIVE: WIN32_ERROR = 142u32; -pub const ERROR_BUS_RESET: WIN32_ERROR = 1111u32; -pub const ERROR_BYPASSIO_FLT_NOT_SUPPORTED: WIN32_ERROR = 506u32; -pub const ERROR_CACHE_PAGE_LOCKED: WIN32_ERROR = 752u32; -pub const ERROR_CALLBACK_INVOKE_INLINE: WIN32_ERROR = 812u32; -pub const ERROR_CALLBACK_POP_STACK: WIN32_ERROR = 768u32; -pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: WIN32_ERROR = 1273u32; -pub const ERROR_CALL_NOT_IMPLEMENTED: WIN32_ERROR = 120u32; -pub const ERROR_CANCELLED: WIN32_ERROR = 1223u32; -pub const ERROR_CANCEL_VIOLATION: WIN32_ERROR = 173u32; -pub const ERROR_CANNOT_BREAK_OPLOCK: WIN32_ERROR = 802u32; -pub const ERROR_CANNOT_COPY: WIN32_ERROR = 266u32; -pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: WIN32_ERROR = 1080u32; -pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: WIN32_ERROR = 1081u32; -pub const ERROR_CANNOT_FIND_WND_CLASS: WIN32_ERROR = 1407u32; -pub const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK: WIN32_ERROR = 801u32; -pub const ERROR_CANNOT_IMPERSONATE: WIN32_ERROR = 1368u32; -pub const ERROR_CANNOT_LOAD_REGISTRY_FILE: WIN32_ERROR = 589u32; -pub const ERROR_CANNOT_MAKE: WIN32_ERROR = 82u32; -pub const ERROR_CANNOT_OPEN_PROFILE: WIN32_ERROR = 1205u32; -pub const ERROR_CANTFETCHBACKWARDS: WIN32_ERROR = 770u32; -pub const ERROR_CANTOPEN: WIN32_ERROR = 1011u32; -pub const ERROR_CANTREAD: WIN32_ERROR = 1012u32; -pub const ERROR_CANTSCROLLBACKWARDS: WIN32_ERROR = 771u32; -pub const ERROR_CANTWRITE: WIN32_ERROR = 1013u32; -pub const ERROR_CANT_ACCESS_DOMAIN_INFO: WIN32_ERROR = 1351u32; -pub const ERROR_CANT_ACCESS_FILE: WIN32_ERROR = 1920u32; -pub const ERROR_CANT_CLEAR_ENCRYPTION_FLAG: WIN32_ERROR = 432u32; -pub const ERROR_CANT_DISABLE_MANDATORY: WIN32_ERROR = 1310u32; -pub const ERROR_CANT_ENABLE_DENY_ONLY: WIN32_ERROR = 629u32; -pub const ERROR_CANT_OPEN_ANONYMOUS: WIN32_ERROR = 1347u32; -pub const ERROR_CANT_RESOLVE_FILENAME: WIN32_ERROR = 1921u32; -pub const ERROR_CANT_TERMINATE_SELF: WIN32_ERROR = 555u32; -pub const ERROR_CANT_WAIT: WIN32_ERROR = 554u32; -pub const ERROR_CAN_NOT_COMPLETE: WIN32_ERROR = 1003u32; -pub const ERROR_CAPAUTHZ_CHANGE_TYPE: WIN32_ERROR = 451u32; -pub const ERROR_CAPAUTHZ_DB_CORRUPTED: WIN32_ERROR = 455u32; -pub const ERROR_CAPAUTHZ_NOT_AUTHORIZED: WIN32_ERROR = 453u32; -pub const ERROR_CAPAUTHZ_NOT_DEVUNLOCKED: WIN32_ERROR = 450u32; -pub const ERROR_CAPAUTHZ_NOT_PROVISIONED: WIN32_ERROR = 452u32; -pub const ERROR_CAPAUTHZ_NO_POLICY: WIN32_ERROR = 454u32; -pub const ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED: WIN32_ERROR = 459u32; -pub const ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG: WIN32_ERROR = 456u32; -pub const ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY: WIN32_ERROR = 457u32; -pub const ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH: WIN32_ERROR = 460u32; -pub const ERROR_CAPAUTHZ_SCCD_PARSE_ERROR: WIN32_ERROR = 458u32; -pub const ERROR_CARDBUS_NOT_SUPPORTED: WIN32_ERROR = 724u32; -pub const ERROR_CASE_DIFFERING_NAMES_IN_DIR: WIN32_ERROR = 424u32; -pub const ERROR_CASE_SENSITIVE_PATH: WIN32_ERROR = 442u32; -pub const ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT: WIN32_ERROR = 817u32; -pub const ERROR_CHECKING_FILE_SYSTEM: WIN32_ERROR = 712u32; -pub const ERROR_CHECKOUT_REQUIRED: WIN32_ERROR = 221u32; -pub const ERROR_CHILD_MUST_BE_VOLATILE: WIN32_ERROR = 1021u32; -pub const ERROR_CHILD_NOT_COMPLETE: WIN32_ERROR = 129u32; -pub const ERROR_CHILD_PROCESS_BLOCKED: WIN32_ERROR = 367u32; -pub const ERROR_CHILD_WINDOW_MENU: WIN32_ERROR = 1436u32; -pub const ERROR_CIMFS_IMAGE_CORRUPT: WIN32_ERROR = 470u32; -pub const ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED: WIN32_ERROR = 471u32; -pub const ERROR_CIRCULAR_DEPENDENCY: WIN32_ERROR = 1059u32; -pub const ERROR_CLASS_ALREADY_EXISTS: WIN32_ERROR = 1410u32; -pub const ERROR_CLASS_DOES_NOT_EXIST: WIN32_ERROR = 1411u32; -pub const ERROR_CLASS_HAS_WINDOWS: WIN32_ERROR = 1412u32; -pub const ERROR_CLIENT_SERVER_PARAMETERS_INVALID: WIN32_ERROR = 597u32; -pub const ERROR_CLIPBOARD_NOT_OPEN: WIN32_ERROR = 1418u32; -pub const ERROR_CLOUD_FILE_ACCESS_DENIED: WIN32_ERROR = 395u32; -pub const ERROR_CLOUD_FILE_ALREADY_CONNECTED: WIN32_ERROR = 378u32; -pub const ERROR_CLOUD_FILE_AUTHENTICATION_FAILED: WIN32_ERROR = 386u32; -pub const ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY: WIN32_ERROR = 382u32; -pub const ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED: WIN32_ERROR = 434u32; -pub const ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS: WIN32_ERROR = 396u32; -pub const ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES: WIN32_ERROR = 387u32; -pub const ERROR_CLOUD_FILE_INVALID_REQUEST: WIN32_ERROR = 380u32; -pub const ERROR_CLOUD_FILE_IN_USE: WIN32_ERROR = 391u32; -pub const ERROR_CLOUD_FILE_METADATA_CORRUPT: WIN32_ERROR = 363u32; -pub const ERROR_CLOUD_FILE_METADATA_TOO_LARGE: WIN32_ERROR = 364u32; -pub const ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE: WIN32_ERROR = 388u32; -pub const ERROR_CLOUD_FILE_NOT_IN_SYNC: WIN32_ERROR = 377u32; -pub const ERROR_CLOUD_FILE_NOT_SUPPORTED: WIN32_ERROR = 379u32; -pub const ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT: WIN32_ERROR = 390u32; -pub const ERROR_CLOUD_FILE_PINNED: WIN32_ERROR = 392u32; -pub const ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH: WIN32_ERROR = 366u32; -pub const ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE: WIN32_ERROR = 365u32; -pub const ERROR_CLOUD_FILE_PROPERTY_CORRUPT: WIN32_ERROR = 394u32; -pub const ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT: WIN32_ERROR = 397u32; -pub const ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED: WIN32_ERROR = 375u32; -pub const ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING: WIN32_ERROR = 362u32; -pub const ERROR_CLOUD_FILE_PROVIDER_TERMINATED: WIN32_ERROR = 404u32; -pub const ERROR_CLOUD_FILE_READ_ONLY_VOLUME: WIN32_ERROR = 381u32; -pub const ERROR_CLOUD_FILE_REQUEST_ABORTED: WIN32_ERROR = 393u32; -pub const ERROR_CLOUD_FILE_REQUEST_CANCELED: WIN32_ERROR = 398u32; -pub const ERROR_CLOUD_FILE_REQUEST_TIMEOUT: WIN32_ERROR = 426u32; -pub const ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT: WIN32_ERROR = 358u32; -pub const ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS: WIN32_ERROR = 374u32; -pub const ERROR_CLOUD_FILE_UNSUCCESSFUL: WIN32_ERROR = 389u32; -pub const ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT: WIN32_ERROR = 475u32; -pub const ERROR_CLOUD_FILE_VALIDATION_FAILED: WIN32_ERROR = 383u32; -pub const ERROR_COMMITMENT_LIMIT: WIN32_ERROR = 1455u32; -pub const ERROR_COMMITMENT_MINIMUM: WIN32_ERROR = 635u32; -pub const ERROR_COMPRESSED_FILE_NOT_SUPPORTED: WIN32_ERROR = 335u32; -pub const ERROR_COMPRESSION_DISABLED: WIN32_ERROR = 769u32; -pub const ERROR_COMPRESSION_NOT_BENEFICIAL: WIN32_ERROR = 344u32; -pub const ERROR_CONNECTED_OTHER_PASSWORD: WIN32_ERROR = 2108u32; -pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: WIN32_ERROR = 2109u32; -pub const ERROR_CONNECTION_ABORTED: WIN32_ERROR = 1236u32; -pub const ERROR_CONNECTION_ACTIVE: WIN32_ERROR = 1230u32; -pub const ERROR_CONNECTION_COUNT_LIMIT: WIN32_ERROR = 1238u32; -pub const ERROR_CONNECTION_INVALID: WIN32_ERROR = 1229u32; -pub const ERROR_CONNECTION_REFUSED: WIN32_ERROR = 1225u32; -pub const ERROR_CONNECTION_UNAVAIL: WIN32_ERROR = 1201u32; -pub const ERROR_CONTAINER_ASSIGNED: WIN32_ERROR = 1504u32; -pub const ERROR_CONTENT_BLOCKED: WIN32_ERROR = 1296u32; -pub const ERROR_CONTEXT_EXPIRED: WIN32_ERROR = 1931u32; -pub const ERROR_CONTINUE: WIN32_ERROR = 1246u32; -pub const ERROR_CONTROL_C_EXIT: WIN32_ERROR = 572u32; -pub const ERROR_CONTROL_ID_NOT_FOUND: WIN32_ERROR = 1421u32; -pub const ERROR_CONVERT_TO_LARGE: WIN32_ERROR = 600u32; -pub const ERROR_CORRUPT_LOG_CLEARED: WIN32_ERROR = 798u32; -pub const ERROR_CORRUPT_LOG_CORRUPTED: WIN32_ERROR = 795u32; -pub const ERROR_CORRUPT_LOG_DELETED_FULL: WIN32_ERROR = 797u32; -pub const ERROR_CORRUPT_LOG_OVERFULL: WIN32_ERROR = 794u32; -pub const ERROR_CORRUPT_LOG_UNAVAILABLE: WIN32_ERROR = 796u32; -pub const ERROR_CORRUPT_SYSTEM_FILE: WIN32_ERROR = 634u32; -pub const ERROR_COULD_NOT_INTERPRET: WIN32_ERROR = 552u32; -pub const ERROR_COUNTER_TIMEOUT: WIN32_ERROR = 1121u32; -pub const ERROR_CPU_SET_INVALID: WIN32_ERROR = 813u32; -pub const ERROR_CRASH_DUMP: WIN32_ERROR = 753u32; -pub const ERROR_CRC: WIN32_ERROR = 23u32; -pub const ERROR_CREATE_FAILED: WIN32_ERROR = 1631u32; -pub const ERROR_CROSS_PARTITION_VIOLATION: WIN32_ERROR = 1661u32; -pub const ERROR_CSCSHARE_OFFLINE: WIN32_ERROR = 1262u32; -pub const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: WIN32_ERROR = 6019u32; -pub const ERROR_CS_ENCRYPTION_FILE_NOT_CSE: WIN32_ERROR = 6021u32; -pub const ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: WIN32_ERROR = 6017u32; -pub const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: WIN32_ERROR = 6020u32; -pub const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: WIN32_ERROR = 6018u32; -pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: WIN32_ERROR = 7040u32; -pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: WIN32_ERROR = 7012u32; -pub const ERROR_CURRENT_DIRECTORY: WIN32_ERROR = 16u32; -pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: WIN32_ERROR = 1399u32; -pub const ERROR_DATABASE_DOES_NOT_EXIST: WIN32_ERROR = 1065u32; -pub const ERROR_DATATYPE_MISMATCH: WIN32_ERROR = 1629u32; -pub const ERROR_DATA_CHECKSUM_ERROR: WIN32_ERROR = 323u32; -pub const ERROR_DATA_NOT_ACCEPTED: WIN32_ERROR = 592u32; -pub const ERROR_DAX_MAPPING_EXISTS: WIN32_ERROR = 361u32; -pub const ERROR_DBG_COMMAND_EXCEPTION: WIN32_ERROR = 697u32; -pub const ERROR_DBG_CONTINUE: WIN32_ERROR = 767u32; -pub const ERROR_DBG_CONTROL_BREAK: WIN32_ERROR = 696u32; -pub const ERROR_DBG_CONTROL_C: WIN32_ERROR = 693u32; -pub const ERROR_DBG_EXCEPTION_HANDLED: WIN32_ERROR = 766u32; -pub const ERROR_DBG_EXCEPTION_NOT_HANDLED: WIN32_ERROR = 688u32; -pub const ERROR_DBG_PRINTEXCEPTION_C: WIN32_ERROR = 694u32; -pub const ERROR_DBG_REPLY_LATER: WIN32_ERROR = 689u32; -pub const ERROR_DBG_RIPEXCEPTION: WIN32_ERROR = 695u32; -pub const ERROR_DBG_TERMINATE_PROCESS: WIN32_ERROR = 692u32; -pub const ERROR_DBG_TERMINATE_THREAD: WIN32_ERROR = 691u32; -pub const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: WIN32_ERROR = 690u32; -pub const ERROR_DC_NOT_FOUND: WIN32_ERROR = 1425u32; -pub const ERROR_DDE_FAIL: WIN32_ERROR = 1156u32; -pub const ERROR_DEBUGGER_INACTIVE: WIN32_ERROR = 1284u32; -pub const ERROR_DEBUG_ATTACH_FAILED: WIN32_ERROR = 590u32; -pub const ERROR_DECRYPTION_FAILED: WIN32_ERROR = 6001u32; -pub const ERROR_DELAY_LOAD_FAILED: WIN32_ERROR = 1285u32; -pub const ERROR_DELETE_PENDING: WIN32_ERROR = 303u32; -pub const ERROR_DEPENDENT_SERVICES_RUNNING: WIN32_ERROR = 1051u32; -pub const ERROR_DESTINATION_ELEMENT_FULL: WIN32_ERROR = 1161u32; -pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: WIN32_ERROR = 1435u32; -pub const ERROR_DEVICE_ALREADY_ATTACHED: WIN32_ERROR = 548u32; -pub const ERROR_DEVICE_ALREADY_REMEMBERED: WIN32_ERROR = 1202u32; -pub const ERROR_DEVICE_DOOR_OPEN: WIN32_ERROR = 1166u32; -pub const ERROR_DEVICE_ENUMERATION_ERROR: WIN32_ERROR = 648u32; -pub const ERROR_DEVICE_FEATURE_NOT_SUPPORTED: WIN32_ERROR = 316u32; -pub const ERROR_DEVICE_HARDWARE_ERROR: WIN32_ERROR = 483u32; -pub const ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL: WIN32_ERROR = 355u32; -pub const ERROR_DEVICE_IN_MAINTENANCE: WIN32_ERROR = 359u32; -pub const ERROR_DEVICE_IN_USE: WIN32_ERROR = 2404u32; -pub const ERROR_DEVICE_NOT_CONNECTED: WIN32_ERROR = 1167u32; -pub const ERROR_DEVICE_NOT_PARTITIONED: WIN32_ERROR = 1107u32; -pub const ERROR_DEVICE_NO_RESOURCES: WIN32_ERROR = 322u32; -pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: WIN32_ERROR = 1164u32; -pub const ERROR_DEVICE_REMOVED: WIN32_ERROR = 1617u32; -pub const ERROR_DEVICE_REQUIRES_CLEANING: WIN32_ERROR = 1165u32; -pub const ERROR_DEVICE_RESET_REQUIRED: WIN32_ERROR = 507u32; -pub const ERROR_DEVICE_SUPPORT_IN_PROGRESS: WIN32_ERROR = 171u32; -pub const ERROR_DEVICE_UNREACHABLE: WIN32_ERROR = 321u32; -pub const ERROR_DEV_NOT_EXIST: WIN32_ERROR = 55u32; -pub const ERROR_DHCP_ADDRESS_CONFLICT: WIN32_ERROR = 4100u32; -pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: WIN32_ERROR = 1079u32; -pub const ERROR_DIRECTORY: WIN32_ERROR = 267u32; -pub const ERROR_DIRECTORY_NOT_SUPPORTED: WIN32_ERROR = 336u32; -pub const ERROR_DIRECT_ACCESS_HANDLE: WIN32_ERROR = 130u32; -pub const ERROR_DIR_EFS_DISALLOWED: WIN32_ERROR = 6010u32; -pub const ERROR_DIR_NOT_EMPTY: WIN32_ERROR = 145u32; -pub const ERROR_DIR_NOT_ROOT: WIN32_ERROR = 144u32; -pub const ERROR_DISCARDED: WIN32_ERROR = 157u32; -pub const ERROR_DISK_CHANGE: WIN32_ERROR = 107u32; -pub const ERROR_DISK_CORRUPT: WIN32_ERROR = 1393u32; -pub const ERROR_DISK_FULL: WIN32_ERROR = 112u32; -pub const ERROR_DISK_OPERATION_FAILED: WIN32_ERROR = 1127u32; -pub const ERROR_DISK_QUOTA_EXCEEDED: WIN32_ERROR = 1295u32; -pub const ERROR_DISK_RECALIBRATE_FAILED: WIN32_ERROR = 1126u32; -pub const ERROR_DISK_REPAIR_DISABLED: WIN32_ERROR = 780u32; -pub const ERROR_DISK_REPAIR_REDIRECTED: WIN32_ERROR = 792u32; -pub const ERROR_DISK_REPAIR_UNSUCCESSFUL: WIN32_ERROR = 793u32; -pub const ERROR_DISK_RESET_FAILED: WIN32_ERROR = 1128u32; -pub const ERROR_DISK_RESOURCES_EXHAUSTED: WIN32_ERROR = 314u32; -pub const ERROR_DISK_TOO_FRAGMENTED: WIN32_ERROR = 302u32; -pub const ERROR_DLL_INIT_FAILED: WIN32_ERROR = 1114u32; -pub const ERROR_DLL_INIT_FAILED_LOGOFF: WIN32_ERROR = 624u32; -pub const ERROR_DLL_MIGHT_BE_INCOMPATIBLE: WIN32_ERROR = 687u32; -pub const ERROR_DLL_MIGHT_BE_INSECURE: WIN32_ERROR = 686u32; -pub const ERROR_DLL_NOT_FOUND: WIN32_ERROR = 1157u32; -pub const ERROR_DLP_POLICY_DENIES_OPERATION: WIN32_ERROR = 446u32; -pub const ERROR_DLP_POLICY_SILENTLY_FAIL: WIN32_ERROR = 449u32; -pub const ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION: WIN32_ERROR = 445u32; -pub const ERROR_DOMAIN_CONTROLLER_EXISTS: WIN32_ERROR = 1250u32; -pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: WIN32_ERROR = 1908u32; -pub const ERROR_DOMAIN_CTRLR_CONFIG_ERROR: WIN32_ERROR = 581u32; -pub const ERROR_DOMAIN_EXISTS: WIN32_ERROR = 1356u32; -pub const ERROR_DOMAIN_LIMIT_EXCEEDED: WIN32_ERROR = 1357u32; -pub const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION: WIN32_ERROR = 8644u32; -pub const ERROR_DOMAIN_TRUST_INCONSISTENT: WIN32_ERROR = 1810u32; -pub const ERROR_DOWNGRADE_DETECTED: WIN32_ERROR = 1265u32; -pub const ERROR_DPL_NOT_SUPPORTED_FOR_USER: WIN32_ERROR = 423u32; -pub const ERROR_DRIVERS_LEAKING_LOCKED_PAGES: WIN32_ERROR = 729u32; -pub const ERROR_DRIVER_BLOCKED: WIN32_ERROR = 1275u32; -pub const ERROR_DRIVER_CANCEL_TIMEOUT: WIN32_ERROR = 594u32; -pub const ERROR_DRIVER_DATABASE_ERROR: WIN32_ERROR = 652u32; -pub const ERROR_DRIVER_FAILED_PRIOR_UNLOAD: WIN32_ERROR = 654u32; -pub const ERROR_DRIVER_FAILED_SLEEP: WIN32_ERROR = 633u32; -pub const ERROR_DRIVER_PROCESS_TERMINATED: WIN32_ERROR = 1291u32; -pub const ERROR_DRIVE_LOCKED: WIN32_ERROR = 108u32; -pub const ERROR_DS_ADD_REPLICA_INHIBITED: WIN32_ERROR = 8302u32; -pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: WIN32_ERROR = 8228u32; -pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: WIN32_ERROR = 8249u32; -pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: WIN32_ERROR = 8578u32; -pub const ERROR_DS_ALIASED_OBJ_MISSING: WIN32_ERROR = 8334u32; -pub const ERROR_DS_ALIAS_DEREF_PROBLEM: WIN32_ERROR = 8244u32; -pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: WIN32_ERROR = 8336u32; -pub const ERROR_DS_ALIAS_PROBLEM: WIN32_ERROR = 8241u32; -pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: WIN32_ERROR = 8205u32; -pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: WIN32_ERROR = 8346u32; -pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: WIN32_ERROR = 8204u32; -pub const ERROR_DS_ATT_ALREADY_EXISTS: WIN32_ERROR = 8318u32; -pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: WIN32_ERROR = 8310u32; -pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: WIN32_ERROR = 8317u32; -pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: WIN32_ERROR = 8303u32; -pub const ERROR_DS_ATT_SCHEMA_REQ_ID: WIN32_ERROR = 8399u32; -pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: WIN32_ERROR = 8416u32; -pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: WIN32_ERROR = 8323u32; -pub const ERROR_DS_AUDIT_FAILURE: WIN32_ERROR = 8625u32; -pub const ERROR_DS_AUTHORIZATION_FAILED: WIN32_ERROR = 8599u32; -pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: WIN32_ERROR = 8231u32; -pub const ERROR_DS_AUTH_UNKNOWN: WIN32_ERROR = 8234u32; -pub const ERROR_DS_AUX_CLS_TEST_FAIL: WIN32_ERROR = 8389u32; -pub const ERROR_DS_BACKLINK_WITHOUT_LINK: WIN32_ERROR = 8482u32; -pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: WIN32_ERROR = 8400u32; -pub const ERROR_DS_BAD_HIERARCHY_FILE: WIN32_ERROR = 8425u32; -pub const ERROR_DS_BAD_INSTANCE_TYPE: WIN32_ERROR = 8313u32; -pub const ERROR_DS_BAD_NAME_SYNTAX: WIN32_ERROR = 8335u32; -pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: WIN32_ERROR = 8392u32; -pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: WIN32_ERROR = 8426u32; -pub const ERROR_DS_BUSY: WIN32_ERROR = 8206u32; -pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: WIN32_ERROR = 8585u32; -pub const ERROR_DS_CANT_ADD_ATT_VALUES: WIN32_ERROR = 8320u32; -pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: WIN32_ERROR = 8358u32; -pub const ERROR_DS_CANT_ADD_TO_GC: WIN32_ERROR = 8550u32; -pub const ERROR_DS_CANT_CACHE_ATT: WIN32_ERROR = 8401u32; -pub const ERROR_DS_CANT_CACHE_CLASS: WIN32_ERROR = 8402u32; -pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: WIN32_ERROR = 8553u32; -pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: WIN32_ERROR = 8510u32; -pub const ERROR_DS_CANT_DELETE: WIN32_ERROR = 8398u32; -pub const ERROR_DS_CANT_DELETE_DSA_OBJ: WIN32_ERROR = 8340u32; -pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: WIN32_ERROR = 8375u32; -pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: WIN32_ERROR = 8604u32; -pub const ERROR_DS_CANT_DEREF_ALIAS: WIN32_ERROR = 8337u32; -pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: WIN32_ERROR = 8603u32; -pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: WIN32_ERROR = 8589u32; -pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: WIN32_ERROR = 8537u32; -pub const ERROR_DS_CANT_FIND_DSA_OBJ: WIN32_ERROR = 8419u32; -pub const ERROR_DS_CANT_FIND_EXPECTED_NC: WIN32_ERROR = 8420u32; -pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: WIN32_ERROR = 8421u32; -pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: WIN32_ERROR = 8331u32; -pub const ERROR_DS_CANT_MOD_OBJ_CLASS: WIN32_ERROR = 8215u32; -pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: WIN32_ERROR = 8506u32; -pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: WIN32_ERROR = 8369u32; -pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: WIN32_ERROR = 8498u32; -pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: WIN32_ERROR = 8608u32; -pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: WIN32_ERROR = 8609u32; -pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: WIN32_ERROR = 8489u32; -pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: WIN32_ERROR = 8499u32; -pub const ERROR_DS_CANT_ON_NON_LEAF: WIN32_ERROR = 8213u32; -pub const ERROR_DS_CANT_ON_RDN: WIN32_ERROR = 8214u32; -pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: WIN32_ERROR = 8403u32; -pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: WIN32_ERROR = 8404u32; -pub const ERROR_DS_CANT_REM_MISSING_ATT: WIN32_ERROR = 8324u32; -pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: WIN32_ERROR = 8325u32; -pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: WIN32_ERROR = 8424u32; -pub const ERROR_DS_CANT_RETRIEVE_ATTS: WIN32_ERROR = 8481u32; -pub const ERROR_DS_CANT_RETRIEVE_CHILD: WIN32_ERROR = 8422u32; -pub const ERROR_DS_CANT_RETRIEVE_DN: WIN32_ERROR = 8405u32; -pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: WIN32_ERROR = 8407u32; -pub const ERROR_DS_CANT_RETRIEVE_SD: WIN32_ERROR = 8526u32; -pub const ERROR_DS_CANT_START: WIN32_ERROR = 8531u32; -pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: WIN32_ERROR = 8560u32; -pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: WIN32_ERROR = 8493u32; -pub const ERROR_DS_CHILDREN_EXIST: WIN32_ERROR = 8332u32; -pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: WIN32_ERROR = 8359u32; -pub const ERROR_DS_CLASS_NOT_DSA: WIN32_ERROR = 8343u32; -pub const ERROR_DS_CLIENT_LOOP: WIN32_ERROR = 8259u32; -pub const ERROR_DS_CODE_INCONSISTENCY: WIN32_ERROR = 8408u32; -pub const ERROR_DS_COMPARE_FALSE: WIN32_ERROR = 8229u32; -pub const ERROR_DS_COMPARE_TRUE: WIN32_ERROR = 8230u32; -pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: WIN32_ERROR = 8237u32; -pub const ERROR_DS_CONFIG_PARAM_MISSING: WIN32_ERROR = 8427u32; -pub const ERROR_DS_CONSTRAINT_VIOLATION: WIN32_ERROR = 8239u32; -pub const ERROR_DS_CONSTRUCTED_ATT_MOD: WIN32_ERROR = 8475u32; -pub const ERROR_DS_CONTROL_NOT_FOUND: WIN32_ERROR = 8258u32; -pub const ERROR_DS_COULDNT_CONTACT_FSMO: WIN32_ERROR = 8367u32; -pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: WIN32_ERROR = 8503u32; -pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: WIN32_ERROR = 8502u32; -pub const ERROR_DS_COULDNT_UPDATE_SPNS: WIN32_ERROR = 8525u32; -pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: WIN32_ERROR = 8428u32; -pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: WIN32_ERROR = 8491u32; -pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: WIN32_ERROR = 8216u32; -pub const ERROR_DS_CROSS_NC_DN_RENAME: WIN32_ERROR = 8368u32; -pub const ERROR_DS_CROSS_REF_BUSY: WIN32_ERROR = 8602u32; -pub const ERROR_DS_CROSS_REF_EXISTS: WIN32_ERROR = 8374u32; -pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: WIN32_ERROR = 8495u32; -pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: WIN32_ERROR = 8586u32; -pub const ERROR_DS_DATABASE_ERROR: WIN32_ERROR = 8409u32; -pub const ERROR_DS_DECODING_ERROR: WIN32_ERROR = 8253u32; -pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: WIN32_ERROR = 8536u32; -pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: WIN32_ERROR = 8535u32; -pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: WIN32_ERROR = 8593u32; -pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: WIN32_ERROR = 8615u32; -pub const ERROR_DS_DISALLOWED_NC_REDIRECT: WIN32_ERROR = 8640u32; -pub const ERROR_DS_DNS_LOOKUP_FAILURE: WIN32_ERROR = 8524u32; -pub const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST: WIN32_ERROR = 8634u32; -pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: WIN32_ERROR = 8612u32; -pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: WIN32_ERROR = 8564u32; -pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: WIN32_ERROR = 8566u32; -pub const ERROR_DS_DRA_ABANDON_SYNC: WIN32_ERROR = 8462u32; -pub const ERROR_DS_DRA_ACCESS_DENIED: WIN32_ERROR = 8453u32; -pub const ERROR_DS_DRA_BAD_DN: WIN32_ERROR = 8439u32; -pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: WIN32_ERROR = 8445u32; -pub const ERROR_DS_DRA_BAD_NC: WIN32_ERROR = 8440u32; -pub const ERROR_DS_DRA_BUSY: WIN32_ERROR = 8438u32; -pub const ERROR_DS_DRA_CONNECTION_FAILED: WIN32_ERROR = 8444u32; -pub const ERROR_DS_DRA_CORRUPT_UTD_VECTOR: WIN32_ERROR = 8629u32; -pub const ERROR_DS_DRA_DB_ERROR: WIN32_ERROR = 8451u32; -pub const ERROR_DS_DRA_DN_EXISTS: WIN32_ERROR = 8441u32; -pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: WIN32_ERROR = 8544u32; -pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: WIN32_ERROR = 8466u32; -pub const ERROR_DS_DRA_GENERIC: WIN32_ERROR = 8436u32; -pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: WIN32_ERROR = 8464u32; -pub const ERROR_DS_DRA_INCONSISTENT_DIT: WIN32_ERROR = 8443u32; -pub const ERROR_DS_DRA_INTERNAL_ERROR: WIN32_ERROR = 8442u32; -pub const ERROR_DS_DRA_INVALID_PARAMETER: WIN32_ERROR = 8437u32; -pub const ERROR_DS_DRA_MAIL_PROBLEM: WIN32_ERROR = 8447u32; -pub const ERROR_DS_DRA_MISSING_KRBTGT_SECRET: WIN32_ERROR = 8633u32; -pub const ERROR_DS_DRA_MISSING_PARENT: WIN32_ERROR = 8460u32; -pub const ERROR_DS_DRA_NAME_COLLISION: WIN32_ERROR = 8458u32; -pub const ERROR_DS_DRA_NOT_SUPPORTED: WIN32_ERROR = 8454u32; -pub const ERROR_DS_DRA_NO_REPLICA: WIN32_ERROR = 8452u32; -pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: WIN32_ERROR = 8450u32; -pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: WIN32_ERROR = 8545u32; -pub const ERROR_DS_DRA_OUT_OF_MEM: WIN32_ERROR = 8446u32; -pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: WIN32_ERROR = 8617u32; -pub const ERROR_DS_DRA_PREEMPTED: WIN32_ERROR = 8461u32; -pub const ERROR_DS_DRA_RECYCLED_TARGET: WIN32_ERROR = 8639u32; -pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: WIN32_ERROR = 8448u32; -pub const ERROR_DS_DRA_REF_NOT_FOUND: WIN32_ERROR = 8449u32; -pub const ERROR_DS_DRA_REPL_PENDING: WIN32_ERROR = 8477u32; -pub const ERROR_DS_DRA_RPC_CANCELLED: WIN32_ERROR = 8455u32; -pub const ERROR_DS_DRA_SCHEMA_CONFLICT: WIN32_ERROR = 8543u32; -pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: WIN32_ERROR = 8542u32; -pub const ERROR_DS_DRA_SCHEMA_MISMATCH: WIN32_ERROR = 8418u32; -pub const ERROR_DS_DRA_SECRETS_DENIED: WIN32_ERROR = 8630u32; -pub const ERROR_DS_DRA_SHUTDOWN: WIN32_ERROR = 8463u32; -pub const ERROR_DS_DRA_SINK_DISABLED: WIN32_ERROR = 8457u32; -pub const ERROR_DS_DRA_SOURCE_DISABLED: WIN32_ERROR = 8456u32; -pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: WIN32_ERROR = 8465u32; -pub const ERROR_DS_DRA_SOURCE_REINSTALLED: WIN32_ERROR = 8459u32; -pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: WIN32_ERROR = 8594u32; -pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: WIN32_ERROR = 8342u32; -pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: WIN32_ERROR = 8496u32; -pub const ERROR_DS_DST_NC_MISMATCH: WIN32_ERROR = 8486u32; -pub const ERROR_DS_DS_REQUIRED: WIN32_ERROR = 8478u32; -pub const ERROR_DS_DUPLICATE_ID_FOUND: WIN32_ERROR = 8605u32; -pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: WIN32_ERROR = 8382u32; -pub const ERROR_DS_DUP_LINK_ID: WIN32_ERROR = 8468u32; -pub const ERROR_DS_DUP_MAPI_ID: WIN32_ERROR = 8380u32; -pub const ERROR_DS_DUP_MSDS_INTID: WIN32_ERROR = 8597u32; -pub const ERROR_DS_DUP_OID: WIN32_ERROR = 8379u32; -pub const ERROR_DS_DUP_RDN: WIN32_ERROR = 8378u32; -pub const ERROR_DS_DUP_SCHEMA_ID_GUID: WIN32_ERROR = 8381u32; -pub const ERROR_DS_ENCODING_ERROR: WIN32_ERROR = 8252u32; -pub const ERROR_DS_EPOCH_MISMATCH: WIN32_ERROR = 8483u32; -pub const ERROR_DS_EXISTING_AD_CHILD_NC: WIN32_ERROR = 8613u32; -pub const ERROR_DS_EXISTS_IN_AUX_CLS: WIN32_ERROR = 8393u32; -pub const ERROR_DS_EXISTS_IN_MAY_HAVE: WIN32_ERROR = 8386u32; -pub const ERROR_DS_EXISTS_IN_MUST_HAVE: WIN32_ERROR = 8385u32; -pub const ERROR_DS_EXISTS_IN_POSS_SUP: WIN32_ERROR = 8395u32; -pub const ERROR_DS_EXISTS_IN_RDNATTID: WIN32_ERROR = 8598u32; -pub const ERROR_DS_EXISTS_IN_SUB_CLS: WIN32_ERROR = 8394u32; -pub const ERROR_DS_FILTER_UNKNOWN: WIN32_ERROR = 8254u32; -pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: WIN32_ERROR = 8555u32; -pub const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST: WIN32_ERROR = 8635u32; -pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: WIN32_ERROR = 8563u32; -pub const ERROR_DS_FOREST_VERSION_TOO_LOW: WIN32_ERROR = 8565u32; -pub const ERROR_DS_GCVERIFY_ERROR: WIN32_ERROR = 8417u32; -pub const ERROR_DS_GC_NOT_AVAILABLE: WIN32_ERROR = 8217u32; -pub const ERROR_DS_GC_REQUIRED: WIN32_ERROR = 8547u32; -pub const ERROR_DS_GENERIC_ERROR: WIN32_ERROR = 8341u32; -pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: WIN32_ERROR = 8519u32; -pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: WIN32_ERROR = 8516u32; -pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: WIN32_ERROR = 8517u32; -pub const ERROR_DS_GOVERNSID_MISSING: WIN32_ERROR = 8410u32; -pub const ERROR_DS_GROUP_CONVERSION_ERROR: WIN32_ERROR = 8607u32; -pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: WIN32_ERROR = 8521u32; -pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: WIN32_ERROR = 8429u32; -pub const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: WIN32_ERROR = 8628u32; -pub const ERROR_DS_HIGH_ADLDS_FFL: WIN32_ERROR = 8641u32; -pub const ERROR_DS_HIGH_DSA_VERSION: WIN32_ERROR = 8642u32; -pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: WIN32_ERROR = 8507u32; -pub const ERROR_DS_ILLEGAL_MOD_OPERATION: WIN32_ERROR = 8311u32; -pub const ERROR_DS_ILLEGAL_SUPERIOR: WIN32_ERROR = 8345u32; -pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: WIN32_ERROR = 8492u32; -pub const ERROR_DS_INAPPROPRIATE_AUTH: WIN32_ERROR = 8233u32; -pub const ERROR_DS_INAPPROPRIATE_MATCHING: WIN32_ERROR = 8238u32; -pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: WIN32_ERROR = 8574u32; -pub const ERROR_DS_INCOMPATIBLE_VERSION: WIN32_ERROR = 8567u32; -pub const ERROR_DS_INCORRECT_ROLE_OWNER: WIN32_ERROR = 8210u32; -pub const ERROR_DS_INIT_FAILURE: WIN32_ERROR = 8532u32; -pub const ERROR_DS_INIT_FAILURE_CONSOLE: WIN32_ERROR = 8561u32; -pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: WIN32_ERROR = 8512u32; -pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: WIN32_ERROR = 8511u32; -pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: WIN32_ERROR = 8467u32; -pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: WIN32_ERROR = 8606u32; -pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: WIN32_ERROR = 8344u32; -pub const ERROR_DS_INTERNAL_FAILURE: WIN32_ERROR = 8430u32; -pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: WIN32_ERROR = 8203u32; -pub const ERROR_DS_INVALID_DMD: WIN32_ERROR = 8360u32; -pub const ERROR_DS_INVALID_DN_SYNTAX: WIN32_ERROR = 8242u32; -pub const ERROR_DS_INVALID_GROUP_TYPE: WIN32_ERROR = 8513u32; -pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: WIN32_ERROR = 8479u32; -pub const ERROR_DS_INVALID_NAME_FOR_SPN: WIN32_ERROR = 8554u32; -pub const ERROR_DS_INVALID_ROLE_OWNER: WIN32_ERROR = 8366u32; -pub const ERROR_DS_INVALID_SCRIPT: WIN32_ERROR = 8600u32; -pub const ERROR_DS_INVALID_SEARCH_FLAG: WIN32_ERROR = 8500u32; -pub const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: WIN32_ERROR = 8626u32; -pub const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: WIN32_ERROR = 8627u32; -pub const ERROR_DS_IS_LEAF: WIN32_ERROR = 8243u32; -pub const ERROR_DS_KEY_NOT_UNIQUE: WIN32_ERROR = 8527u32; -pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: WIN32_ERROR = 8616u32; -pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: WIN32_ERROR = 8577u32; -pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: WIN32_ERROR = 8520u32; -pub const ERROR_DS_LOCAL_ERROR: WIN32_ERROR = 8251u32; -pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: WIN32_ERROR = 8548u32; -pub const ERROR_DS_LOOP_DETECT: WIN32_ERROR = 8246u32; -pub const ERROR_DS_LOW_ADLDS_FFL: WIN32_ERROR = 8643u32; -pub const ERROR_DS_LOW_DSA_VERSION: WIN32_ERROR = 8568u32; -pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: WIN32_ERROR = 8572u32; -pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: WIN32_ERROR = 8557u32; -pub const ERROR_DS_MAPI_ID_NOT_AVAILABLE: WIN32_ERROR = 8632u32; -pub const ERROR_DS_MASTERDSA_REQUIRED: WIN32_ERROR = 8314u32; -pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: WIN32_ERROR = 8304u32; -pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: WIN32_ERROR = 8201u32; -pub const ERROR_DS_MISSING_EXPECTED_ATT: WIN32_ERROR = 8411u32; -pub const ERROR_DS_MISSING_FOREST_TRUST: WIN32_ERROR = 8649u32; -pub const ERROR_DS_MISSING_FSMO_SETTINGS: WIN32_ERROR = 8434u32; -pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: WIN32_ERROR = 8497u32; -pub const ERROR_DS_MISSING_REQUIRED_ATT: WIN32_ERROR = 8316u32; -pub const ERROR_DS_MISSING_SUPREF: WIN32_ERROR = 8406u32; -pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: WIN32_ERROR = 8581u32; -pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: WIN32_ERROR = 8579u32; -pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: WIN32_ERROR = 8582u32; -pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: WIN32_ERROR = 8558u32; -pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: WIN32_ERROR = 8473u32; -pub const ERROR_DS_NAME_ERROR_NOT_FOUND: WIN32_ERROR = 8470u32; -pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: WIN32_ERROR = 8471u32; -pub const ERROR_DS_NAME_ERROR_NO_MAPPING: WIN32_ERROR = 8472u32; -pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: WIN32_ERROR = 8474u32; -pub const ERROR_DS_NAME_ERROR_RESOLVING: WIN32_ERROR = 8469u32; -pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: WIN32_ERROR = 8583u32; -pub const ERROR_DS_NAME_NOT_UNIQUE: WIN32_ERROR = 8571u32; -pub const ERROR_DS_NAME_REFERENCE_INVALID: WIN32_ERROR = 8373u32; -pub const ERROR_DS_NAME_TOO_LONG: WIN32_ERROR = 8348u32; -pub const ERROR_DS_NAME_TOO_MANY_PARTS: WIN32_ERROR = 8347u32; -pub const ERROR_DS_NAME_TYPE_UNKNOWN: WIN32_ERROR = 8351u32; -pub const ERROR_DS_NAME_UNPARSEABLE: WIN32_ERROR = 8350u32; -pub const ERROR_DS_NAME_VALUE_TOO_LONG: WIN32_ERROR = 8349u32; -pub const ERROR_DS_NAMING_MASTER_GC: WIN32_ERROR = 8523u32; -pub const ERROR_DS_NAMING_VIOLATION: WIN32_ERROR = 8247u32; -pub const ERROR_DS_NCNAME_MISSING_CR_REF: WIN32_ERROR = 8412u32; -pub const ERROR_DS_NCNAME_MUST_BE_NC: WIN32_ERROR = 8357u32; -pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: WIN32_ERROR = 8494u32; -pub const ERROR_DS_NC_STILL_HAS_DSAS: WIN32_ERROR = 8546u32; -pub const ERROR_DS_NONEXISTENT_MAY_HAVE: WIN32_ERROR = 8387u32; -pub const ERROR_DS_NONEXISTENT_MUST_HAVE: WIN32_ERROR = 8388u32; -pub const ERROR_DS_NONEXISTENT_POSS_SUP: WIN32_ERROR = 8390u32; -pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: WIN32_ERROR = 8508u32; -pub const ERROR_DS_NON_ASQ_SEARCH: WIN32_ERROR = 8624u32; -pub const ERROR_DS_NON_BASE_SEARCH: WIN32_ERROR = 8480u32; -pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: WIN32_ERROR = 8377u32; -pub const ERROR_DS_NOT_AN_OBJECT: WIN32_ERROR = 8352u32; -pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: WIN32_ERROR = 8487u32; -pub const ERROR_DS_NOT_CLOSEST: WIN32_ERROR = 8588u32; -pub const ERROR_DS_NOT_INSTALLED: WIN32_ERROR = 8200u32; -pub const ERROR_DS_NOT_ON_BACKLINK: WIN32_ERROR = 8362u32; -pub const ERROR_DS_NOT_SUPPORTED: WIN32_ERROR = 8256u32; -pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: WIN32_ERROR = 8570u32; -pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: WIN32_ERROR = 8202u32; -pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: WIN32_ERROR = 8569u32; -pub const ERROR_DS_NO_CHAINED_EVAL: WIN32_ERROR = 8328u32; -pub const ERROR_DS_NO_CHAINING: WIN32_ERROR = 8327u32; -pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: WIN32_ERROR = 8551u32; -pub const ERROR_DS_NO_CROSSREF_FOR_NC: WIN32_ERROR = 8363u32; -pub const ERROR_DS_NO_DELETED_NAME: WIN32_ERROR = 8355u32; -pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: WIN32_ERROR = 8549u32; -pub const ERROR_DS_NO_MORE_RIDS: WIN32_ERROR = 8209u32; -pub const ERROR_DS_NO_MSDS_INTID: WIN32_ERROR = 8596u32; -pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: WIN32_ERROR = 8514u32; -pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: WIN32_ERROR = 8515u32; -pub const ERROR_DS_NO_NTDSA_OBJECT: WIN32_ERROR = 8623u32; -pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: WIN32_ERROR = 8580u32; -pub const ERROR_DS_NO_PARENT_OBJECT: WIN32_ERROR = 8329u32; -pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: WIN32_ERROR = 8533u32; -pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: WIN32_ERROR = 8306u32; -pub const ERROR_DS_NO_REF_DOMAIN: WIN32_ERROR = 8575u32; -pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: WIN32_ERROR = 8308u32; -pub const ERROR_DS_NO_RESULTS_RETURNED: WIN32_ERROR = 8257u32; -pub const ERROR_DS_NO_RIDS_ALLOCATED: WIN32_ERROR = 8208u32; -pub const ERROR_DS_NO_SERVER_OBJECT: WIN32_ERROR = 8622u32; -pub const ERROR_DS_NO_SUCH_OBJECT: WIN32_ERROR = 8240u32; -pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: WIN32_ERROR = 8501u32; -pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: WIN32_ERROR = 8592u32; -pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: WIN32_ERROR = 8591u32; -pub const ERROR_DS_OBJECT_BEING_REMOVED: WIN32_ERROR = 8339u32; -pub const ERROR_DS_OBJECT_CLASS_REQUIRED: WIN32_ERROR = 8315u32; -pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: WIN32_ERROR = 8248u32; -pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: WIN32_ERROR = 8371u32; -pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: WIN32_ERROR = 8372u32; -pub const ERROR_DS_OBJ_CLASS_VIOLATION: WIN32_ERROR = 8212u32; -pub const ERROR_DS_OBJ_GUID_EXISTS: WIN32_ERROR = 8361u32; -pub const ERROR_DS_OBJ_NOT_FOUND: WIN32_ERROR = 8333u32; -pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: WIN32_ERROR = 8305u32; -pub const ERROR_DS_OBJ_TOO_LARGE: WIN32_ERROR = 8312u32; -pub const ERROR_DS_OFFSET_RANGE_ERROR: WIN32_ERROR = 8262u32; -pub const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: WIN32_ERROR = 8637u32; -pub const ERROR_DS_OID_NOT_FOUND: WIN32_ERROR = 8638u32; -pub const ERROR_DS_OPERATIONS_ERROR: WIN32_ERROR = 8224u32; -pub const ERROR_DS_OUT_OF_SCOPE: WIN32_ERROR = 8338u32; -pub const ERROR_DS_OUT_OF_VERSION_STORE: WIN32_ERROR = 8573u32; -pub const ERROR_DS_PARAM_ERROR: WIN32_ERROR = 8255u32; -pub const ERROR_DS_PARENT_IS_AN_ALIAS: WIN32_ERROR = 8330u32; -pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: WIN32_ERROR = 8490u32; -pub const ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD: WIN32_ERROR = 8652u32; -pub const ERROR_DS_POLICY_NOT_KNOWN: WIN32_ERROR = 8618u32; -pub const ERROR_DS_PROTOCOL_ERROR: WIN32_ERROR = 8225u32; -pub const ERROR_DS_RANGE_CONSTRAINT: WIN32_ERROR = 8322u32; -pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: WIN32_ERROR = 8307u32; -pub const ERROR_DS_RECALCSCHEMA_FAILED: WIN32_ERROR = 8396u32; -pub const ERROR_DS_REFERRAL: WIN32_ERROR = 8235u32; -pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: WIN32_ERROR = 8260u32; -pub const ERROR_DS_REFUSING_FSMO_ROLES: WIN32_ERROR = 8433u32; -pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: WIN32_ERROR = 8601u32; -pub const ERROR_DS_REPLICATOR_ONLY: WIN32_ERROR = 8370u32; -pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: WIN32_ERROR = 8595u32; -pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: WIN32_ERROR = 8614u32; -pub const ERROR_DS_RESERVED_LINK_ID: WIN32_ERROR = 8576u32; -pub const ERROR_DS_RESERVED_MAPI_ID: WIN32_ERROR = 8631u32; -pub const ERROR_DS_RIDMGR_DISABLED: WIN32_ERROR = 8263u32; -pub const ERROR_DS_RIDMGR_INIT_ERROR: WIN32_ERROR = 8211u32; -pub const ERROR_DS_ROLE_NOT_VERIFIED: WIN32_ERROR = 8610u32; -pub const ERROR_DS_ROOT_CANT_BE_SUBREF: WIN32_ERROR = 8326u32; -pub const ERROR_DS_ROOT_MUST_BE_NC: WIN32_ERROR = 8301u32; -pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: WIN32_ERROR = 8432u32; -pub const ERROR_DS_SAM_INIT_FAILURE: WIN32_ERROR = 8504u32; -pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: WIN32_ERROR = 8562u32; -pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: WIN32_ERROR = 8530u32; -pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: WIN32_ERROR = 8529u32; -pub const ERROR_DS_SCHEMA_ALLOC_FAILED: WIN32_ERROR = 8415u32; -pub const ERROR_DS_SCHEMA_NOT_LOADED: WIN32_ERROR = 8414u32; -pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: WIN32_ERROR = 8509u32; -pub const ERROR_DS_SECURITY_CHECKING_ERROR: WIN32_ERROR = 8413u32; -pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: WIN32_ERROR = 8423u32; -pub const ERROR_DS_SEC_DESC_INVALID: WIN32_ERROR = 8354u32; -pub const ERROR_DS_SEC_DESC_TOO_SHORT: WIN32_ERROR = 8353u32; -pub const ERROR_DS_SEMANTIC_ATT_TEST: WIN32_ERROR = 8383u32; -pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: WIN32_ERROR = 8505u32; -pub const ERROR_DS_SERVER_DOWN: WIN32_ERROR = 8250u32; -pub const ERROR_DS_SHUTTING_DOWN: WIN32_ERROR = 8364u32; -pub const ERROR_DS_SINGLE_USER_MODE_FAILED: WIN32_ERROR = 8590u32; -pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: WIN32_ERROR = 8321u32; -pub const ERROR_DS_SIZELIMIT_EXCEEDED: WIN32_ERROR = 8227u32; -pub const ERROR_DS_SORT_CONTROL_MISSING: WIN32_ERROR = 8261u32; -pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: WIN32_ERROR = 8552u32; -pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: WIN32_ERROR = 8534u32; -pub const ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST: WIN32_ERROR = 8647u32; -pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: WIN32_ERROR = 8485u32; -pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: WIN32_ERROR = 8540u32; -pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: WIN32_ERROR = 8559u32; -pub const ERROR_DS_SRC_GUID_MISMATCH: WIN32_ERROR = 8488u32; -pub const ERROR_DS_SRC_NAME_MISMATCH: WIN32_ERROR = 8484u32; -pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: WIN32_ERROR = 8538u32; -pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: WIN32_ERROR = 8539u32; -pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: WIN32_ERROR = 8522u32; -pub const ERROR_DS_STRONG_AUTH_REQUIRED: WIN32_ERROR = 8232u32; -pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: WIN32_ERROR = 8356u32; -pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: WIN32_ERROR = 8376u32; -pub const ERROR_DS_SUB_CLS_TEST_FAIL: WIN32_ERROR = 8391u32; -pub const ERROR_DS_SYNTAX_MISMATCH: WIN32_ERROR = 8384u32; -pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: WIN32_ERROR = 8587u32; -pub const ERROR_DS_TIMELIMIT_EXCEEDED: WIN32_ERROR = 8226u32; -pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: WIN32_ERROR = 8397u32; -pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: WIN32_ERROR = 8435u32; -pub const ERROR_DS_UNAVAILABLE: WIN32_ERROR = 8207u32; -pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: WIN32_ERROR = 8236u32; -pub const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED: WIN32_ERROR = 8645u32; -pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: WIN32_ERROR = 8556u32; -pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: WIN32_ERROR = 8518u32; -pub const ERROR_DS_UNKNOWN_ERROR: WIN32_ERROR = 8431u32; -pub const ERROR_DS_UNKNOWN_OPERATION: WIN32_ERROR = 8365u32; -pub const ERROR_DS_UNWILLING_TO_PERFORM: WIN32_ERROR = 8245u32; -pub const ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST: WIN32_ERROR = 8648u32; -pub const ERROR_DS_USER_BUFFER_TO_SMALL: WIN32_ERROR = 8309u32; -pub const ERROR_DS_VALUE_KEY_NOT_UNIQUE: WIN32_ERROR = 8650u32; -pub const ERROR_DS_VERSION_CHECK_FAILURE: WIN32_ERROR = 643u32; -pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: WIN32_ERROR = 8611u32; -pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: WIN32_ERROR = 8528u32; -pub const ERROR_DS_WRONG_OM_OBJ_CLASS: WIN32_ERROR = 8476u32; -pub const ERROR_DUPLICATE_PRIVILEGES: WIN32_ERROR = 311u32; -pub const ERROR_DUPLICATE_SERVICE_NAME: WIN32_ERROR = 1078u32; -pub const ERROR_DUP_DOMAINNAME: WIN32_ERROR = 1221u32; -pub const ERROR_DUP_NAME: WIN32_ERROR = 52u32; -pub const ERROR_DYNAMIC_CODE_BLOCKED: WIN32_ERROR = 1655u32; -pub const ERROR_DYNLINK_FROM_INVALID_RING: WIN32_ERROR = 196u32; -pub const ERROR_EAS_DIDNT_FIT: WIN32_ERROR = 275u32; -pub const ERROR_EAS_NOT_SUPPORTED: WIN32_ERROR = 282u32; -pub const ERROR_EA_ACCESS_DENIED: WIN32_ERROR = 994u32; -pub const ERROR_EA_FILE_CORRUPT: WIN32_ERROR = 276u32; -pub const ERROR_EA_LIST_INCONSISTENT: WIN32_ERROR = 255u32; -pub const ERROR_EA_TABLE_FULL: WIN32_ERROR = 277u32; -pub const ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED: WIN32_ERROR = 357u32; -pub const ERROR_EDP_POLICY_DENIES_OPERATION: WIN32_ERROR = 356u32; -pub const ERROR_EFS_ALG_BLOB_TOO_BIG: WIN32_ERROR = 6013u32; -pub const ERROR_EFS_DISABLED: WIN32_ERROR = 6015u32; -pub const ERROR_EFS_SERVER_NOT_TRUSTED: WIN32_ERROR = 6011u32; -pub const ERROR_EFS_VERSION_NOT_SUPPORT: WIN32_ERROR = 6016u32; -pub const ERROR_ELEVATION_REQUIRED: WIN32_ERROR = 740u32; -pub const ERROR_ENCLAVE_FAILURE: WIN32_ERROR = 349u32; -pub const ERROR_ENCLAVE_NOT_TERMINATED: WIN32_ERROR = 814u32; -pub const ERROR_ENCLAVE_VIOLATION: WIN32_ERROR = 815u32; -pub const ERROR_ENCRYPTED_FILE_NOT_SUPPORTED: WIN32_ERROR = 489u32; -pub const ERROR_ENCRYPTED_IO_NOT_POSSIBLE: WIN32_ERROR = 808u32; -pub const ERROR_ENCRYPTING_METADATA_DISALLOWED: WIN32_ERROR = 431u32; -pub const ERROR_ENCRYPTION_DISABLED: WIN32_ERROR = 430u32; -pub const ERROR_ENCRYPTION_FAILED: WIN32_ERROR = 6000u32; -pub const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION: WIN32_ERROR = 6022u32; -pub const ERROR_END_OF_MEDIA: WIN32_ERROR = 1100u32; -pub const ERROR_ENVVAR_NOT_FOUND: WIN32_ERROR = 203u32; -pub const ERROR_EOM_OVERFLOW: WIN32_ERROR = 1129u32; -pub const ERROR_ERRORS_ENCOUNTERED: WIN32_ERROR = 774u32; -pub const ERROR_EVALUATION_EXPIRATION: WIN32_ERROR = 622u32; -pub const ERROR_EVENTLOG_CANT_START: WIN32_ERROR = 1501u32; -pub const ERROR_EVENTLOG_FILE_CHANGED: WIN32_ERROR = 1503u32; -pub const ERROR_EVENTLOG_FILE_CORRUPT: WIN32_ERROR = 1500u32; -pub const ERROR_EVENT_DONE: WIN32_ERROR = 710u32; -pub const ERROR_EVENT_PENDING: WIN32_ERROR = 711u32; -pub const ERROR_EXCEPTION_IN_SERVICE: WIN32_ERROR = 1064u32; -pub const ERROR_EXCL_SEM_ALREADY_OWNED: WIN32_ERROR = 101u32; -pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: WIN32_ERROR = 217u32; -pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: WIN32_ERROR = 218u32; -pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: WIN32_ERROR = 216u32; -pub const ERROR_EXE_MARKED_INVALID: WIN32_ERROR = 192u32; -pub const ERROR_EXTENDED_ERROR: WIN32_ERROR = 1208u32; -pub const ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: WIN32_ERROR = 343u32; -pub const ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED: WIN32_ERROR = 399u32; -pub const ERROR_EXTRANEOUS_INFORMATION: WIN32_ERROR = 677u32; -pub const ERROR_FAILED_DRIVER_ENTRY: WIN32_ERROR = 647u32; -pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: WIN32_ERROR = 1063u32; -pub const ERROR_FAIL_FAST_EXCEPTION: WIN32_ERROR = 1653u32; -pub const ERROR_FAIL_I24: WIN32_ERROR = 83u32; -pub const ERROR_FAIL_NOACTION_REBOOT: WIN32_ERROR = 350u32; -pub const ERROR_FAIL_RESTART: WIN32_ERROR = 352u32; -pub const ERROR_FAIL_SHUTDOWN: WIN32_ERROR = 351u32; -pub const ERROR_FATAL_APP_EXIT: WIN32_ERROR = 713u32; -pub const ERROR_FILEMARK_DETECTED: WIN32_ERROR = 1101u32; -pub const ERROR_FILENAME_EXCED_RANGE: WIN32_ERROR = 206u32; -pub const ERROR_FILE_CHECKED_OUT: WIN32_ERROR = 220u32; -pub const ERROR_FILE_CORRUPT: WIN32_ERROR = 1392u32; -pub const ERROR_FILE_ENCRYPTED: WIN32_ERROR = 6002u32; -pub const ERROR_FILE_EXISTS: WIN32_ERROR = 80u32; -pub const ERROR_FILE_HANDLE_REVOKED: WIN32_ERROR = 806u32; -pub const ERROR_FILE_INVALID: WIN32_ERROR = 1006u32; -pub const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED: WIN32_ERROR = 326u32; -pub const ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS: WIN32_ERROR = 809u32; -pub const ERROR_FILE_NOT_ENCRYPTED: WIN32_ERROR = 6007u32; -pub const ERROR_FILE_NOT_FOUND: WIN32_ERROR = 2u32; -pub const ERROR_FILE_NOT_SUPPORTED: WIN32_ERROR = 425u32; -pub const ERROR_FILE_OFFLINE: WIN32_ERROR = 4350u32; -pub const ERROR_FILE_PROTECTED_UNDER_DPL: WIN32_ERROR = 406u32; -pub const ERROR_FILE_READ_ONLY: WIN32_ERROR = 6009u32; -pub const ERROR_FILE_SNAP_INVALID_PARAMETER: WIN32_ERROR = 440u32; -pub const ERROR_FILE_SNAP_IN_PROGRESS: WIN32_ERROR = 435u32; -pub const ERROR_FILE_SNAP_IO_NOT_COORDINATED: WIN32_ERROR = 438u32; -pub const ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED: WIN32_ERROR = 437u32; -pub const ERROR_FILE_SNAP_UNEXPECTED_ERROR: WIN32_ERROR = 439u32; -pub const ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED: WIN32_ERROR = 436u32; -pub const ERROR_FILE_SYSTEM_LIMITATION: WIN32_ERROR = 665u32; -pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY: WIN32_ERROR = 371u32; -pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION: WIN32_ERROR = 385u32; -pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT: WIN32_ERROR = 370u32; -pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN: WIN32_ERROR = 372u32; -pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE: WIN32_ERROR = 369u32; -pub const ERROR_FILE_TOO_LARGE: WIN32_ERROR = 223u32; -pub const ERROR_FIRMWARE_UPDATED: WIN32_ERROR = 728u32; -pub const ERROR_FLOAT_MULTIPLE_FAULTS: WIN32_ERROR = 630u32; -pub const ERROR_FLOAT_MULTIPLE_TRAPS: WIN32_ERROR = 631u32; -pub const ERROR_FLOPPY_BAD_REGISTERS: WIN32_ERROR = 1125u32; -pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: WIN32_ERROR = 1122u32; -pub const ERROR_FLOPPY_UNKNOWN_ERROR: WIN32_ERROR = 1124u32; -pub const ERROR_FLOPPY_VOLUME: WIN32_ERROR = 584u32; -pub const ERROR_FLOPPY_WRONG_CYLINDER: WIN32_ERROR = 1123u32; -pub const ERROR_FORMS_AUTH_REQUIRED: WIN32_ERROR = 224u32; -pub const ERROR_FOUND_OUT_OF_SCOPE: WIN32_ERROR = 601u32; -pub const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: WIN32_ERROR = 762u32; -pub const ERROR_FS_DRIVER_REQUIRED: WIN32_ERROR = 588u32; -pub const ERROR_FS_METADATA_INCONSISTENT: WIN32_ERROR = 510u32; -pub const ERROR_FT_DI_SCAN_REQUIRED: WIN32_ERROR = 339u32; -pub const ERROR_FT_READ_FAILURE: WIN32_ERROR = 415u32; -pub const ERROR_FT_READ_FROM_COPY_FAILURE: WIN32_ERROR = 818u32; -pub const ERROR_FT_READ_RECOVERY_FROM_BACKUP: WIN32_ERROR = 704u32; -pub const ERROR_FT_WRITE_FAILURE: WIN32_ERROR = 338u32; -pub const ERROR_FT_WRITE_RECOVERY: WIN32_ERROR = 705u32; -pub const ERROR_FULLSCREEN_MODE: WIN32_ERROR = 1007u32; -pub const ERROR_FUNCTION_FAILED: WIN32_ERROR = 1627u32; -pub const ERROR_FUNCTION_NOT_CALLED: WIN32_ERROR = 1626u32; -pub const ERROR_GDI_HANDLE_LEAK: WIN32_ERROR = 373u32; -pub const ERROR_GENERIC_NOT_MAPPED: WIN32_ERROR = 1360u32; -pub const ERROR_GEN_FAILURE: WIN32_ERROR = 31u32; -pub const ERROR_GLOBAL_ONLY_HOOK: WIN32_ERROR = 1429u32; -pub const ERROR_GRACEFUL_DISCONNECT: WIN32_ERROR = 1226u32; -pub const ERROR_GROUP_EXISTS: WIN32_ERROR = 1318u32; -pub const ERROR_GUID_SUBSTITUTION_MADE: WIN32_ERROR = 680u32; -pub const ERROR_HANDLES_CLOSED: WIN32_ERROR = 676u32; -pub const ERROR_HANDLE_DISK_FULL: WIN32_ERROR = 39u32; -pub const ERROR_HANDLE_EOF: WIN32_ERROR = 38u32; -pub const ERROR_HANDLE_REVOKED: WIN32_ERROR = 811u32; -pub const ERROR_HAS_SYSTEM_CRITICAL_FILES: WIN32_ERROR = 488u32; -pub const ERROR_HIBERNATED: WIN32_ERROR = 726u32; -pub const ERROR_HIBERNATION_FAILURE: WIN32_ERROR = 656u32; -pub const ERROR_HOOK_NEEDS_HMOD: WIN32_ERROR = 1428u32; -pub const ERROR_HOOK_NOT_INSTALLED: WIN32_ERROR = 1431u32; -pub const ERROR_HOOK_TYPE_NOT_ALLOWED: WIN32_ERROR = 1458u32; -pub const ERROR_HOST_DOWN: WIN32_ERROR = 1256u32; -pub const ERROR_HOST_UNREACHABLE: WIN32_ERROR = 1232u32; -pub const ERROR_HOTKEY_ALREADY_REGISTERED: WIN32_ERROR = 1409u32; -pub const ERROR_HOTKEY_NOT_REGISTERED: WIN32_ERROR = 1419u32; -pub const ERROR_HWNDS_HAVE_DIFF_PARENT: WIN32_ERROR = 1441u32; -pub const ERROR_ILLEGAL_CHARACTER: WIN32_ERROR = 582u32; -pub const ERROR_ILLEGAL_DLL_RELOCATION: WIN32_ERROR = 623u32; -pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: WIN32_ERROR = 1162u32; -pub const ERROR_ILLEGAL_FLOAT_CONTEXT: WIN32_ERROR = 579u32; -pub const ERROR_ILL_FORMED_PASSWORD: WIN32_ERROR = 1324u32; -pub const ERROR_IMAGE_AT_DIFFERENT_BASE: WIN32_ERROR = 807u32; -pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH: WIN32_ERROR = 706u32; -pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: WIN32_ERROR = 720u32; -pub const ERROR_IMAGE_NOT_AT_BASE: WIN32_ERROR = 700u32; -pub const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT: WIN32_ERROR = 308u32; -pub const ERROR_IMPLEMENTATION_LIMIT: WIN32_ERROR = 1292u32; -pub const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE: WIN32_ERROR = 1297u32; -pub const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE: WIN32_ERROR = 1290u32; -pub const ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: WIN32_ERROR = 304u32; -pub const ERROR_INCORRECT_ACCOUNT_TYPE: WIN32_ERROR = 8646u32; -pub const ERROR_INCORRECT_ADDRESS: WIN32_ERROR = 1241u32; -pub const ERROR_INCORRECT_SIZE: WIN32_ERROR = 1462u32; -pub const ERROR_INDEX_ABSENT: WIN32_ERROR = 1611u32; -pub const ERROR_INDEX_OUT_OF_BOUNDS: WIN32_ERROR = 474u32; -pub const ERROR_INFLOOP_IN_RELOC_CHAIN: WIN32_ERROR = 202u32; -pub const ERROR_INSTALL_ALREADY_RUNNING: WIN32_ERROR = 1618u32; -pub const ERROR_INSTALL_FAILURE: WIN32_ERROR = 1603u32; -pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: WIN32_ERROR = 1623u32; -pub const ERROR_INSTALL_LOG_FAILURE: WIN32_ERROR = 1622u32; -pub const ERROR_INSTALL_NOTUSED: WIN32_ERROR = 1634u32; -pub const ERROR_INSTALL_PACKAGE_INVALID: WIN32_ERROR = 1620u32; -pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: WIN32_ERROR = 1619u32; -pub const ERROR_INSTALL_PACKAGE_REJECTED: WIN32_ERROR = 1625u32; -pub const ERROR_INSTALL_PACKAGE_VERSION: WIN32_ERROR = 1613u32; -pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: WIN32_ERROR = 1633u32; -pub const ERROR_INSTALL_REJECTED: WIN32_ERROR = 1654u32; -pub const ERROR_INSTALL_REMOTE_DISALLOWED: WIN32_ERROR = 1640u32; -pub const ERROR_INSTALL_REMOTE_PROHIBITED: WIN32_ERROR = 1645u32; -pub const ERROR_INSTALL_SERVICE_FAILURE: WIN32_ERROR = 1601u32; -pub const ERROR_INSTALL_SERVICE_SAFEBOOT: WIN32_ERROR = 1652u32; -pub const ERROR_INSTALL_SOURCE_ABSENT: WIN32_ERROR = 1612u32; -pub const ERROR_INSTALL_SUSPEND: WIN32_ERROR = 1604u32; -pub const ERROR_INSTALL_TEMP_UNWRITABLE: WIN32_ERROR = 1632u32; -pub const ERROR_INSTALL_TRANSFORM_FAILURE: WIN32_ERROR = 1624u32; -pub const ERROR_INSTALL_TRANSFORM_REJECTED: WIN32_ERROR = 1644u32; -pub const ERROR_INSTALL_UI_FAILURE: WIN32_ERROR = 1621u32; -pub const ERROR_INSTALL_USEREXIT: WIN32_ERROR = 1602u32; -pub const ERROR_INSTRUCTION_MISALIGNMENT: WIN32_ERROR = 549u32; -pub const ERROR_INSUFFICIENT_BUFFER: WIN32_ERROR = 122u32; -pub const ERROR_INSUFFICIENT_LOGON_INFO: WIN32_ERROR = 608u32; -pub const ERROR_INSUFFICIENT_POWER: WIN32_ERROR = 639u32; -pub const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: WIN32_ERROR = 781u32; -pub const ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES: WIN32_ERROR = 473u32; -pub const ERROR_INTERMIXED_KERNEL_EA_OPERATION: WIN32_ERROR = 324u32; -pub const ERROR_INTERNAL_DB_CORRUPTION: WIN32_ERROR = 1358u32; -pub const ERROR_INTERNAL_DB_ERROR: WIN32_ERROR = 1383u32; -pub const ERROR_INTERNAL_ERROR: WIN32_ERROR = 1359u32; -pub const ERROR_INTERRUPT_STILL_CONNECTED: WIN32_ERROR = 764u32; -pub const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: WIN32_ERROR = 763u32; -pub const ERROR_INVALID_ACCEL_HANDLE: WIN32_ERROR = 1403u32; -pub const ERROR_INVALID_ACCESS: WIN32_ERROR = 12u32; -pub const ERROR_INVALID_ACCOUNT_NAME: WIN32_ERROR = 1315u32; -pub const ERROR_INVALID_ACE_CONDITION: WIN32_ERROR = 805u32; -pub const ERROR_INVALID_ACL: WIN32_ERROR = 1336u32; -pub const ERROR_INVALID_ADDRESS: WIN32_ERROR = 487u32; -pub const ERROR_INVALID_AT_INTERRUPT_TIME: WIN32_ERROR = 104u32; -pub const ERROR_INVALID_BLOCK: WIN32_ERROR = 9u32; -pub const ERROR_INVALID_BLOCK_LENGTH: WIN32_ERROR = 1106u32; -pub const ERROR_INVALID_CAP: WIN32_ERROR = 320u32; -pub const ERROR_INVALID_CATEGORY: WIN32_ERROR = 117u32; -pub const ERROR_INVALID_COMBOBOX_MESSAGE: WIN32_ERROR = 1422u32; -pub const ERROR_INVALID_COMMAND_LINE: WIN32_ERROR = 1639u32; -pub const ERROR_INVALID_COMPUTERNAME: WIN32_ERROR = 1210u32; -pub const ERROR_INVALID_CRUNTIME_PARAMETER: WIN32_ERROR = 1288u32; -pub const ERROR_INVALID_CURSOR_HANDLE: WIN32_ERROR = 1402u32; -pub const ERROR_INVALID_DATA: WIN32_ERROR = 13u32; -pub const ERROR_INVALID_DATATYPE: WIN32_ERROR = 1804u32; -pub const ERROR_INVALID_DEVICE_OBJECT_PARAMETER: WIN32_ERROR = 650u32; -pub const ERROR_INVALID_DLL: WIN32_ERROR = 1154u32; -pub const ERROR_INVALID_DOMAINNAME: WIN32_ERROR = 1212u32; -pub const ERROR_INVALID_DOMAIN_ROLE: WIN32_ERROR = 1354u32; -pub const ERROR_INVALID_DOMAIN_STATE: WIN32_ERROR = 1353u32; -pub const ERROR_INVALID_DRIVE: WIN32_ERROR = 15u32; -pub const ERROR_INVALID_DWP_HANDLE: WIN32_ERROR = 1405u32; -pub const ERROR_INVALID_EA_HANDLE: WIN32_ERROR = 278u32; -pub const ERROR_INVALID_EA_NAME: WIN32_ERROR = 254u32; -pub const ERROR_INVALID_EDIT_HEIGHT: WIN32_ERROR = 1424u32; -pub const ERROR_INVALID_ENVIRONMENT: WIN32_ERROR = 1805u32; -pub const ERROR_INVALID_EVENTNAME: WIN32_ERROR = 1211u32; -pub const ERROR_INVALID_EVENT_COUNT: WIN32_ERROR = 151u32; -pub const ERROR_INVALID_EXCEPTION_HANDLER: WIN32_ERROR = 310u32; -pub const ERROR_INVALID_EXE_SIGNATURE: WIN32_ERROR = 191u32; -pub const ERROR_INVALID_FIELD: WIN32_ERROR = 1616u32; -pub const ERROR_INVALID_FIELD_IN_PARAMETER_LIST: WIN32_ERROR = 328u32; -pub const ERROR_INVALID_FILTER_PROC: WIN32_ERROR = 1427u32; -pub const ERROR_INVALID_FLAGS: WIN32_ERROR = 1004u32; -pub const ERROR_INVALID_FLAG_NUMBER: WIN32_ERROR = 186u32; -pub const ERROR_INVALID_FORM_NAME: WIN32_ERROR = 1902u32; -pub const ERROR_INVALID_FORM_SIZE: WIN32_ERROR = 1903u32; -pub const ERROR_INVALID_FUNCTION: WIN32_ERROR = 1u32; -pub const ERROR_INVALID_GROUPNAME: WIN32_ERROR = 1209u32; -pub const ERROR_INVALID_GROUP_ATTRIBUTES: WIN32_ERROR = 1345u32; -pub const ERROR_INVALID_GW_COMMAND: WIN32_ERROR = 1443u32; -pub const ERROR_INVALID_HANDLE: WIN32_ERROR = 6u32; -pub const ERROR_INVALID_HANDLE_STATE: WIN32_ERROR = 1609u32; -pub const ERROR_INVALID_HOOK_FILTER: WIN32_ERROR = 1426u32; -pub const ERROR_INVALID_HOOK_HANDLE: WIN32_ERROR = 1404u32; -pub const ERROR_INVALID_HW_PROFILE: WIN32_ERROR = 619u32; -pub const ERROR_INVALID_ICON_HANDLE: WIN32_ERROR = 1414u32; -pub const ERROR_INVALID_ID_AUTHORITY: WIN32_ERROR = 1343u32; -pub const ERROR_INVALID_IMAGE_HASH: WIN32_ERROR = 577u32; -pub const ERROR_INVALID_IMPORT_OF_NON_DLL: WIN32_ERROR = 1276u32; -pub const ERROR_INVALID_INDEX: WIN32_ERROR = 1413u32; -pub const ERROR_INVALID_KERNEL_INFO_VERSION: WIN32_ERROR = 340u32; -pub const ERROR_INVALID_KEYBOARD_HANDLE: WIN32_ERROR = 1457u32; -pub const ERROR_INVALID_LABEL: WIN32_ERROR = 1299u32; -pub const ERROR_INVALID_LB_MESSAGE: WIN32_ERROR = 1432u32; -pub const ERROR_INVALID_LDT_DESCRIPTOR: WIN32_ERROR = 564u32; -pub const ERROR_INVALID_LDT_OFFSET: WIN32_ERROR = 563u32; -pub const ERROR_INVALID_LDT_SIZE: WIN32_ERROR = 561u32; -pub const ERROR_INVALID_LEVEL: WIN32_ERROR = 124u32; -pub const ERROR_INVALID_LIST_FORMAT: WIN32_ERROR = 153u32; -pub const ERROR_INVALID_LOCK_RANGE: WIN32_ERROR = 307u32; -pub const ERROR_INVALID_LOGON_HOURS: WIN32_ERROR = 1328u32; -pub const ERROR_INVALID_LOGON_TYPE: WIN32_ERROR = 1367u32; -pub const ERROR_INVALID_MEMBER: WIN32_ERROR = 1388u32; -pub const ERROR_INVALID_MENU_HANDLE: WIN32_ERROR = 1401u32; -pub const ERROR_INVALID_MESSAGE: WIN32_ERROR = 1002u32; -pub const ERROR_INVALID_MESSAGEDEST: WIN32_ERROR = 1218u32; -pub const ERROR_INVALID_MESSAGENAME: WIN32_ERROR = 1217u32; -pub const ERROR_INVALID_MINALLOCSIZE: WIN32_ERROR = 195u32; -pub const ERROR_INVALID_MODULETYPE: WIN32_ERROR = 190u32; -pub const ERROR_INVALID_MONITOR_HANDLE: WIN32_ERROR = 1461u32; -pub const ERROR_INVALID_MSGBOX_STYLE: WIN32_ERROR = 1438u32; -pub const ERROR_INVALID_NAME: WIN32_ERROR = 123u32; -pub const ERROR_INVALID_NETNAME: WIN32_ERROR = 1214u32; -pub const ERROR_INVALID_OPLOCK_PROTOCOL: WIN32_ERROR = 301u32; -pub const ERROR_INVALID_ORDINAL: WIN32_ERROR = 182u32; -pub const ERROR_INVALID_OWNER: WIN32_ERROR = 1307u32; -pub const ERROR_INVALID_PACKAGE_SID_LENGTH: WIN32_ERROR = 4253u32; -pub const ERROR_INVALID_PARAMETER: WIN32_ERROR = 87u32; -pub const ERROR_INVALID_PASSWORD: WIN32_ERROR = 86u32; -pub const ERROR_INVALID_PASSWORDNAME: WIN32_ERROR = 1216u32; -pub const ERROR_INVALID_PATCH_XML: WIN32_ERROR = 1650u32; -pub const ERROR_INVALID_PEP_INFO_VERSION: WIN32_ERROR = 341u32; -pub const ERROR_INVALID_PLUGPLAY_DEVICE_PATH: WIN32_ERROR = 620u32; -pub const ERROR_INVALID_PORT_ATTRIBUTES: WIN32_ERROR = 545u32; -pub const ERROR_INVALID_PRIMARY_GROUP: WIN32_ERROR = 1308u32; -pub const ERROR_INVALID_PRINTER_COMMAND: WIN32_ERROR = 1803u32; -pub const ERROR_INVALID_PRINTER_NAME: WIN32_ERROR = 1801u32; -pub const ERROR_INVALID_PRINTER_STATE: WIN32_ERROR = 1906u32; -pub const ERROR_INVALID_PRIORITY: WIN32_ERROR = 1800u32; -pub const ERROR_INVALID_QUOTA_LOWER: WIN32_ERROR = 547u32; -pub const ERROR_INVALID_REPARSE_DATA: WIN32_ERROR = 4392u32; -pub const ERROR_INVALID_SCROLLBAR_RANGE: WIN32_ERROR = 1448u32; -pub const ERROR_INVALID_SECURITY_DESCR: WIN32_ERROR = 1338u32; -pub const ERROR_INVALID_SEGDPL: WIN32_ERROR = 198u32; -pub const ERROR_INVALID_SEGMENT_NUMBER: WIN32_ERROR = 180u32; -pub const ERROR_INVALID_SEPARATOR_FILE: WIN32_ERROR = 1799u32; -pub const ERROR_INVALID_SERVER_STATE: WIN32_ERROR = 1352u32; -pub const ERROR_INVALID_SERVICENAME: WIN32_ERROR = 1213u32; -pub const ERROR_INVALID_SERVICE_ACCOUNT: WIN32_ERROR = 1057u32; -pub const ERROR_INVALID_SERVICE_CONTROL: WIN32_ERROR = 1052u32; -pub const ERROR_INVALID_SERVICE_LOCK: WIN32_ERROR = 1071u32; -pub const ERROR_INVALID_SHARENAME: WIN32_ERROR = 1215u32; -pub const ERROR_INVALID_SHOWWIN_COMMAND: WIN32_ERROR = 1449u32; -pub const ERROR_INVALID_SID: WIN32_ERROR = 1337u32; -pub const ERROR_INVALID_SIGNAL_NUMBER: WIN32_ERROR = 209u32; -pub const ERROR_INVALID_SPI_VALUE: WIN32_ERROR = 1439u32; -pub const ERROR_INVALID_STACKSEG: WIN32_ERROR = 189u32; -pub const ERROR_INVALID_STARTING_CODESEG: WIN32_ERROR = 188u32; -pub const ERROR_INVALID_SUB_AUTHORITY: WIN32_ERROR = 1335u32; -pub const ERROR_INVALID_TABLE: WIN32_ERROR = 1628u32; -pub const ERROR_INVALID_TARGET_HANDLE: WIN32_ERROR = 114u32; -pub const ERROR_INVALID_TASK_INDEX: WIN32_ERROR = 1551u32; -pub const ERROR_INVALID_TASK_NAME: WIN32_ERROR = 1550u32; -pub const ERROR_INVALID_THREAD_ID: WIN32_ERROR = 1444u32; -pub const ERROR_INVALID_TIME: WIN32_ERROR = 1901u32; -pub const ERROR_INVALID_TOKEN: WIN32_ERROR = 315u32; -pub const ERROR_INVALID_UNWIND_TARGET: WIN32_ERROR = 544u32; -pub const ERROR_INVALID_USER_BUFFER: WIN32_ERROR = 1784u32; -pub const ERROR_INVALID_USER_PRINCIPAL_NAME: WIN32_ERROR = 8636u32; -pub const ERROR_INVALID_VARIANT: WIN32_ERROR = 604u32; -pub const ERROR_INVALID_VERIFY_SWITCH: WIN32_ERROR = 118u32; -pub const ERROR_INVALID_WINDOW_HANDLE: WIN32_ERROR = 1400u32; -pub const ERROR_INVALID_WORKSTATION: WIN32_ERROR = 1329u32; -pub const ERROR_IOPL_NOT_ENABLED: WIN32_ERROR = 197u32; -pub const ERROR_IO_DEVICE: WIN32_ERROR = 1117u32; -pub const ERROR_IO_INCOMPLETE: WIN32_ERROR = 996u32; -pub const ERROR_IO_PENDING: WIN32_ERROR = 997u32; -pub const ERROR_IO_PRIVILEGE_FAILED: WIN32_ERROR = 571u32; -pub const ERROR_IO_REISSUE_AS_CACHED: WIN32_ERROR = 3950u32; -pub const ERROR_IPSEC_IKE_TIMED_OUT: WIN32_ERROR = 13805u32; -pub const ERROR_IP_ADDRESS_CONFLICT1: WIN32_ERROR = 611u32; -pub const ERROR_IP_ADDRESS_CONFLICT2: WIN32_ERROR = 612u32; -pub const ERROR_IRQ_BUSY: WIN32_ERROR = 1119u32; -pub const ERROR_IS_JOINED: WIN32_ERROR = 134u32; -pub const ERROR_IS_JOIN_PATH: WIN32_ERROR = 147u32; -pub const ERROR_IS_JOIN_TARGET: WIN32_ERROR = 133u32; -pub const ERROR_IS_SUBSTED: WIN32_ERROR = 135u32; -pub const ERROR_IS_SUBST_PATH: WIN32_ERROR = 146u32; -pub const ERROR_IS_SUBST_TARGET: WIN32_ERROR = 149u32; -pub const ERROR_ITERATED_DATA_EXCEEDS_64k: WIN32_ERROR = 194u32; -pub const ERROR_JOB_NO_CONTAINER: WIN32_ERROR = 1505u32; -pub const ERROR_JOIN_TO_JOIN: WIN32_ERROR = 138u32; -pub const ERROR_JOIN_TO_SUBST: WIN32_ERROR = 140u32; -pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: WIN32_ERROR = 1178u32; -pub const ERROR_JOURNAL_ENTRY_DELETED: WIN32_ERROR = 1181u32; -pub const ERROR_JOURNAL_HOOK_SET: WIN32_ERROR = 1430u32; -pub const ERROR_JOURNAL_NOT_ACTIVE: WIN32_ERROR = 1179u32; -pub const ERROR_KERNEL_APC: WIN32_ERROR = 738u32; -pub const ERROR_KEY_DELETED: WIN32_ERROR = 1018u32; -pub const ERROR_KEY_HAS_CHILDREN: WIN32_ERROR = 1020u32; -pub const ERROR_KM_DRIVER_BLOCKED: WIN32_ERROR = 1930u32; -pub const ERROR_LABEL_TOO_LONG: WIN32_ERROR = 154u32; -pub const ERROR_LAST_ADMIN: WIN32_ERROR = 1322u32; -pub const ERROR_LB_WITHOUT_TABSTOPS: WIN32_ERROR = 1434u32; -pub const ERROR_LICENSE_QUOTA_EXCEEDED: WIN32_ERROR = 1395u32; -pub const ERROR_LINUX_SUBSYSTEM_NOT_PRESENT: WIN32_ERROR = 414u32; -pub const ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED: WIN32_ERROR = 444u32; -pub const ERROR_LISTBOX_ID_NOT_FOUND: WIN32_ERROR = 1416u32; -pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: WIN32_ERROR = 1390u32; -pub const ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED: WIN32_ERROR = 8653u32; -pub const ERROR_LOCAL_USER_SESSION_KEY: WIN32_ERROR = 1303u32; -pub const ERROR_LOCKED: WIN32_ERROR = 212u32; -pub const ERROR_LOCK_FAILED: WIN32_ERROR = 167u32; -pub const ERROR_LOCK_VIOLATION: WIN32_ERROR = 33u32; -pub const ERROR_LOGIN_TIME_RESTRICTION: WIN32_ERROR = 1239u32; -pub const ERROR_LOGIN_WKSTA_RESTRICTION: WIN32_ERROR = 1240u32; -pub const ERROR_LOGON_FAILURE: WIN32_ERROR = 1326u32; -pub const ERROR_LOGON_NOT_GRANTED: WIN32_ERROR = 1380u32; -pub const ERROR_LOGON_SERVER_CONFLICT: WIN32_ERROR = 568u32; -pub const ERROR_LOGON_SESSION_COLLISION: WIN32_ERROR = 1366u32; -pub const ERROR_LOGON_SESSION_EXISTS: WIN32_ERROR = 1363u32; -pub const ERROR_LOGON_TYPE_NOT_GRANTED: WIN32_ERROR = 1385u32; -pub const ERROR_LOG_FILE_FULL: WIN32_ERROR = 1502u32; -pub const ERROR_LOG_HARD_ERROR: WIN32_ERROR = 718u32; -pub const ERROR_LONGJUMP: WIN32_ERROR = 682u32; -pub const ERROR_LOST_MODE_LOGON_RESTRICTION: WIN32_ERROR = 1939u32; -pub const ERROR_LOST_WRITEBEHIND_DATA: WIN32_ERROR = 596u32; -pub const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: WIN32_ERROR = 790u32; -pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: WIN32_ERROR = 788u32; -pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: WIN32_ERROR = 789u32; -pub const ERROR_LUIDS_EXHAUSTED: WIN32_ERROR = 1334u32; -pub const ERROR_MACHINE_LOCKED: WIN32_ERROR = 1271u32; -pub const ERROR_MAGAZINE_NOT_PRESENT: WIN32_ERROR = 1163u32; -pub const ERROR_MAPPED_ALIGNMENT: WIN32_ERROR = 1132u32; -pub const ERROR_MARKED_TO_DISALLOW_WRITES: WIN32_ERROR = 348u32; -pub const ERROR_MARSHALL_OVERFLOW: WIN32_ERROR = 603u32; -pub const ERROR_MAX_SESSIONS_REACHED: WIN32_ERROR = 353u32; -pub const ERROR_MAX_THRDS_REACHED: WIN32_ERROR = 164u32; -pub const ERROR_MCA_EXCEPTION: WIN32_ERROR = 784u32; -pub const ERROR_MCA_OCCURED: WIN32_ERROR = 651u32; -pub const ERROR_MEDIA_CHANGED: WIN32_ERROR = 1110u32; -pub const ERROR_MEDIA_CHECK: WIN32_ERROR = 679u32; -pub const ERROR_MEMBERS_PRIMARY_GROUP: WIN32_ERROR = 1374u32; -pub const ERROR_MEMBER_IN_ALIAS: WIN32_ERROR = 1378u32; -pub const ERROR_MEMBER_IN_GROUP: WIN32_ERROR = 1320u32; -pub const ERROR_MEMBER_NOT_IN_ALIAS: WIN32_ERROR = 1377u32; -pub const ERROR_MEMBER_NOT_IN_GROUP: WIN32_ERROR = 1321u32; -pub const ERROR_MEMORY_HARDWARE: WIN32_ERROR = 779u32; -pub const ERROR_MENU_ITEM_NOT_FOUND: WIN32_ERROR = 1456u32; -pub const ERROR_MESSAGE_SYNC_ONLY: WIN32_ERROR = 1159u32; -pub const ERROR_META_EXPANSION_TOO_LONG: WIN32_ERROR = 208u32; -pub const ERROR_MISSING_SYSTEMFILE: WIN32_ERROR = 573u32; -pub const ERROR_MOD_NOT_FOUND: WIN32_ERROR = 126u32; -pub const ERROR_MORE_DATA: WIN32_ERROR = 234u32; -pub const ERROR_MORE_WRITES: WIN32_ERROR = 1120u32; -pub const ERROR_MOUNT_POINT_NOT_RESOLVED: WIN32_ERROR = 649u32; -pub const ERROR_MP_PROCESSOR_MISMATCH: WIN32_ERROR = 725u32; -pub const ERROR_MR_MID_NOT_FOUND: WIN32_ERROR = 317u32; -pub const ERROR_MULTIPLE_FAULT_VIOLATION: WIN32_ERROR = 640u32; -pub const ERROR_MUTANT_LIMIT_EXCEEDED: WIN32_ERROR = 587u32; -pub const ERROR_MUTUAL_AUTH_FAILED: WIN32_ERROR = 1397u32; -pub const ERROR_NEGATIVE_SEEK: WIN32_ERROR = 131u32; -pub const ERROR_NESTING_NOT_ALLOWED: WIN32_ERROR = 215u32; -pub const ERROR_NETLOGON_NOT_STARTED: WIN32_ERROR = 1792u32; -pub const ERROR_NETNAME_DELETED: WIN32_ERROR = 64u32; -pub const ERROR_NETWORK_ACCESS_DENIED: WIN32_ERROR = 65u32; -pub const ERROR_NETWORK_ACCESS_DENIED_EDP: WIN32_ERROR = 354u32; -pub const ERROR_NETWORK_BUSY: WIN32_ERROR = 54u32; -pub const ERROR_NETWORK_UNREACHABLE: WIN32_ERROR = 1231u32; -pub const ERROR_NET_OPEN_FAILED: WIN32_ERROR = 570u32; -pub const ERROR_NET_WRITE_FAULT: WIN32_ERROR = 88u32; -pub const ERROR_NOACCESS: WIN32_ERROR = 998u32; -pub const ERROR_NOINTERFACE: WIN32_ERROR = 632u32; -pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: WIN32_ERROR = 1807u32; -pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: WIN32_ERROR = 1809u32; -pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: WIN32_ERROR = 1808u32; -pub const ERROR_NONE_MAPPED: WIN32_ERROR = 1332u32; -pub const ERROR_NONPAGED_SYSTEM_RESOURCES: WIN32_ERROR = 1451u32; -pub const ERROR_NON_ACCOUNT_SID: WIN32_ERROR = 1257u32; -pub const ERROR_NON_DOMAIN_SID: WIN32_ERROR = 1258u32; -pub const ERROR_NON_MDICHILD_WINDOW: WIN32_ERROR = 1445u32; -pub const ERROR_NOTHING_TO_TERMINATE: WIN32_ERROR = 758u32; -pub const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED: WIN32_ERROR = 309u32; -pub const ERROR_NOTIFY_CLEANUP: WIN32_ERROR = 745u32; -pub const ERROR_NOTIFY_ENUM_DIR: WIN32_ERROR = 1022u32; -pub const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE: WIN32_ERROR = 313u32; -pub const ERROR_NOT_ALL_ASSIGNED: WIN32_ERROR = 1300u32; -pub const ERROR_NOT_APPCONTAINER: WIN32_ERROR = 4250u32; -pub const ERROR_NOT_AUTHENTICATED: WIN32_ERROR = 1244u32; -pub const ERROR_NOT_A_CLOUD_FILE: WIN32_ERROR = 376u32; -pub const ERROR_NOT_A_CLOUD_SYNC_ROOT: WIN32_ERROR = 405u32; -pub const ERROR_NOT_A_DAX_VOLUME: WIN32_ERROR = 420u32; -pub const ERROR_NOT_A_REPARSE_POINT: WIN32_ERROR = 4390u32; -pub const ERROR_NOT_CAPABLE: WIN32_ERROR = 775u32; -pub const ERROR_NOT_CHILD_WINDOW: WIN32_ERROR = 1442u32; -pub const ERROR_NOT_CONNECTED: WIN32_ERROR = 2250u32; -pub const ERROR_NOT_CONTAINER: WIN32_ERROR = 1207u32; -pub const ERROR_NOT_DAX_MAPPABLE: WIN32_ERROR = 421u32; -pub const ERROR_NOT_DOS_DISK: WIN32_ERROR = 26u32; -pub const ERROR_NOT_ENOUGH_MEMORY: WIN32_ERROR = 8u32; -pub const ERROR_NOT_ENOUGH_QUOTA: WIN32_ERROR = 1816u32; -pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: WIN32_ERROR = 1130u32; -pub const ERROR_NOT_EXPORT_FORMAT: WIN32_ERROR = 6008u32; -pub const ERROR_NOT_FOUND: WIN32_ERROR = 1168u32; -pub const ERROR_NOT_GUI_PROCESS: WIN32_ERROR = 1471u32; -pub const ERROR_NOT_JOINED: WIN32_ERROR = 136u32; -pub const ERROR_NOT_LOCKED: WIN32_ERROR = 158u32; -pub const ERROR_NOT_LOGGED_ON: WIN32_ERROR = 1245u32; -pub const ERROR_NOT_LOGON_PROCESS: WIN32_ERROR = 1362u32; -pub const ERROR_NOT_OWNER: WIN32_ERROR = 288u32; -pub const ERROR_NOT_READY: WIN32_ERROR = 21u32; -pub const ERROR_NOT_READ_FROM_COPY: WIN32_ERROR = 337u32; -pub const ERROR_NOT_REDUNDANT_STORAGE: WIN32_ERROR = 333u32; -pub const ERROR_NOT_REGISTRY_FILE: WIN32_ERROR = 1017u32; -pub const ERROR_NOT_SAFEBOOT_SERVICE: WIN32_ERROR = 1084u32; -pub const ERROR_NOT_SAFE_MODE_DRIVER: WIN32_ERROR = 646u32; -pub const ERROR_NOT_SAME_DEVICE: WIN32_ERROR = 17u32; -pub const ERROR_NOT_SAME_OBJECT: WIN32_ERROR = 1656u32; -pub const ERROR_NOT_SUBSTED: WIN32_ERROR = 137u32; -pub const ERROR_NOT_SUPPORTED: WIN32_ERROR = 50u32; -pub const ERROR_NOT_SUPPORTED_IN_APPCONTAINER: WIN32_ERROR = 4252u32; -pub const ERROR_NOT_SUPPORTED_ON_DAX: WIN32_ERROR = 360u32; -pub const ERROR_NOT_SUPPORTED_ON_SBS: WIN32_ERROR = 1254u32; -pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: WIN32_ERROR = 8584u32; -pub const ERROR_NOT_SUPPORTED_WITH_AUDITING: WIN32_ERROR = 499u32; -pub const ERROR_NOT_SUPPORTED_WITH_BTT: WIN32_ERROR = 429u32; -pub const ERROR_NOT_SUPPORTED_WITH_BYPASSIO: WIN32_ERROR = 493u32; -pub const ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE: WIN32_ERROR = 509u32; -pub const ERROR_NOT_SUPPORTED_WITH_COMPRESSION: WIN32_ERROR = 496u32; -pub const ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION: WIN32_ERROR = 498u32; -pub const ERROR_NOT_SUPPORTED_WITH_ENCRYPTION: WIN32_ERROR = 495u32; -pub const ERROR_NOT_SUPPORTED_WITH_MONITORING: WIN32_ERROR = 503u32; -pub const ERROR_NOT_SUPPORTED_WITH_REPLICATION: WIN32_ERROR = 497u32; -pub const ERROR_NOT_SUPPORTED_WITH_SNAPSHOT: WIN32_ERROR = 504u32; -pub const ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION: WIN32_ERROR = 505u32; -pub const ERROR_NOT_TINY_STREAM: WIN32_ERROR = 598u32; -pub const ERROR_NO_ACE_CONDITION: WIN32_ERROR = 804u32; -pub const ERROR_NO_ASSOCIATION: WIN32_ERROR = 1155u32; -pub const ERROR_NO_BYPASSIO_DRIVER_SUPPORT: WIN32_ERROR = 494u32; -pub const ERROR_NO_CALLBACK_ACTIVE: WIN32_ERROR = 614u32; -pub const ERROR_NO_DATA: WIN32_ERROR = 232u32; -pub const ERROR_NO_DATA_DETECTED: WIN32_ERROR = 1104u32; -pub const ERROR_NO_EFS: WIN32_ERROR = 6004u32; -pub const ERROR_NO_EVENT_PAIR: WIN32_ERROR = 580u32; -pub const ERROR_NO_GUID_TRANSLATION: WIN32_ERROR = 560u32; -pub const ERROR_NO_IMPERSONATION_TOKEN: WIN32_ERROR = 1309u32; -pub const ERROR_NO_INHERITANCE: WIN32_ERROR = 1391u32; -pub const ERROR_NO_LOGON_SERVERS: WIN32_ERROR = 1311u32; -pub const ERROR_NO_LOG_SPACE: WIN32_ERROR = 1019u32; -pub const ERROR_NO_MATCH: WIN32_ERROR = 1169u32; -pub const ERROR_NO_MEDIA_IN_DRIVE: WIN32_ERROR = 1112u32; -pub const ERROR_NO_MORE_DEVICES: WIN32_ERROR = 1248u32; -pub const ERROR_NO_MORE_FILES: WIN32_ERROR = 18u32; -pub const ERROR_NO_MORE_ITEMS: WIN32_ERROR = 259u32; -pub const ERROR_NO_MORE_MATCHES: WIN32_ERROR = 626u32; -pub const ERROR_NO_MORE_SEARCH_HANDLES: WIN32_ERROR = 113u32; -pub const ERROR_NO_MORE_USER_HANDLES: WIN32_ERROR = 1158u32; -pub const ERROR_NO_NETWORK: WIN32_ERROR = 1222u32; -pub const ERROR_NO_NET_OR_BAD_PATH: WIN32_ERROR = 1203u32; -pub const ERROR_NO_NVRAM_RESOURCES: WIN32_ERROR = 1470u32; -pub const ERROR_NO_PAGEFILE: WIN32_ERROR = 578u32; -pub const ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND: WIN32_ERROR = 408u32; -pub const ERROR_NO_PROC_SLOTS: WIN32_ERROR = 89u32; -pub const ERROR_NO_PROMOTION_ACTIVE: WIN32_ERROR = 8222u32; -pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: WIN32_ERROR = 1302u32; -pub const ERROR_NO_RANGES_PROCESSED: WIN32_ERROR = 312u32; -pub const ERROR_NO_RECOVERY_POLICY: WIN32_ERROR = 6003u32; -pub const ERROR_NO_RECOVERY_PROGRAM: WIN32_ERROR = 1082u32; -pub const ERROR_NO_SCROLLBARS: WIN32_ERROR = 1447u32; -pub const ERROR_NO_SECRETS: WIN32_ERROR = 8620u32; -pub const ERROR_NO_SECURITY_ON_OBJECT: WIN32_ERROR = 1350u32; -pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1116u32; -pub const ERROR_NO_SIGNAL_SENT: WIN32_ERROR = 205u32; -pub const ERROR_NO_SITENAME: WIN32_ERROR = 1919u32; -pub const ERROR_NO_SITE_SETTINGS_OBJECT: WIN32_ERROR = 8619u32; -pub const ERROR_NO_SPOOL_SPACE: WIN32_ERROR = 62u32; -pub const ERROR_NO_SUCH_ALIAS: WIN32_ERROR = 1376u32; -pub const ERROR_NO_SUCH_DEVICE: WIN32_ERROR = 433u32; -pub const ERROR_NO_SUCH_DOMAIN: WIN32_ERROR = 1355u32; -pub const ERROR_NO_SUCH_GROUP: WIN32_ERROR = 1319u32; -pub const ERROR_NO_SUCH_LOGON_SESSION: WIN32_ERROR = 1312u32; -pub const ERROR_NO_SUCH_MEMBER: WIN32_ERROR = 1387u32; -pub const ERROR_NO_SUCH_PACKAGE: WIN32_ERROR = 1364u32; -pub const ERROR_NO_SUCH_PRIVILEGE: WIN32_ERROR = 1313u32; -pub const ERROR_NO_SUCH_SITE: WIN32_ERROR = 1249u32; -pub const ERROR_NO_SUCH_USER: WIN32_ERROR = 1317u32; -pub const ERROR_NO_SYSTEM_MENU: WIN32_ERROR = 1437u32; -pub const ERROR_NO_SYSTEM_RESOURCES: WIN32_ERROR = 1450u32; -pub const ERROR_NO_TASK_QUEUE: WIN32_ERROR = 427u32; -pub const ERROR_NO_TOKEN: WIN32_ERROR = 1008u32; -pub const ERROR_NO_TRACKING_SERVICE: WIN32_ERROR = 1172u32; -pub const ERROR_NO_TRUST_LSA_SECRET: WIN32_ERROR = 1786u32; -pub const ERROR_NO_TRUST_SAM_ACCOUNT: WIN32_ERROR = 1787u32; -pub const ERROR_NO_UNICODE_TRANSLATION: WIN32_ERROR = 1113u32; -pub const ERROR_NO_USER_KEYS: WIN32_ERROR = 6006u32; -pub const ERROR_NO_USER_SESSION_KEY: WIN32_ERROR = 1394u32; -pub const ERROR_NO_VOLUME_ID: WIN32_ERROR = 1173u32; -pub const ERROR_NO_VOLUME_LABEL: WIN32_ERROR = 125u32; -pub const ERROR_NO_WILDCARD_CHARACTERS: WIN32_ERROR = 1417u32; -pub const ERROR_NO_WORK_DONE: WIN32_ERROR = 235u32; -pub const ERROR_NO_WRITABLE_DC_FOUND: WIN32_ERROR = 8621u32; -pub const ERROR_NO_YIELD_PERFORMED: WIN32_ERROR = 721u32; -pub const ERROR_NTLM_BLOCKED: WIN32_ERROR = 1937u32; -pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: WIN32_ERROR = 1386u32; -pub const ERROR_NULL_LM_PASSWORD: WIN32_ERROR = 1304u32; -pub const ERROR_OBJECT_IS_IMMUTABLE: WIN32_ERROR = 4449u32; -pub const ERROR_OBJECT_NAME_EXISTS: WIN32_ERROR = 698u32; -pub const ERROR_OBJECT_NOT_EXTERNALLY_BACKED: WIN32_ERROR = 342u32; -pub const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED: WIN32_ERROR = 4442u32; -pub const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED: WIN32_ERROR = 4440u32; -pub const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: WIN32_ERROR = 4443u32; -pub const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: WIN32_ERROR = 4441u32; -pub const ERROR_OFFSET_ALIGNMENT_VIOLATION: WIN32_ERROR = 327u32; -pub const ERROR_OLD_WIN_VERSION: WIN32_ERROR = 1150u32; -pub const ERROR_ONLY_IF_CONNECTED: WIN32_ERROR = 1251u32; -pub const ERROR_OPEN_FAILED: WIN32_ERROR = 110u32; -pub const ERROR_OPEN_FILES: WIN32_ERROR = 2401u32; -pub const ERROR_OPERATION_ABORTED: WIN32_ERROR = 995u32; -pub const ERROR_OPERATION_IN_PROGRESS: WIN32_ERROR = 329u32; -pub const ERROR_OPLOCK_BREAK_IN_PROGRESS: WIN32_ERROR = 742u32; -pub const ERROR_OPLOCK_HANDLE_CLOSED: WIN32_ERROR = 803u32; -pub const ERROR_OPLOCK_NOT_GRANTED: WIN32_ERROR = 300u32; -pub const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE: WIN32_ERROR = 800u32; -pub const ERROR_ORPHAN_NAME_EXHAUSTED: WIN32_ERROR = 799u32; -pub const ERROR_OUTOFMEMORY: WIN32_ERROR = 14u32; -pub const ERROR_OUT_OF_PAPER: WIN32_ERROR = 28u32; -pub const ERROR_OUT_OF_STRUCTURES: WIN32_ERROR = 84u32; -pub const ERROR_OVERRIDE_NOCHANGES: WIN32_ERROR = 1252u32; -pub const ERROR_PAGED_SYSTEM_RESOURCES: WIN32_ERROR = 1452u32; -pub const ERROR_PAGEFILE_CREATE_FAILED: WIN32_ERROR = 576u32; -pub const ERROR_PAGEFILE_NOT_SUPPORTED: WIN32_ERROR = 491u32; -pub const ERROR_PAGEFILE_QUOTA: WIN32_ERROR = 1454u32; -pub const ERROR_PAGEFILE_QUOTA_EXCEEDED: WIN32_ERROR = 567u32; -pub const ERROR_PAGE_FAULT_COPY_ON_WRITE: WIN32_ERROR = 749u32; -pub const ERROR_PAGE_FAULT_DEMAND_ZERO: WIN32_ERROR = 748u32; -pub const ERROR_PAGE_FAULT_GUARD_PAGE: WIN32_ERROR = 750u32; -pub const ERROR_PAGE_FAULT_PAGING_FILE: WIN32_ERROR = 751u32; -pub const ERROR_PAGE_FAULT_TRANSITION: WIN32_ERROR = 747u32; -pub const ERROR_PARAMETER_QUOTA_EXCEEDED: WIN32_ERROR = 1283u32; -pub const ERROR_PARTIAL_COPY: WIN32_ERROR = 299u32; -pub const ERROR_PARTITION_FAILURE: WIN32_ERROR = 1105u32; -pub const ERROR_PARTITION_TERMINATING: WIN32_ERROR = 1184u32; -pub const ERROR_PASSWORD_CHANGE_REQUIRED: WIN32_ERROR = 1938u32; -pub const ERROR_PASSWORD_EXPIRED: WIN32_ERROR = 1330u32; -pub const ERROR_PASSWORD_MUST_CHANGE: WIN32_ERROR = 1907u32; -pub const ERROR_PASSWORD_RESTRICTION: WIN32_ERROR = 1325u32; -pub const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: WIN32_ERROR = 1651u32; -pub const ERROR_PATCH_NO_SEQUENCE: WIN32_ERROR = 1648u32; -pub const ERROR_PATCH_PACKAGE_INVALID: WIN32_ERROR = 1636u32; -pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: WIN32_ERROR = 1635u32; -pub const ERROR_PATCH_PACKAGE_REJECTED: WIN32_ERROR = 1643u32; -pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: WIN32_ERROR = 1637u32; -pub const ERROR_PATCH_REMOVAL_DISALLOWED: WIN32_ERROR = 1649u32; -pub const ERROR_PATCH_REMOVAL_UNSUPPORTED: WIN32_ERROR = 1646u32; -pub const ERROR_PATCH_TARGET_NOT_FOUND: WIN32_ERROR = 1642u32; -pub const ERROR_PATH_BUSY: WIN32_ERROR = 148u32; -pub const ERROR_PATH_NOT_FOUND: WIN32_ERROR = 3u32; -pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1932u32; -pub const ERROR_PIPE_BUSY: WIN32_ERROR = 231u32; -pub const ERROR_PIPE_CONNECTED: WIN32_ERROR = 535u32; -pub const ERROR_PIPE_LISTENING: WIN32_ERROR = 536u32; -pub const ERROR_PIPE_LOCAL: WIN32_ERROR = 229u32; -pub const ERROR_PIPE_NOT_CONNECTED: WIN32_ERROR = 233u32; -pub const ERROR_PKINIT_FAILURE: WIN32_ERROR = 1263u32; -pub const ERROR_PLUGPLAY_QUERY_VETOED: WIN32_ERROR = 683u32; -pub const ERROR_PNP_BAD_MPS_TABLE: WIN32_ERROR = 671u32; -pub const ERROR_PNP_INVALID_ID: WIN32_ERROR = 674u32; -pub const ERROR_PNP_IRQ_TRANSLATION_FAILED: WIN32_ERROR = 673u32; -pub const ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT: WIN32_ERROR = 480u32; -pub const ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT: WIN32_ERROR = 481u32; -pub const ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT: WIN32_ERROR = 482u32; -pub const ERROR_PNP_REBOOT_REQUIRED: WIN32_ERROR = 638u32; -pub const ERROR_PNP_RESTART_ENUMERATION: WIN32_ERROR = 636u32; -pub const ERROR_PNP_TRANSLATION_FAILED: WIN32_ERROR = 672u32; -pub const ERROR_POINT_NOT_FOUND: WIN32_ERROR = 1171u32; -pub const ERROR_POLICY_OBJECT_NOT_FOUND: WIN32_ERROR = 8219u32; -pub const ERROR_POLICY_ONLY_IN_DS: WIN32_ERROR = 8220u32; -pub const ERROR_POPUP_ALREADY_ACTIVE: WIN32_ERROR = 1446u32; -pub const ERROR_PORT_MESSAGE_TOO_LONG: WIN32_ERROR = 546u32; -pub const ERROR_PORT_NOT_SET: WIN32_ERROR = 642u32; -pub const ERROR_PORT_UNREACHABLE: WIN32_ERROR = 1234u32; -pub const ERROR_POSSIBLE_DEADLOCK: WIN32_ERROR = 1131u32; -pub const ERROR_POTENTIAL_FILE_FOUND: WIN32_ERROR = 1180u32; -pub const ERROR_PREDEFINED_HANDLE: WIN32_ERROR = 714u32; -pub const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: WIN32_ERROR = 746u32; -pub const ERROR_PRINTER_ALREADY_EXISTS: WIN32_ERROR = 1802u32; -pub const ERROR_PRINTER_DELETED: WIN32_ERROR = 1905u32; -pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: WIN32_ERROR = 1795u32; -pub const ERROR_PRINTQ_FULL: WIN32_ERROR = 61u32; -pub const ERROR_PRINT_CANCELLED: WIN32_ERROR = 63u32; -pub const ERROR_PRIVATE_DIALOG_INDEX: WIN32_ERROR = 1415u32; -pub const ERROR_PRIVILEGE_NOT_HELD: WIN32_ERROR = 1314u32; -pub const ERROR_PROCESS_ABORTED: WIN32_ERROR = 1067u32; -pub const ERROR_PROCESS_IN_JOB: WIN32_ERROR = 760u32; -pub const ERROR_PROCESS_IS_PROTECTED: WIN32_ERROR = 1293u32; -pub const ERROR_PROCESS_MODE_ALREADY_BACKGROUND: WIN32_ERROR = 402u32; -pub const ERROR_PROCESS_MODE_NOT_BACKGROUND: WIN32_ERROR = 403u32; -pub const ERROR_PROCESS_NOT_IN_JOB: WIN32_ERROR = 759u32; -pub const ERROR_PROC_NOT_FOUND: WIN32_ERROR = 127u32; -pub const ERROR_PRODUCT_UNINSTALLED: WIN32_ERROR = 1614u32; -pub const ERROR_PRODUCT_VERSION: WIN32_ERROR = 1638u32; -pub const ERROR_PROFILING_AT_LIMIT: WIN32_ERROR = 553u32; -pub const ERROR_PROFILING_NOT_STARTED: WIN32_ERROR = 550u32; -pub const ERROR_PROFILING_NOT_STOPPED: WIN32_ERROR = 551u32; -pub const ERROR_PROMOTION_ACTIVE: WIN32_ERROR = 8221u32; -pub const ERROR_PROTOCOL_UNREACHABLE: WIN32_ERROR = 1233u32; -pub const ERROR_PWD_HISTORY_CONFLICT: WIN32_ERROR = 617u32; -pub const ERROR_PWD_TOO_LONG: WIN32_ERROR = 657u32; -pub const ERROR_PWD_TOO_RECENT: WIN32_ERROR = 616u32; -pub const ERROR_PWD_TOO_SHORT: WIN32_ERROR = 615u32; -pub const ERROR_QUOTA_ACTIVITY: WIN32_ERROR = 810u32; -pub const ERROR_QUOTA_LIST_INCONSISTENT: WIN32_ERROR = 621u32; -pub const ERROR_RANGE_LIST_CONFLICT: WIN32_ERROR = 627u32; -pub const ERROR_RANGE_NOT_FOUND: WIN32_ERROR = 644u32; -pub const ERROR_READ_FAULT: WIN32_ERROR = 30u32; -pub const ERROR_RECEIVE_EXPEDITED: WIN32_ERROR = 708u32; -pub const ERROR_RECEIVE_PARTIAL: WIN32_ERROR = 707u32; -pub const ERROR_RECEIVE_PARTIAL_EXPEDITED: WIN32_ERROR = 709u32; -pub const ERROR_RECOVERY_FAILURE: WIN32_ERROR = 1279u32; -pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: WIN32_ERROR = 1794u32; -pub const ERROR_REDIR_PAUSED: WIN32_ERROR = 72u32; -pub const ERROR_REGISTRY_CORRUPT: WIN32_ERROR = 1015u32; -pub const ERROR_REGISTRY_HIVE_RECOVERED: WIN32_ERROR = 685u32; -pub const ERROR_REGISTRY_IO_FAILED: WIN32_ERROR = 1016u32; -pub const ERROR_REGISTRY_QUOTA_LIMIT: WIN32_ERROR = 613u32; -pub const ERROR_REGISTRY_RECOVERED: WIN32_ERROR = 1014u32; -pub const ERROR_REG_NAT_CONSUMPTION: WIN32_ERROR = 1261u32; -pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: WIN32_ERROR = 201u32; -pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: WIN32_ERROR = 1936u32; -pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: WIN32_ERROR = 1220u32; -pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: WIN32_ERROR = 4352u32; -pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: WIN32_ERROR = 4351u32; -pub const ERROR_REM_NOT_LIST: WIN32_ERROR = 51u32; -pub const ERROR_REPARSE: WIN32_ERROR = 741u32; -pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: WIN32_ERROR = 4391u32; -pub const ERROR_REPARSE_OBJECT: WIN32_ERROR = 755u32; -pub const ERROR_REPARSE_POINT_ENCOUNTERED: WIN32_ERROR = 4395u32; -pub const ERROR_REPARSE_TAG_INVALID: WIN32_ERROR = 4393u32; -pub const ERROR_REPARSE_TAG_MISMATCH: WIN32_ERROR = 4394u32; -pub const ERROR_REPLY_MESSAGE_MISMATCH: WIN32_ERROR = 595u32; -pub const ERROR_REQUEST_ABORTED: WIN32_ERROR = 1235u32; -pub const ERROR_REQUEST_OUT_OF_SEQUENCE: WIN32_ERROR = 776u32; -pub const ERROR_REQUEST_PAUSED: WIN32_ERROR = 3050u32; -pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: WIN32_ERROR = 1459u32; -pub const ERROR_REQ_NOT_ACCEP: WIN32_ERROR = 71u32; -pub const ERROR_RESIDENT_FILE_NOT_SUPPORTED: WIN32_ERROR = 334u32; -pub const ERROR_RESOURCE_CALL_TIMED_OUT: WIN32_ERROR = 5910u32; -pub const ERROR_RESOURCE_DATA_NOT_FOUND: WIN32_ERROR = 1812u32; -pub const ERROR_RESOURCE_LANG_NOT_FOUND: WIN32_ERROR = 1815u32; -pub const ERROR_RESOURCE_NAME_NOT_FOUND: WIN32_ERROR = 1814u32; -pub const ERROR_RESOURCE_REQUIREMENTS_CHANGED: WIN32_ERROR = 756u32; -pub const ERROR_RESOURCE_TYPE_NOT_FOUND: WIN32_ERROR = 1813u32; -pub const ERROR_RESTART_APPLICATION: WIN32_ERROR = 1467u32; -pub const ERROR_RESUME_HIBERNATION: WIN32_ERROR = 727u32; -pub const ERROR_RETRY: WIN32_ERROR = 1237u32; -pub const ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT: WIN32_ERROR = 1662u32; -pub const ERROR_REVISION_MISMATCH: WIN32_ERROR = 1306u32; -pub const ERROR_RING2SEG_MUST_BE_MOVABLE: WIN32_ERROR = 200u32; -pub const ERROR_RING2_STACK_IN_USE: WIN32_ERROR = 207u32; -pub const ERROR_RMODE_APP: WIN32_ERROR = 1153u32; -pub const ERROR_ROWSNOTRELEASED: WIN32_ERROR = 772u32; -pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: WIN32_ERROR = 15403u32; -pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: WIN32_ERROR = 15402u32; -pub const ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED: WIN32_ERROR = 410u32; -pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET: WIN32_ERROR = 411u32; -pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE: WIN32_ERROR = 412u32; -pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER: WIN32_ERROR = 413u32; -pub const ERROR_RXACT_COMMITTED: WIN32_ERROR = 744u32; -pub const ERROR_RXACT_COMMIT_FAILURE: WIN32_ERROR = 1370u32; -pub const ERROR_RXACT_COMMIT_NECESSARY: WIN32_ERROR = 678u32; -pub const ERROR_RXACT_INVALID_STATE: WIN32_ERROR = 1369u32; -pub const ERROR_RXACT_STATE_CREATED: WIN32_ERROR = 701u32; -pub const ERROR_SAME_DRIVE: WIN32_ERROR = 143u32; -pub const ERROR_SAM_INIT_FAILURE: WIN32_ERROR = 8541u32; -pub const ERROR_SCOPE_NOT_FOUND: WIN32_ERROR = 318u32; -pub const ERROR_SCREEN_ALREADY_LOCKED: WIN32_ERROR = 1440u32; -pub const ERROR_SCRUB_DATA_DISABLED: WIN32_ERROR = 332u32; -pub const ERROR_SECRET_TOO_LONG: WIN32_ERROR = 1382u32; -pub const ERROR_SECTION_DIRECT_MAP_ONLY: WIN32_ERROR = 819u32; -pub const ERROR_SECTOR_NOT_FOUND: WIN32_ERROR = 27u32; -pub const ERROR_SECURITY_DENIES_OPERATION: WIN32_ERROR = 447u32; -pub const ERROR_SECURITY_STREAM_IS_INCONSISTENT: WIN32_ERROR = 306u32; -pub const ERROR_SEEK: WIN32_ERROR = 25u32; -pub const ERROR_SEEK_ON_DEVICE: WIN32_ERROR = 132u32; -pub const ERROR_SEGMENT_NOTIFICATION: WIN32_ERROR = 702u32; -pub const ERROR_SEM_IS_SET: WIN32_ERROR = 102u32; -pub const ERROR_SEM_NOT_FOUND: WIN32_ERROR = 187u32; -pub const ERROR_SEM_OWNER_DIED: WIN32_ERROR = 105u32; -pub const ERROR_SEM_TIMEOUT: WIN32_ERROR = 121u32; -pub const ERROR_SEM_USER_LIMIT: WIN32_ERROR = 106u32; -pub const ERROR_SERIAL_NO_DEVICE: WIN32_ERROR = 1118u32; -pub const ERROR_SERVER_DISABLED: WIN32_ERROR = 1341u32; -pub const ERROR_SERVER_HAS_OPEN_HANDLES: WIN32_ERROR = 1811u32; -pub const ERROR_SERVER_NOT_DISABLED: WIN32_ERROR = 1342u32; -pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1255u32; -pub const ERROR_SERVER_SID_MISMATCH: WIN32_ERROR = 628u32; -pub const ERROR_SERVER_TRANSPORT_CONFLICT: WIN32_ERROR = 816u32; -pub const ERROR_SERVICE_ALREADY_RUNNING: WIN32_ERROR = 1056u32; -pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: WIN32_ERROR = 1061u32; -pub const ERROR_SERVICE_DATABASE_LOCKED: WIN32_ERROR = 1055u32; -pub const ERROR_SERVICE_DEPENDENCY_DELETED: WIN32_ERROR = 1075u32; -pub const ERROR_SERVICE_DEPENDENCY_FAIL: WIN32_ERROR = 1068u32; -pub const ERROR_SERVICE_DISABLED: WIN32_ERROR = 1058u32; -pub const ERROR_SERVICE_DOES_NOT_EXIST: WIN32_ERROR = 1060u32; -pub const ERROR_SERVICE_EXISTS: WIN32_ERROR = 1073u32; -pub const ERROR_SERVICE_LOGON_FAILED: WIN32_ERROR = 1069u32; -pub const ERROR_SERVICE_MARKED_FOR_DELETE: WIN32_ERROR = 1072u32; -pub const ERROR_SERVICE_NEVER_STARTED: WIN32_ERROR = 1077u32; -pub const ERROR_SERVICE_NOTIFICATION: WIN32_ERROR = 716u32; -pub const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING: WIN32_ERROR = 1294u32; -pub const ERROR_SERVICE_NOT_ACTIVE: WIN32_ERROR = 1062u32; -pub const ERROR_SERVICE_NOT_FOUND: WIN32_ERROR = 1243u32; -pub const ERROR_SERVICE_NOT_IN_EXE: WIN32_ERROR = 1083u32; -pub const ERROR_SERVICE_NO_THREAD: WIN32_ERROR = 1054u32; -pub const ERROR_SERVICE_REQUEST_TIMEOUT: WIN32_ERROR = 1053u32; -pub const ERROR_SERVICE_SPECIFIC_ERROR: WIN32_ERROR = 1066u32; -pub const ERROR_SERVICE_START_HANG: WIN32_ERROR = 1070u32; -pub const ERROR_SESSION_CREDENTIAL_CONFLICT: WIN32_ERROR = 1219u32; -pub const ERROR_SESSION_KEY_TOO_SHORT: WIN32_ERROR = 501u32; -pub const ERROR_SETCOUNT_ON_BAD_LB: WIN32_ERROR = 1433u32; -pub const ERROR_SETMARK_DETECTED: WIN32_ERROR = 1103u32; -pub const ERROR_SET_CONTEXT_DENIED: WIN32_ERROR = 1660u32; -pub const ERROR_SET_NOT_FOUND: WIN32_ERROR = 1170u32; -pub const ERROR_SET_POWER_STATE_FAILED: WIN32_ERROR = 1141u32; -pub const ERROR_SET_POWER_STATE_VETOED: WIN32_ERROR = 1140u32; -pub const ERROR_SHARED_POLICY: WIN32_ERROR = 8218u32; -pub const ERROR_SHARING_BUFFER_EXCEEDED: WIN32_ERROR = 36u32; -pub const ERROR_SHARING_PAUSED: WIN32_ERROR = 70u32; -pub const ERROR_SHARING_VIOLATION: WIN32_ERROR = 32u32; -pub const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: WIN32_ERROR = 305u32; -pub const ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE: WIN32_ERROR = 1192u32; -pub const ERROR_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1115u32; -pub const ERROR_SHUTDOWN_IS_SCHEDULED: WIN32_ERROR = 1190u32; -pub const ERROR_SHUTDOWN_USERS_LOGGED_ON: WIN32_ERROR = 1191u32; -pub const ERROR_SIGNAL_PENDING: WIN32_ERROR = 162u32; -pub const ERROR_SIGNAL_REFUSED: WIN32_ERROR = 156u32; -pub const ERROR_SINGLE_INSTANCE_APP: WIN32_ERROR = 1152u32; -pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: WIN32_ERROR = 1264u32; -pub const ERROR_SMB1_NOT_AVAILABLE: WIN32_ERROR = 384u32; -pub const ERROR_SMB_GUEST_LOGON_BLOCKED: WIN32_ERROR = 1272u32; -pub const ERROR_SMR_GARBAGE_COLLECTION_REQUIRED: WIN32_ERROR = 4445u32; -pub const ERROR_SOME_NOT_MAPPED: WIN32_ERROR = 1301u32; -pub const ERROR_SOURCE_ELEMENT_EMPTY: WIN32_ERROR = 1160u32; -pub const ERROR_SPARSE_FILE_NOT_SUPPORTED: WIN32_ERROR = 490u32; -pub const ERROR_SPECIAL_ACCOUNT: WIN32_ERROR = 1371u32; -pub const ERROR_SPECIAL_GROUP: WIN32_ERROR = 1372u32; -pub const ERROR_SPECIAL_USER: WIN32_ERROR = 1373u32; -pub const ERROR_SRC_SRV_DLL_LOAD_FAILED: WIN32_ERROR = 428u32; -pub const ERROR_STACK_BUFFER_OVERRUN: WIN32_ERROR = 1282u32; -pub const ERROR_STACK_OVERFLOW: WIN32_ERROR = 1001u32; -pub const ERROR_STACK_OVERFLOW_READ: WIN32_ERROR = 599u32; -pub const ERROR_STOPPED_ON_SYMLINK: WIN32_ERROR = 681u32; -pub const ERROR_STORAGE_LOST_DATA_PERSISTENCE: WIN32_ERROR = 368u32; -pub const ERROR_STORAGE_RESERVE_ALREADY_EXISTS: WIN32_ERROR = 418u32; -pub const ERROR_STORAGE_RESERVE_DOES_NOT_EXIST: WIN32_ERROR = 417u32; -pub const ERROR_STORAGE_RESERVE_ID_INVALID: WIN32_ERROR = 416u32; -pub const ERROR_STORAGE_RESERVE_NOT_EMPTY: WIN32_ERROR = 419u32; -pub const ERROR_STORAGE_STACK_ACCESS_DENIED: WIN32_ERROR = 472u32; -pub const ERROR_STORAGE_TOPOLOGY_ID_MISMATCH: WIN32_ERROR = 345u32; -pub const ERROR_STRICT_CFG_VIOLATION: WIN32_ERROR = 1657u32; -pub const ERROR_SUBST_TO_JOIN: WIN32_ERROR = 141u32; -pub const ERROR_SUBST_TO_SUBST: WIN32_ERROR = 139u32; -pub const ERROR_SUCCESS: WIN32_ERROR = 0u32; -pub const ERROR_SUCCESS_REBOOT_INITIATED: WIN32_ERROR = 1641u32; -pub const ERROR_SWAPERROR: WIN32_ERROR = 999u32; -pub const ERROR_SYMLINK_CLASS_DISABLED: WIN32_ERROR = 1463u32; -pub const ERROR_SYMLINK_NOT_SUPPORTED: WIN32_ERROR = 1464u32; -pub const ERROR_SYNCHRONIZATION_REQUIRED: WIN32_ERROR = 569u32; -pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: WIN32_ERROR = 1274u32; -pub const ERROR_SYSTEM_HIVE_TOO_LARGE: WIN32_ERROR = 653u32; -pub const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: WIN32_ERROR = 637u32; -pub const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: WIN32_ERROR = 783u32; -pub const ERROR_SYSTEM_POWERSTATE_TRANSITION: WIN32_ERROR = 782u32; -pub const ERROR_SYSTEM_PROCESS_TERMINATED: WIN32_ERROR = 591u32; -pub const ERROR_SYSTEM_SHUTDOWN: WIN32_ERROR = 641u32; -pub const ERROR_SYSTEM_TRACE: WIN32_ERROR = 150u32; -pub const ERROR_THREAD_1_INACTIVE: WIN32_ERROR = 210u32; -pub const ERROR_THREAD_ALREADY_IN_TASK: WIN32_ERROR = 1552u32; -pub const ERROR_THREAD_MODE_ALREADY_BACKGROUND: WIN32_ERROR = 400u32; -pub const ERROR_THREAD_MODE_NOT_BACKGROUND: WIN32_ERROR = 401u32; -pub const ERROR_THREAD_NOT_IN_PROCESS: WIN32_ERROR = 566u32; -pub const ERROR_THREAD_WAS_SUSPENDED: WIN32_ERROR = 699u32; -pub const ERROR_TIMEOUT: WIN32_ERROR = 1460u32; -pub const ERROR_TIMER_NOT_CANCELED: WIN32_ERROR = 541u32; -pub const ERROR_TIMER_RESOLUTION_NOT_SET: WIN32_ERROR = 607u32; -pub const ERROR_TIMER_RESUME_IGNORED: WIN32_ERROR = 722u32; -pub const ERROR_TIME_SENSITIVE_THREAD: WIN32_ERROR = 422u32; -pub const ERROR_TIME_SKEW: WIN32_ERROR = 1398u32; -pub const ERROR_TLW_WITH_WSCHILD: WIN32_ERROR = 1406u32; -pub const ERROR_TOKEN_ALREADY_IN_USE: WIN32_ERROR = 1375u32; -pub const ERROR_TOO_MANY_CMDS: WIN32_ERROR = 56u32; -pub const ERROR_TOO_MANY_CONTEXT_IDS: WIN32_ERROR = 1384u32; -pub const ERROR_TOO_MANY_DESCRIPTORS: WIN32_ERROR = 331u32; -pub const ERROR_TOO_MANY_LINKS: WIN32_ERROR = 1142u32; -pub const ERROR_TOO_MANY_LUIDS_REQUESTED: WIN32_ERROR = 1333u32; -pub const ERROR_TOO_MANY_MODULES: WIN32_ERROR = 214u32; -pub const ERROR_TOO_MANY_MUXWAITERS: WIN32_ERROR = 152u32; -pub const ERROR_TOO_MANY_NAMES: WIN32_ERROR = 68u32; -pub const ERROR_TOO_MANY_OPEN_FILES: WIN32_ERROR = 4u32; -pub const ERROR_TOO_MANY_POSTS: WIN32_ERROR = 298u32; -pub const ERROR_TOO_MANY_SECRETS: WIN32_ERROR = 1381u32; -pub const ERROR_TOO_MANY_SEMAPHORES: WIN32_ERROR = 100u32; -pub const ERROR_TOO_MANY_SEM_REQUESTS: WIN32_ERROR = 103u32; -pub const ERROR_TOO_MANY_SESS: WIN32_ERROR = 69u32; -pub const ERROR_TOO_MANY_SIDS: WIN32_ERROR = 1389u32; -pub const ERROR_TOO_MANY_TCBS: WIN32_ERROR = 155u32; -pub const ERROR_TOO_MANY_THREADS: WIN32_ERROR = 565u32; -pub const ERROR_TRANSLATION_COMPLETE: WIN32_ERROR = 757u32; -pub const ERROR_TRUSTED_DOMAIN_FAILURE: WIN32_ERROR = 1788u32; -pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: WIN32_ERROR = 1789u32; -pub const ERROR_TRUST_FAILURE: WIN32_ERROR = 1790u32; -pub const ERROR_UNABLE_TO_LOCK_MEDIA: WIN32_ERROR = 1108u32; -pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: WIN32_ERROR = 1176u32; -pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: WIN32_ERROR = 1177u32; -pub const ERROR_UNABLE_TO_REMOVE_REPLACED: WIN32_ERROR = 1175u32; -pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: WIN32_ERROR = 1109u32; -pub const ERROR_UNDEFINED_CHARACTER: WIN32_ERROR = 583u32; -pub const ERROR_UNDEFINED_SCOPE: WIN32_ERROR = 319u32; -pub const ERROR_UNEXPECTED_MM_CREATE_ERR: WIN32_ERROR = 556u32; -pub const ERROR_UNEXPECTED_MM_EXTEND_ERR: WIN32_ERROR = 558u32; -pub const ERROR_UNEXPECTED_MM_MAP_ERROR: WIN32_ERROR = 557u32; -pub const ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR: WIN32_ERROR = 443u32; -pub const ERROR_UNEXP_NET_ERR: WIN32_ERROR = 59u32; -pub const ERROR_UNHANDLED_EXCEPTION: WIN32_ERROR = 574u32; -pub const ERROR_UNIDENTIFIED_ERROR: WIN32_ERROR = 1287u32; -pub const ERROR_UNKNOWN_COMPONENT: WIN32_ERROR = 1607u32; -pub const ERROR_UNKNOWN_FEATURE: WIN32_ERROR = 1606u32; -pub const ERROR_UNKNOWN_PATCH: WIN32_ERROR = 1647u32; -pub const ERROR_UNKNOWN_PORT: WIN32_ERROR = 1796u32; -pub const ERROR_UNKNOWN_PRINTER_DRIVER: WIN32_ERROR = 1797u32; -pub const ERROR_UNKNOWN_PRINTPROCESSOR: WIN32_ERROR = 1798u32; -pub const ERROR_UNKNOWN_PRODUCT: WIN32_ERROR = 1605u32; -pub const ERROR_UNKNOWN_PROPERTY: WIN32_ERROR = 1608u32; -pub const ERROR_UNKNOWN_REVISION: WIN32_ERROR = 1305u32; -pub const ERROR_UNRECOGNIZED_MEDIA: WIN32_ERROR = 1785u32; -pub const ERROR_UNRECOGNIZED_VOLUME: WIN32_ERROR = 1005u32; -pub const ERROR_UNSATISFIED_DEPENDENCIES: WIN32_ERROR = 441u32; -pub const ERROR_UNSUPPORTED_COMPRESSION: WIN32_ERROR = 618u32; -pub const ERROR_UNSUPPORTED_TYPE: WIN32_ERROR = 1630u32; -pub const ERROR_UNTRUSTED_MOUNT_POINT: WIN32_ERROR = 448u32; -pub const ERROR_UNWIND: WIN32_ERROR = 542u32; -pub const ERROR_UNWIND_CONSOLIDATE: WIN32_ERROR = 684u32; -pub const ERROR_USER_APC: WIN32_ERROR = 737u32; -pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1934u32; -pub const ERROR_USER_EXISTS: WIN32_ERROR = 1316u32; -pub const ERROR_USER_MAPPED_FILE: WIN32_ERROR = 1224u32; -pub const ERROR_USER_PROFILE_LOAD: WIN32_ERROR = 500u32; -pub const ERROR_VALIDATE_CONTINUE: WIN32_ERROR = 625u32; -pub const ERROR_VC_DISCONNECTED: WIN32_ERROR = 240u32; -pub const ERROR_VDM_DISALLOWED: WIN32_ERROR = 1286u32; -pub const ERROR_VDM_HARD_ERROR: WIN32_ERROR = 593u32; -pub const ERROR_VERIFIER_STOP: WIN32_ERROR = 537u32; -pub const ERROR_VERSION_PARSE_ERROR: WIN32_ERROR = 777u32; -pub const ERROR_VIRUS_DELETED: WIN32_ERROR = 226u32; -pub const ERROR_VIRUS_INFECTED: WIN32_ERROR = 225u32; -pub const ERROR_VOLSNAP_HIBERNATE_READY: WIN32_ERROR = 761u32; -pub const ERROR_VOLSNAP_PREPARE_HIBERNATE: WIN32_ERROR = 655u32; -pub const ERROR_VOLUME_MOUNTED: WIN32_ERROR = 743u32; -pub const ERROR_VOLUME_NOT_CLUSTER_ALIGNED: WIN32_ERROR = 407u32; -pub const ERROR_VOLUME_NOT_SIS_ENABLED: WIN32_ERROR = 4500u32; -pub const ERROR_VOLUME_NOT_SUPPORTED: WIN32_ERROR = 492u32; -pub const ERROR_VOLUME_NOT_SUPPORT_EFS: WIN32_ERROR = 6014u32; -pub const ERROR_VOLUME_WRITE_ACCESS_DENIED: WIN32_ERROR = 508u32; -pub const ERROR_WAIT_1: WIN32_ERROR = 731u32; -pub const ERROR_WAIT_2: WIN32_ERROR = 732u32; -pub const ERROR_WAIT_3: WIN32_ERROR = 733u32; -pub const ERROR_WAIT_63: WIN32_ERROR = 734u32; -pub const ERROR_WAIT_FOR_OPLOCK: WIN32_ERROR = 765u32; -pub const ERROR_WAIT_NO_CHILDREN: WIN32_ERROR = 128u32; -pub const ERROR_WAKE_SYSTEM: WIN32_ERROR = 730u32; -pub const ERROR_WAKE_SYSTEM_DEBUGGER: WIN32_ERROR = 675u32; -pub const ERROR_WAS_LOCKED: WIN32_ERROR = 717u32; -pub const ERROR_WAS_UNLOCKED: WIN32_ERROR = 715u32; -pub const ERROR_WEAK_WHFBKEY_BLOCKED: WIN32_ERROR = 8651u32; -pub const ERROR_WINDOW_NOT_COMBOBOX: WIN32_ERROR = 1423u32; -pub const ERROR_WINDOW_NOT_DIALOG: WIN32_ERROR = 1420u32; -pub const ERROR_WINDOW_OF_OTHER_THREAD: WIN32_ERROR = 1408u32; -pub const ERROR_WIP_ENCRYPTION_FAILED: WIN32_ERROR = 6023u32; -pub const ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT: WIN32_ERROR = 4448u32; -pub const ERROR_WOF_WIM_HEADER_CORRUPT: WIN32_ERROR = 4446u32; -pub const ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT: WIN32_ERROR = 4447u32; -pub const ERROR_WORKING_SET_QUOTA: WIN32_ERROR = 1453u32; -pub const ERROR_WOW_ASSERTION: WIN32_ERROR = 670u32; -pub const ERROR_WRITE_FAULT: WIN32_ERROR = 29u32; -pub const ERROR_WRITE_PROTECT: WIN32_ERROR = 19u32; -pub const ERROR_WRONG_COMPARTMENT: WIN32_ERROR = 1468u32; -pub const ERROR_WRONG_DISK: WIN32_ERROR = 34u32; -pub const ERROR_WRONG_EFS: WIN32_ERROR = 6005u32; -pub const ERROR_WRONG_PASSWORD: WIN32_ERROR = 1323u32; -pub const ERROR_WRONG_TARGET_NAME: WIN32_ERROR = 1396u32; -pub const ERROR_WX86_ERROR: WIN32_ERROR = 540u32; -pub const ERROR_WX86_WARNING: WIN32_ERROR = 539u32; -pub const ERROR_XMLDSIG_ERROR: WIN32_ERROR = 1466u32; -pub const ERROR_XML_PARSE_ERROR: WIN32_ERROR = 1465u32; -pub type EXCEPTION_DISPOSITION = i32; -pub const EXCEPTION_MAXIMUM_PARAMETERS: u32 = 15u32; -#[repr(C)] -pub struct EXCEPTION_RECORD { - pub ExceptionCode: NTSTATUS, - pub ExceptionFlags: u32, - pub ExceptionRecord: *mut EXCEPTION_RECORD, - pub ExceptionAddress: *mut ::core::ffi::c_void, - pub NumberParameters: u32, - pub ExceptionInformation: [usize; 15], -} -impl ::core::marker::Copy for EXCEPTION_RECORD {} -impl ::core::clone::Clone for EXCEPTION_RECORD { - fn clone(&self) -> Self { - *self - } -} -pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = -1073741571i32; -pub const EXTENDED_STARTUPINFO_PRESENT: PROCESS_CREATION_FLAGS = 524288u32; -pub const E_NOTIMPL: HRESULT = -2147467263i32; -pub const ExceptionCollidedUnwind: EXCEPTION_DISPOSITION = 3i32; -pub const ExceptionContinueExecution: EXCEPTION_DISPOSITION = 0i32; -pub const ExceptionContinueSearch: EXCEPTION_DISPOSITION = 1i32; -pub const ExceptionNestedException: EXCEPTION_DISPOSITION = 2i32; -pub type FACILITY_CODE = u32; -pub const FACILITY_NT_BIT: FACILITY_CODE = 268435456u32; -pub const FALSE: BOOL = 0i32; -pub type FARPROC = ::core::option::Option<unsafe extern "system" fn() -> isize>; -#[repr(C)] -pub struct FD_SET { - pub fd_count: u32, - pub fd_array: [SOCKET; 64], -} -impl ::core::marker::Copy for FD_SET {} -impl ::core::clone::Clone for FD_SET { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct FILETIME { - pub dwLowDateTime: u32, - pub dwHighDateTime: u32, -} -impl ::core::marker::Copy for FILETIME {} -impl ::core::clone::Clone for FILETIME { - fn clone(&self) -> Self { - *self - } -} -pub type FILE_ACCESS_RIGHTS = u32; -pub const FILE_ADD_FILE: FILE_ACCESS_RIGHTS = 2u32; -pub const FILE_ADD_SUBDIRECTORY: FILE_ACCESS_RIGHTS = 4u32; -#[repr(C)] -pub struct FILE_ALLOCATION_INFO { - pub AllocationSize: i64, -} -impl ::core::marker::Copy for FILE_ALLOCATION_INFO {} -impl ::core::clone::Clone for FILE_ALLOCATION_INFO { - fn clone(&self) -> Self { - *self - } -} -pub const FILE_ALL_ACCESS: FILE_ACCESS_RIGHTS = 2032127u32; -pub const FILE_APPEND_DATA: FILE_ACCESS_RIGHTS = 4u32; -pub const FILE_ATTRIBUTE_ARCHIVE: FILE_FLAGS_AND_ATTRIBUTES = 32u32; -pub const FILE_ATTRIBUTE_COMPRESSED: FILE_FLAGS_AND_ATTRIBUTES = 2048u32; -pub const FILE_ATTRIBUTE_DEVICE: FILE_FLAGS_AND_ATTRIBUTES = 64u32; -pub const FILE_ATTRIBUTE_DIRECTORY: FILE_FLAGS_AND_ATTRIBUTES = 16u32; -pub const FILE_ATTRIBUTE_EA: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; -pub const FILE_ATTRIBUTE_ENCRYPTED: FILE_FLAGS_AND_ATTRIBUTES = 16384u32; -pub const FILE_ATTRIBUTE_HIDDEN: FILE_FLAGS_AND_ATTRIBUTES = 2u32; -pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: FILE_FLAGS_AND_ATTRIBUTES = 32768u32; -pub const FILE_ATTRIBUTE_NORMAL: FILE_FLAGS_AND_ATTRIBUTES = 128u32; -pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: FILE_FLAGS_AND_ATTRIBUTES = 8192u32; -pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: FILE_FLAGS_AND_ATTRIBUTES = 131072u32; -pub const FILE_ATTRIBUTE_OFFLINE: FILE_FLAGS_AND_ATTRIBUTES = 4096u32; -pub const FILE_ATTRIBUTE_PINNED: FILE_FLAGS_AND_ATTRIBUTES = 524288u32; -pub const FILE_ATTRIBUTE_READONLY: FILE_FLAGS_AND_ATTRIBUTES = 1u32; -pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS: FILE_FLAGS_AND_ATTRIBUTES = 4194304u32; -pub const FILE_ATTRIBUTE_RECALL_ON_OPEN: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; -pub const FILE_ATTRIBUTE_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 1024u32; -pub const FILE_ATTRIBUTE_SPARSE_FILE: FILE_FLAGS_AND_ATTRIBUTES = 512u32; -pub const FILE_ATTRIBUTE_SYSTEM: FILE_FLAGS_AND_ATTRIBUTES = 4u32; -#[repr(C)] -pub struct FILE_ATTRIBUTE_TAG_INFO { - pub FileAttributes: u32, - pub ReparseTag: u32, -} -impl ::core::marker::Copy for FILE_ATTRIBUTE_TAG_INFO {} -impl ::core::clone::Clone for FILE_ATTRIBUTE_TAG_INFO { - fn clone(&self) -> Self { - *self - } -} -pub const FILE_ATTRIBUTE_TEMPORARY: FILE_FLAGS_AND_ATTRIBUTES = 256u32; -pub const FILE_ATTRIBUTE_UNPINNED: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32; -pub const FILE_ATTRIBUTE_VIRTUAL: FILE_FLAGS_AND_ATTRIBUTES = 65536u32; -#[repr(C)] -pub struct FILE_BASIC_INFO { - pub CreationTime: i64, - pub LastAccessTime: i64, - pub LastWriteTime: i64, - pub ChangeTime: i64, - pub FileAttributes: u32, -} -impl ::core::marker::Copy for FILE_BASIC_INFO {} -impl ::core::clone::Clone for FILE_BASIC_INFO { - fn clone(&self) -> Self { - *self - } -} -pub const FILE_BEGIN: SET_FILE_POINTER_MOVE_METHOD = 0u32; -pub const FILE_COMPLETE_IF_OPLOCKED: NTCREATEFILE_CREATE_OPTIONS = 256u32; -pub const FILE_CONTAINS_EXTENDED_CREATE_INFORMATION: NTCREATEFILE_CREATE_OPTIONS = 268435456u32; -pub const FILE_CREATE: NTCREATEFILE_CREATE_DISPOSITION = 2u32; -pub const FILE_CREATE_PIPE_INSTANCE: FILE_ACCESS_RIGHTS = 4u32; -pub const FILE_CREATE_TREE_CONNECTION: NTCREATEFILE_CREATE_OPTIONS = 128u32; -pub type FILE_CREATION_DISPOSITION = u32; -pub const FILE_CURRENT: SET_FILE_POINTER_MOVE_METHOD = 1u32; -pub const FILE_DELETE_CHILD: FILE_ACCESS_RIGHTS = 64u32; -pub const FILE_DELETE_ON_CLOSE: NTCREATEFILE_CREATE_OPTIONS = 4096u32; -pub const FILE_DIRECTORY_FILE: NTCREATEFILE_CREATE_OPTIONS = 1u32; -pub const FILE_DISALLOW_EXCLUSIVE: NTCREATEFILE_CREATE_OPTIONS = 131072u32; -pub const FILE_DISPOSITION_FLAG_DELETE: FILE_DISPOSITION_INFO_EX_FLAGS = 1u32; -pub const FILE_DISPOSITION_FLAG_DO_NOT_DELETE: FILE_DISPOSITION_INFO_EX_FLAGS = 0u32; -pub const FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK: FILE_DISPOSITION_INFO_EX_FLAGS = 4u32; -pub const FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE: FILE_DISPOSITION_INFO_EX_FLAGS = 16u32; -pub const FILE_DISPOSITION_FLAG_ON_CLOSE: FILE_DISPOSITION_INFO_EX_FLAGS = 8u32; -pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS = 2u32; -#[repr(C)] -pub struct FILE_DISPOSITION_INFO { - pub DeleteFile: BOOLEAN, -} -impl ::core::marker::Copy for FILE_DISPOSITION_INFO {} -impl ::core::clone::Clone for FILE_DISPOSITION_INFO { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct FILE_DISPOSITION_INFO_EX { - pub Flags: FILE_DISPOSITION_INFO_EX_FLAGS, -} -impl ::core::marker::Copy for FILE_DISPOSITION_INFO_EX {} -impl ::core::clone::Clone for FILE_DISPOSITION_INFO_EX { - fn clone(&self) -> Self { - *self - } -} -pub type FILE_DISPOSITION_INFO_EX_FLAGS = u32; -pub const FILE_END: SET_FILE_POINTER_MOVE_METHOD = 2u32; -#[repr(C)] -pub struct FILE_END_OF_FILE_INFO { - pub EndOfFile: i64, -} -impl ::core::marker::Copy for FILE_END_OF_FILE_INFO {} -impl ::core::clone::Clone for FILE_END_OF_FILE_INFO { - fn clone(&self) -> Self { - *self - } -} -pub const FILE_EXECUTE: FILE_ACCESS_RIGHTS = 32u32; -pub type FILE_FLAGS_AND_ATTRIBUTES = u32; -pub const FILE_FLAG_BACKUP_SEMANTICS: FILE_FLAGS_AND_ATTRIBUTES = 33554432u32; -pub const FILE_FLAG_DELETE_ON_CLOSE: FILE_FLAGS_AND_ATTRIBUTES = 67108864u32; -pub const FILE_FLAG_FIRST_PIPE_INSTANCE: FILE_FLAGS_AND_ATTRIBUTES = 524288u32; -pub const FILE_FLAG_NO_BUFFERING: FILE_FLAGS_AND_ATTRIBUTES = 536870912u32; -pub const FILE_FLAG_OPEN_NO_RECALL: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32; -pub const FILE_FLAG_OPEN_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 2097152u32; -pub const FILE_FLAG_OVERLAPPED: FILE_FLAGS_AND_ATTRIBUTES = 1073741824u32; -pub const FILE_FLAG_POSIX_SEMANTICS: FILE_FLAGS_AND_ATTRIBUTES = 16777216u32; -pub const FILE_FLAG_RANDOM_ACCESS: FILE_FLAGS_AND_ATTRIBUTES = 268435456u32; -pub const FILE_FLAG_SEQUENTIAL_SCAN: FILE_FLAGS_AND_ATTRIBUTES = 134217728u32; -pub const FILE_FLAG_SESSION_AWARE: FILE_FLAGS_AND_ATTRIBUTES = 8388608u32; -pub const FILE_FLAG_WRITE_THROUGH: FILE_FLAGS_AND_ATTRIBUTES = 2147483648u32; -pub const FILE_GENERIC_EXECUTE: FILE_ACCESS_RIGHTS = 1179808u32; -pub const FILE_GENERIC_READ: FILE_ACCESS_RIGHTS = 1179785u32; -pub const FILE_GENERIC_WRITE: FILE_ACCESS_RIGHTS = 1179926u32; -#[repr(C)] -pub struct FILE_ID_BOTH_DIR_INFO { - pub NextEntryOffset: u32, - pub FileIndex: u32, - pub CreationTime: i64, - pub LastAccessTime: i64, - pub LastWriteTime: i64, - pub ChangeTime: i64, - pub EndOfFile: i64, - pub AllocationSize: i64, - pub FileAttributes: u32, - pub FileNameLength: u32, - pub EaSize: u32, - pub ShortNameLength: i8, - pub ShortName: [u16; 12], - pub FileId: i64, - pub FileName: [u16; 1], -} -impl ::core::marker::Copy for FILE_ID_BOTH_DIR_INFO {} -impl ::core::clone::Clone for FILE_ID_BOTH_DIR_INFO { - fn clone(&self) -> Self { - *self - } -} -pub type FILE_INFO_BY_HANDLE_CLASS = i32; -#[repr(C)] -pub struct FILE_IO_PRIORITY_HINT_INFO { - pub PriorityHint: PRIORITY_HINT, -} -impl ::core::marker::Copy for FILE_IO_PRIORITY_HINT_INFO {} -impl ::core::clone::Clone for FILE_IO_PRIORITY_HINT_INFO { - fn clone(&self) -> Self { - *self - } -} -pub const FILE_LIST_DIRECTORY: FILE_ACCESS_RIGHTS = 1u32; -pub const FILE_NAME_NORMALIZED: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32; -pub const FILE_NAME_OPENED: GETFINALPATHNAMEBYHANDLE_FLAGS = 8u32; -pub const FILE_NON_DIRECTORY_FILE: NTCREATEFILE_CREATE_OPTIONS = 64u32; -pub const FILE_NO_COMPRESSION: NTCREATEFILE_CREATE_OPTIONS = 32768u32; -pub const FILE_NO_EA_KNOWLEDGE: NTCREATEFILE_CREATE_OPTIONS = 512u32; -pub const FILE_NO_INTERMEDIATE_BUFFERING: NTCREATEFILE_CREATE_OPTIONS = 8u32; -pub const FILE_OPEN: NTCREATEFILE_CREATE_DISPOSITION = 1u32; -pub const FILE_OPEN_BY_FILE_ID: NTCREATEFILE_CREATE_OPTIONS = 8192u32; -pub const FILE_OPEN_FOR_BACKUP_INTENT: NTCREATEFILE_CREATE_OPTIONS = 16384u32; -pub const FILE_OPEN_FOR_FREE_SPACE_QUERY: NTCREATEFILE_CREATE_OPTIONS = 8388608u32; -pub const FILE_OPEN_IF: NTCREATEFILE_CREATE_DISPOSITION = 3u32; -pub const FILE_OPEN_NO_RECALL: NTCREATEFILE_CREATE_OPTIONS = 4194304u32; -pub const FILE_OPEN_REPARSE_POINT: NTCREATEFILE_CREATE_OPTIONS = 2097152u32; -pub const FILE_OPEN_REQUIRING_OPLOCK: NTCREATEFILE_CREATE_OPTIONS = 65536u32; -pub const FILE_OVERWRITE: NTCREATEFILE_CREATE_DISPOSITION = 4u32; -pub const FILE_OVERWRITE_IF: NTCREATEFILE_CREATE_DISPOSITION = 5u32; -pub const FILE_RANDOM_ACCESS: NTCREATEFILE_CREATE_OPTIONS = 2048u32; -pub const FILE_READ_ATTRIBUTES: FILE_ACCESS_RIGHTS = 128u32; -pub const FILE_READ_DATA: FILE_ACCESS_RIGHTS = 1u32; -pub const FILE_READ_EA: FILE_ACCESS_RIGHTS = 8u32; -pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32; -pub const FILE_SEQUENTIAL_ONLY: NTCREATEFILE_CREATE_OPTIONS = 4u32; -pub const FILE_SESSION_AWARE: NTCREATEFILE_CREATE_OPTIONS = 262144u32; -pub const FILE_SHARE_DELETE: FILE_SHARE_MODE = 4u32; -pub type FILE_SHARE_MODE = u32; -pub const FILE_SHARE_NONE: FILE_SHARE_MODE = 0u32; -pub const FILE_SHARE_READ: FILE_SHARE_MODE = 1u32; -pub const FILE_SHARE_WRITE: FILE_SHARE_MODE = 2u32; -#[repr(C)] -pub struct FILE_STANDARD_INFO { - pub AllocationSize: i64, - pub EndOfFile: i64, - pub NumberOfLinks: u32, - pub DeletePending: BOOLEAN, - pub Directory: BOOLEAN, -} -impl ::core::marker::Copy for FILE_STANDARD_INFO {} -impl ::core::clone::Clone for FILE_STANDARD_INFO { - fn clone(&self) -> Self { - *self - } -} -pub const FILE_SUPERSEDE: NTCREATEFILE_CREATE_DISPOSITION = 0u32; -pub const FILE_SYNCHRONOUS_IO_ALERT: NTCREATEFILE_CREATE_OPTIONS = 16u32; -pub const FILE_SYNCHRONOUS_IO_NONALERT: NTCREATEFILE_CREATE_OPTIONS = 32u32; -pub const FILE_TRAVERSE: FILE_ACCESS_RIGHTS = 32u32; -pub type FILE_TYPE = u32; -pub const FILE_TYPE_CHAR: FILE_TYPE = 2u32; -pub const FILE_TYPE_DISK: FILE_TYPE = 1u32; -pub const FILE_TYPE_PIPE: FILE_TYPE = 3u32; -pub const FILE_TYPE_REMOTE: FILE_TYPE = 32768u32; -pub const FILE_TYPE_UNKNOWN: FILE_TYPE = 0u32; -pub const FILE_WRITE_ATTRIBUTES: FILE_ACCESS_RIGHTS = 256u32; -pub const FILE_WRITE_DATA: FILE_ACCESS_RIGHTS = 2u32; -pub const FILE_WRITE_EA: FILE_ACCESS_RIGHTS = 16u32; -pub const FILE_WRITE_THROUGH: NTCREATEFILE_CREATE_OPTIONS = 2u32; -pub const FIONBIO: i32 = -2147195266i32; -#[repr(C)] -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -pub struct FLOATING_SAVE_AREA { - pub ControlWord: u32, - pub StatusWord: u32, - pub TagWord: u32, - pub ErrorOffset: u32, - pub ErrorSelector: u32, - pub DataOffset: u32, - pub DataSelector: u32, - pub RegisterArea: [u8; 80], - pub Cr0NpxState: u32, -} -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for FLOATING_SAVE_AREA {} -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for FLOATING_SAVE_AREA { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86")] -pub struct FLOATING_SAVE_AREA { - pub ControlWord: u32, - pub StatusWord: u32, - pub TagWord: u32, - pub ErrorOffset: u32, - pub ErrorSelector: u32, - pub DataOffset: u32, - pub DataSelector: u32, - pub RegisterArea: [u8; 80], - pub Spare0: u32, -} -#[cfg(target_arch = "x86")] -impl ::core::marker::Copy for FLOATING_SAVE_AREA {} -#[cfg(target_arch = "x86")] -impl ::core::clone::Clone for FLOATING_SAVE_AREA { - fn clone(&self) -> Self { - *self - } -} -pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32; -pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: FORMAT_MESSAGE_OPTIONS = 8192u32; -pub const FORMAT_MESSAGE_FROM_HMODULE: FORMAT_MESSAGE_OPTIONS = 2048u32; -pub const FORMAT_MESSAGE_FROM_STRING: FORMAT_MESSAGE_OPTIONS = 1024u32; -pub const FORMAT_MESSAGE_FROM_SYSTEM: FORMAT_MESSAGE_OPTIONS = 4096u32; -pub const FORMAT_MESSAGE_IGNORE_INSERTS: FORMAT_MESSAGE_OPTIONS = 512u32; -pub type FORMAT_MESSAGE_OPTIONS = u32; -pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: i32 = 8014i32; -pub const FSCTL_GET_REPARSE_POINT: u32 = 589992u32; -pub const FSCTL_SET_REPARSE_POINT: u32 = 589988u32; -pub const FileAlignmentInfo: FILE_INFO_BY_HANDLE_CLASS = 17i32; -pub const FileAllocationInfo: FILE_INFO_BY_HANDLE_CLASS = 5i32; -pub const FileAttributeTagInfo: FILE_INFO_BY_HANDLE_CLASS = 9i32; -pub const FileBasicInfo: FILE_INFO_BY_HANDLE_CLASS = 0i32; -pub const FileCaseSensitiveInfo: FILE_INFO_BY_HANDLE_CLASS = 23i32; -pub const FileCompressionInfo: FILE_INFO_BY_HANDLE_CLASS = 8i32; -pub const FileDispositionInfo: FILE_INFO_BY_HANDLE_CLASS = 4i32; -pub const FileDispositionInfoEx: FILE_INFO_BY_HANDLE_CLASS = 21i32; -pub const FileEndOfFileInfo: FILE_INFO_BY_HANDLE_CLASS = 6i32; -pub const FileFullDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 14i32; -pub const FileFullDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 15i32; -pub const FileIdBothDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 10i32; -pub const FileIdBothDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 11i32; -pub const FileIdExtdDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 19i32; -pub const FileIdExtdDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 20i32; -pub const FileIdInfo: FILE_INFO_BY_HANDLE_CLASS = 18i32; -pub const FileIoPriorityHintInfo: FILE_INFO_BY_HANDLE_CLASS = 12i32; -pub const FileNameInfo: FILE_INFO_BY_HANDLE_CLASS = 2i32; -pub const FileNormalizedNameInfo: FILE_INFO_BY_HANDLE_CLASS = 24i32; -pub const FileRemoteProtocolInfo: FILE_INFO_BY_HANDLE_CLASS = 13i32; -pub const FileRenameInfo: FILE_INFO_BY_HANDLE_CLASS = 3i32; -pub const FileRenameInfoEx: FILE_INFO_BY_HANDLE_CLASS = 22i32; -pub const FileStandardInfo: FILE_INFO_BY_HANDLE_CLASS = 1i32; -pub const FileStorageInfo: FILE_INFO_BY_HANDLE_CLASS = 16i32; -pub const FileStreamInfo: FILE_INFO_BY_HANDLE_CLASS = 7i32; -pub type GENERIC_ACCESS_RIGHTS = u32; -pub const GENERIC_ALL: GENERIC_ACCESS_RIGHTS = 268435456u32; -pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32; -pub const GENERIC_READ: GENERIC_ACCESS_RIGHTS = 2147483648u32; -pub const GENERIC_WRITE: GENERIC_ACCESS_RIGHTS = 1073741824u32; -pub type GETFINALPATHNAMEBYHANDLE_FLAGS = u32; -#[repr(C)] -pub struct GUID { - pub data1: u32, - pub data2: u16, - pub data3: u16, - pub data4: [u8; 8], -} -impl ::core::marker::Copy for GUID {} -impl ::core::clone::Clone for GUID { - fn clone(&self) -> Self { - *self - } -} -impl GUID { - pub const fn from_u128(uuid: u128) -> Self { - Self { - data1: (uuid >> 96) as u32, - data2: (uuid >> 80 & 0xffff) as u16, - data3: (uuid >> 64 & 0xffff) as u16, - data4: (uuid as u64).to_be_bytes(), - } - } -} -pub type HANDLE = *mut ::core::ffi::c_void; -pub type HANDLE_FLAGS = u32; -pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32; -pub const HANDLE_FLAG_PROTECT_FROM_CLOSE: HANDLE_FLAGS = 2u32; -pub const HIGH_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 128u32; -pub type HMODULE = *mut ::core::ffi::c_void; -pub type HRESULT = i32; -pub const IDLE_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 64u32; -#[repr(C)] -pub struct IN6_ADDR { - pub u: IN6_ADDR_0, -} -impl ::core::marker::Copy for IN6_ADDR {} -impl ::core::clone::Clone for IN6_ADDR { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub union IN6_ADDR_0 { - pub Byte: [u8; 16], - pub Word: [u16; 8], -} -impl ::core::marker::Copy for IN6_ADDR_0 {} -impl ::core::clone::Clone for IN6_ADDR_0 { - fn clone(&self) -> Self { - *self - } -} -pub const INFINITE: u32 = 4294967295u32; -pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32; -pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32; -#[repr(C)] -pub union INIT_ONCE { - pub Ptr: *mut ::core::ffi::c_void, -} -impl ::core::marker::Copy for INIT_ONCE {} -impl ::core::clone::Clone for INIT_ONCE { - fn clone(&self) -> Self { - *self - } -} -pub const INIT_ONCE_INIT_FAILED: u32 = 4u32; -pub const INVALID_FILE_ATTRIBUTES: u32 = 4294967295u32; -pub const INVALID_SOCKET: SOCKET = -1i32 as _; -#[repr(C)] -pub struct IN_ADDR { - pub S_un: IN_ADDR_0, -} -impl ::core::marker::Copy for IN_ADDR {} -impl ::core::clone::Clone for IN_ADDR { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub union IN_ADDR_0 { - pub S_un_b: IN_ADDR_0_0, - pub S_un_w: IN_ADDR_0_1, - pub S_addr: u32, -} -impl ::core::marker::Copy for IN_ADDR_0 {} -impl ::core::clone::Clone for IN_ADDR_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct IN_ADDR_0_0 { - pub s_b1: u8, - pub s_b2: u8, - pub s_b3: u8, - pub s_b4: u8, -} -impl ::core::marker::Copy for IN_ADDR_0_0 {} -impl ::core::clone::Clone for IN_ADDR_0_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct IN_ADDR_0_1 { - pub s_w1: u16, - pub s_w2: u16, -} -impl ::core::marker::Copy for IN_ADDR_0_1 {} -impl ::core::clone::Clone for IN_ADDR_0_1 { - fn clone(&self) -> Self { - *self - } -} -pub const IO_REPARSE_TAG_MOUNT_POINT: u32 = 2684354563u32; -pub const IO_REPARSE_TAG_SYMLINK: u32 = 2684354572u32; -#[repr(C)] -pub struct IO_STATUS_BLOCK { - pub Anonymous: IO_STATUS_BLOCK_0, - pub Information: usize, -} -impl ::core::marker::Copy for IO_STATUS_BLOCK {} -impl ::core::clone::Clone for IO_STATUS_BLOCK { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub union IO_STATUS_BLOCK_0 { - pub Status: NTSTATUS, - pub Pointer: *mut ::core::ffi::c_void, -} -impl ::core::marker::Copy for IO_STATUS_BLOCK_0 {} -impl ::core::clone::Clone for IO_STATUS_BLOCK_0 { - fn clone(&self) -> Self { - *self - } -} -pub type IPPROTO = i32; -pub const IPPROTO_AH: IPPROTO = 51i32; -pub const IPPROTO_CBT: IPPROTO = 7i32; -pub const IPPROTO_DSTOPTS: IPPROTO = 60i32; -pub const IPPROTO_EGP: IPPROTO = 8i32; -pub const IPPROTO_ESP: IPPROTO = 50i32; -pub const IPPROTO_FRAGMENT: IPPROTO = 44i32; -pub const IPPROTO_GGP: IPPROTO = 3i32; -pub const IPPROTO_HOPOPTS: IPPROTO = 0i32; -pub const IPPROTO_ICLFXBM: IPPROTO = 78i32; -pub const IPPROTO_ICMP: IPPROTO = 1i32; -pub const IPPROTO_ICMPV6: IPPROTO = 58i32; -pub const IPPROTO_IDP: IPPROTO = 22i32; -pub const IPPROTO_IGMP: IPPROTO = 2i32; -pub const IPPROTO_IGP: IPPROTO = 9i32; -pub const IPPROTO_IP: IPPROTO = 0i32; -pub const IPPROTO_IPV4: IPPROTO = 4i32; -pub const IPPROTO_IPV6: IPPROTO = 41i32; -pub const IPPROTO_L2TP: IPPROTO = 115i32; -pub const IPPROTO_MAX: IPPROTO = 256i32; -pub const IPPROTO_ND: IPPROTO = 77i32; -pub const IPPROTO_NONE: IPPROTO = 59i32; -pub const IPPROTO_PGM: IPPROTO = 113i32; -pub const IPPROTO_PIM: IPPROTO = 103i32; -pub const IPPROTO_PUP: IPPROTO = 12i32; -pub const IPPROTO_RAW: IPPROTO = 255i32; -pub const IPPROTO_RDP: IPPROTO = 27i32; -pub const IPPROTO_RESERVED_IPSEC: IPPROTO = 258i32; -pub const IPPROTO_RESERVED_IPSECOFFLOAD: IPPROTO = 259i32; -pub const IPPROTO_RESERVED_MAX: IPPROTO = 261i32; -pub const IPPROTO_RESERVED_RAW: IPPROTO = 257i32; -pub const IPPROTO_RESERVED_WNV: IPPROTO = 260i32; -pub const IPPROTO_RM: IPPROTO = 113i32; -pub const IPPROTO_ROUTING: IPPROTO = 43i32; -pub const IPPROTO_SCTP: IPPROTO = 132i32; -pub const IPPROTO_ST: IPPROTO = 5i32; -pub const IPPROTO_TCP: IPPROTO = 6i32; -pub const IPPROTO_UDP: IPPROTO = 17i32; -pub const IPV6_ADD_MEMBERSHIP: i32 = 12i32; -pub const IPV6_DROP_MEMBERSHIP: i32 = 13i32; -#[repr(C)] -pub struct IPV6_MREQ { - pub ipv6mr_multiaddr: IN6_ADDR, - pub ipv6mr_interface: u32, -} -impl ::core::marker::Copy for IPV6_MREQ {} -impl ::core::clone::Clone for IPV6_MREQ { - fn clone(&self) -> Self { - *self - } -} -pub const IPV6_MULTICAST_LOOP: i32 = 11i32; -pub const IPV6_V6ONLY: i32 = 27i32; -pub const IP_ADD_MEMBERSHIP: i32 = 12i32; -pub const IP_DROP_MEMBERSHIP: i32 = 13i32; -#[repr(C)] -pub struct IP_MREQ { - pub imr_multiaddr: IN_ADDR, - pub imr_interface: IN_ADDR, -} -impl ::core::marker::Copy for IP_MREQ {} -impl ::core::clone::Clone for IP_MREQ { - fn clone(&self) -> Self { - *self - } -} -pub const IP_MULTICAST_LOOP: i32 = 11i32; -pub const IP_MULTICAST_TTL: i32 = 10i32; -pub const IP_TTL: i32 = 4i32; -#[repr(C)] -pub struct LINGER { - pub l_onoff: u16, - pub l_linger: u16, -} -impl ::core::marker::Copy for LINGER {} -impl ::core::clone::Clone for LINGER { - fn clone(&self) -> Self { - *self - } -} -pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< - unsafe extern "system" fn( - dwerrorcode: u32, - dwnumberofbytestransfered: u32, - lpoverlapped: *mut OVERLAPPED, - ) -> (), ->; -pub type LPPROC_THREAD_ATTRIBUTE_LIST = *mut ::core::ffi::c_void; -pub type LPPROGRESS_ROUTINE = ::core::option::Option< - unsafe extern "system" fn( - totalfilesize: i64, - totalbytestransferred: i64, - streamsize: i64, - streambytestransferred: i64, - dwstreamnumber: u32, - dwcallbackreason: LPPROGRESS_ROUTINE_CALLBACK_REASON, - hsourcefile: HANDLE, - hdestinationfile: HANDLE, - lpdata: *const ::core::ffi::c_void, - ) -> u32, ->; -pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32; -pub type LPTHREAD_START_ROUTINE = ::core::option::Option< - unsafe extern "system" fn(lpthreadparameter: *mut ::core::ffi::c_void) -> u32, ->; -pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< - unsafe extern "system" fn( - dwerror: u32, - cbtransferred: u32, - lpoverlapped: *mut OVERLAPPED, - dwflags: u32, - ) -> (), ->; -#[repr(C)] -pub struct M128A { - pub Low: u64, - pub High: i64, -} -impl ::core::marker::Copy for M128A {} -impl ::core::clone::Clone for M128A { - fn clone(&self) -> Self { - *self - } -} -pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: u32 = 16384u32; -pub const MAX_PATH: u32 = 260u32; -pub const MB_COMPOSITE: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 2u32; -pub const MB_ERR_INVALID_CHARS: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 8u32; -pub const MB_PRECOMPOSED: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 1u32; -pub const MB_USEGLYPHCHARS: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 4u32; -pub const MOVEFILE_COPY_ALLOWED: MOVE_FILE_FLAGS = 2u32; -pub const MOVEFILE_CREATE_HARDLINK: MOVE_FILE_FLAGS = 16u32; -pub const MOVEFILE_DELAY_UNTIL_REBOOT: MOVE_FILE_FLAGS = 4u32; -pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: MOVE_FILE_FLAGS = 32u32; -pub const MOVEFILE_REPLACE_EXISTING: MOVE_FILE_FLAGS = 1u32; -pub const MOVEFILE_WRITE_THROUGH: MOVE_FILE_FLAGS = 8u32; -pub type MOVE_FILE_FLAGS = u32; -pub const MSG_DONTROUTE: SEND_RECV_FLAGS = 4i32; -pub const MSG_OOB: SEND_RECV_FLAGS = 1i32; -pub const MSG_PEEK: SEND_RECV_FLAGS = 2i32; -pub const MSG_PUSH_IMMEDIATE: SEND_RECV_FLAGS = 32i32; -pub const MSG_WAITALL: SEND_RECV_FLAGS = 8i32; -pub type MULTI_BYTE_TO_WIDE_CHAR_FLAGS = u32; -pub const MaximumFileInfoByHandleClass: FILE_INFO_BY_HANDLE_CLASS = 25i32; -pub type NAMED_PIPE_MODE = u32; -pub const NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32u32; -pub const NO_ERROR: WIN32_ERROR = 0u32; -pub type NTCREATEFILE_CREATE_DISPOSITION = u32; -pub type NTCREATEFILE_CREATE_OPTIONS = u32; -pub type NTSTATUS = i32; -#[repr(C)] -pub struct OBJECT_ATTRIBUTES { - pub Length: u32, - pub RootDirectory: HANDLE, - pub ObjectName: *const UNICODE_STRING, - pub Attributes: u32, - pub SecurityDescriptor: *const ::core::ffi::c_void, - pub SecurityQualityOfService: *const ::core::ffi::c_void, -} -impl ::core::marker::Copy for OBJECT_ATTRIBUTES {} -impl ::core::clone::Clone for OBJECT_ATTRIBUTES { - fn clone(&self) -> Self { - *self - } -} -pub const OBJ_DONT_REPARSE: i32 = 4096i32; -pub const OPEN_ALWAYS: FILE_CREATION_DISPOSITION = 4u32; -pub const OPEN_EXISTING: FILE_CREATION_DISPOSITION = 3u32; -#[repr(C)] -pub struct OVERLAPPED { - pub Internal: usize, - pub InternalHigh: usize, - pub Anonymous: OVERLAPPED_0, - pub hEvent: HANDLE, -} -impl ::core::marker::Copy for OVERLAPPED {} -impl ::core::clone::Clone for OVERLAPPED { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub union OVERLAPPED_0 { - pub Anonymous: OVERLAPPED_0_0, - pub Pointer: *mut ::core::ffi::c_void, -} -impl ::core::marker::Copy for OVERLAPPED_0 {} -impl ::core::clone::Clone for OVERLAPPED_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct OVERLAPPED_0_0 { - pub Offset: u32, - pub OffsetHigh: u32, -} -impl ::core::marker::Copy for OVERLAPPED_0_0 {} -impl ::core::clone::Clone for OVERLAPPED_0_0 { - fn clone(&self) -> Self { - *self - } -} -pub type PCSTR = *const u8; -pub type PCWSTR = *const u16; -pub type PIO_APC_ROUTINE = ::core::option::Option< - unsafe extern "system" fn( - apccontext: *mut ::core::ffi::c_void, - iostatusblock: *mut IO_STATUS_BLOCK, - reserved: u32, - ) -> (), ->; -pub const PIPE_ACCEPT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 0u32; -pub const PIPE_ACCESS_DUPLEX: FILE_FLAGS_AND_ATTRIBUTES = 3u32; -pub const PIPE_ACCESS_INBOUND: FILE_FLAGS_AND_ATTRIBUTES = 1u32; -pub const PIPE_ACCESS_OUTBOUND: FILE_FLAGS_AND_ATTRIBUTES = 2u32; -pub const PIPE_CLIENT_END: NAMED_PIPE_MODE = 0u32; -pub const PIPE_NOWAIT: NAMED_PIPE_MODE = 1u32; -pub const PIPE_READMODE_BYTE: NAMED_PIPE_MODE = 0u32; -pub const PIPE_READMODE_MESSAGE: NAMED_PIPE_MODE = 2u32; -pub const PIPE_REJECT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 8u32; -pub const PIPE_SERVER_END: NAMED_PIPE_MODE = 1u32; -pub const PIPE_TYPE_BYTE: NAMED_PIPE_MODE = 0u32; -pub const PIPE_TYPE_MESSAGE: NAMED_PIPE_MODE = 4u32; -pub const PIPE_WAIT: NAMED_PIPE_MODE = 0u32; -pub type PRIORITY_HINT = i32; -pub type PROCESSOR_ARCHITECTURE = u16; -pub type PROCESS_CREATION_FLAGS = u32; -#[repr(C)] -pub struct PROCESS_INFORMATION { - pub hProcess: HANDLE, - pub hThread: HANDLE, - pub dwProcessId: u32, - pub dwThreadId: u32, -} -impl ::core::marker::Copy for PROCESS_INFORMATION {} -impl ::core::clone::Clone for PROCESS_INFORMATION { - fn clone(&self) -> Self { - *self - } -} -pub const PROCESS_MODE_BACKGROUND_BEGIN: PROCESS_CREATION_FLAGS = 1048576u32; -pub const PROCESS_MODE_BACKGROUND_END: PROCESS_CREATION_FLAGS = 2097152u32; -pub const PROFILE_KERNEL: PROCESS_CREATION_FLAGS = 536870912u32; -pub const PROFILE_SERVER: PROCESS_CREATION_FLAGS = 1073741824u32; -pub const PROFILE_USER: PROCESS_CREATION_FLAGS = 268435456u32; -pub const PROGRESS_CONTINUE: u32 = 0u32; -pub type PSTR = *mut u8; -pub type PTIMERAPCROUTINE = ::core::option::Option< - unsafe extern "system" fn( - lpargtocompletionroutine: *const ::core::ffi::c_void, - dwtimerlowvalue: u32, - dwtimerhighvalue: u32, - ) -> (), ->; -pub type PWSTR = *mut u16; -pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32; -pub const REALTIME_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 256u32; -pub const SD_BOTH: WINSOCK_SHUTDOWN_HOW = 2i32; -pub const SD_RECEIVE: WINSOCK_SHUTDOWN_HOW = 0i32; -pub const SD_SEND: WINSOCK_SHUTDOWN_HOW = 1i32; -pub const SECURITY_ANONYMOUS: FILE_FLAGS_AND_ATTRIBUTES = 0u32; -#[repr(C)] -pub struct SECURITY_ATTRIBUTES { - pub nLength: u32, - pub lpSecurityDescriptor: *mut ::core::ffi::c_void, - pub bInheritHandle: BOOL, -} -impl ::core::marker::Copy for SECURITY_ATTRIBUTES {} -impl ::core::clone::Clone for SECURITY_ATTRIBUTES { - fn clone(&self) -> Self { - *self - } -} -pub const SECURITY_CONTEXT_TRACKING: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; -pub const SECURITY_DELEGATION: FILE_FLAGS_AND_ATTRIBUTES = 196608u32; -pub const SECURITY_EFFECTIVE_ONLY: FILE_FLAGS_AND_ATTRIBUTES = 524288u32; -pub const SECURITY_IDENTIFICATION: FILE_FLAGS_AND_ATTRIBUTES = 65536u32; -pub const SECURITY_IMPERSONATION: FILE_FLAGS_AND_ATTRIBUTES = 131072u32; -pub const SECURITY_SQOS_PRESENT: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32; -pub const SECURITY_VALID_SQOS_FLAGS: FILE_FLAGS_AND_ATTRIBUTES = 2031616u32; -pub type SEND_RECV_FLAGS = i32; -pub type SET_FILE_POINTER_MOVE_METHOD = u32; -#[repr(C)] -pub struct SOCKADDR { - pub sa_family: ADDRESS_FAMILY, - pub sa_data: [u8; 14], -} -impl ::core::marker::Copy for SOCKADDR {} -impl ::core::clone::Clone for SOCKADDR { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct SOCKADDR_UN { - pub sun_family: ADDRESS_FAMILY, - pub sun_path: [u8; 108], -} -impl ::core::marker::Copy for SOCKADDR_UN {} -impl ::core::clone::Clone for SOCKADDR_UN { - fn clone(&self) -> Self { - *self - } -} -pub type SOCKET = usize; -pub const SOCKET_ERROR: i32 = -1i32; -pub const SOCK_DGRAM: WINSOCK_SOCKET_TYPE = 2i32; -pub const SOCK_RAW: WINSOCK_SOCKET_TYPE = 3i32; -pub const SOCK_RDM: WINSOCK_SOCKET_TYPE = 4i32; -pub const SOCK_SEQPACKET: WINSOCK_SOCKET_TYPE = 5i32; -pub const SOCK_STREAM: WINSOCK_SOCKET_TYPE = 1i32; -pub const SOL_SOCKET: i32 = 65535i32; -pub const SO_BROADCAST: i32 = 32i32; -pub const SO_ERROR: i32 = 4103i32; -pub const SO_LINGER: i32 = 128i32; -pub const SO_RCVTIMEO: i32 = 4102i32; -pub const SO_SNDTIMEO: i32 = 4101i32; -pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32; -#[repr(C)] -pub struct SRWLOCK { - pub Ptr: *mut ::core::ffi::c_void, -} -impl ::core::marker::Copy for SRWLOCK {} -impl ::core::clone::Clone for SRWLOCK { - fn clone(&self) -> Self { - *self - } -} -pub const STACK_SIZE_PARAM_IS_A_RESERVATION: THREAD_CREATION_FLAGS = 65536u32; -pub const STANDARD_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 2031616u32; -pub const STANDARD_RIGHTS_EXECUTE: FILE_ACCESS_RIGHTS = 131072u32; -pub const STANDARD_RIGHTS_READ: FILE_ACCESS_RIGHTS = 131072u32; -pub const STANDARD_RIGHTS_REQUIRED: FILE_ACCESS_RIGHTS = 983040u32; -pub const STANDARD_RIGHTS_WRITE: FILE_ACCESS_RIGHTS = 131072u32; -pub const STARTF_FORCEOFFFEEDBACK: STARTUPINFOW_FLAGS = 128u32; -pub const STARTF_FORCEONFEEDBACK: STARTUPINFOW_FLAGS = 64u32; -pub const STARTF_PREVENTPINNING: STARTUPINFOW_FLAGS = 8192u32; -pub const STARTF_RUNFULLSCREEN: STARTUPINFOW_FLAGS = 32u32; -pub const STARTF_TITLEISAPPID: STARTUPINFOW_FLAGS = 4096u32; -pub const STARTF_TITLEISLINKNAME: STARTUPINFOW_FLAGS = 2048u32; -pub const STARTF_UNTRUSTEDSOURCE: STARTUPINFOW_FLAGS = 32768u32; -pub const STARTF_USECOUNTCHARS: STARTUPINFOW_FLAGS = 8u32; -pub const STARTF_USEFILLATTRIBUTE: STARTUPINFOW_FLAGS = 16u32; -pub const STARTF_USEHOTKEY: STARTUPINFOW_FLAGS = 512u32; -pub const STARTF_USEPOSITION: STARTUPINFOW_FLAGS = 4u32; -pub const STARTF_USESHOWWINDOW: STARTUPINFOW_FLAGS = 1u32; -pub const STARTF_USESIZE: STARTUPINFOW_FLAGS = 2u32; -pub const STARTF_USESTDHANDLES: STARTUPINFOW_FLAGS = 256u32; -#[repr(C)] -pub struct STARTUPINFOEXW { - pub StartupInfo: STARTUPINFOW, - pub lpAttributeList: LPPROC_THREAD_ATTRIBUTE_LIST, -} -impl ::core::marker::Copy for STARTUPINFOEXW {} -impl ::core::clone::Clone for STARTUPINFOEXW { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct STARTUPINFOW { - pub cb: u32, - pub lpReserved: PWSTR, - pub lpDesktop: PWSTR, - pub lpTitle: PWSTR, - pub dwX: u32, - pub dwY: u32, - pub dwXSize: u32, - pub dwYSize: u32, - pub dwXCountChars: u32, - pub dwYCountChars: u32, - pub dwFillAttribute: u32, - pub dwFlags: STARTUPINFOW_FLAGS, - pub wShowWindow: u16, - pub cbReserved2: u16, - pub lpReserved2: *mut u8, - pub hStdInput: HANDLE, - pub hStdOutput: HANDLE, - pub hStdError: HANDLE, -} -impl ::core::marker::Copy for STARTUPINFOW {} -impl ::core::clone::Clone for STARTUPINFOW { - fn clone(&self) -> Self { - *self - } -} -pub type STARTUPINFOW_FLAGS = u32; -pub const STATUS_DELETE_PENDING: NTSTATUS = -1073741738i32; -pub const STATUS_END_OF_FILE: NTSTATUS = -1073741807i32; -pub const STATUS_INVALID_PARAMETER: NTSTATUS = -1073741811i32; -pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = -1073741822i32; -pub const STATUS_PENDING: NTSTATUS = 259i32; -pub const STATUS_SUCCESS: NTSTATUS = 0i32; -pub const STD_ERROR_HANDLE: STD_HANDLE = 4294967284u32; -pub type STD_HANDLE = u32; -pub const STD_INPUT_HANDLE: STD_HANDLE = 4294967286u32; -pub const STD_OUTPUT_HANDLE: STD_HANDLE = 4294967285u32; -pub type SYMBOLIC_LINK_FLAGS = u32; -pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: SYMBOLIC_LINK_FLAGS = 2u32; -pub const SYMBOLIC_LINK_FLAG_DIRECTORY: SYMBOLIC_LINK_FLAGS = 1u32; -pub const SYMLINK_FLAG_RELATIVE: u32 = 1u32; -pub type SYNCHRONIZATION_ACCESS_RIGHTS = u32; -pub const SYNCHRONIZE: FILE_ACCESS_RIGHTS = 1048576u32; -#[repr(C)] -pub struct SYSTEM_INFO { - pub Anonymous: SYSTEM_INFO_0, - pub dwPageSize: u32, - pub lpMinimumApplicationAddress: *mut ::core::ffi::c_void, - pub lpMaximumApplicationAddress: *mut ::core::ffi::c_void, - pub dwActiveProcessorMask: usize, - pub dwNumberOfProcessors: u32, - pub dwProcessorType: u32, - pub dwAllocationGranularity: u32, - pub wProcessorLevel: u16, - pub wProcessorRevision: u16, -} -impl ::core::marker::Copy for SYSTEM_INFO {} -impl ::core::clone::Clone for SYSTEM_INFO { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub union SYSTEM_INFO_0 { - pub dwOemId: u32, - pub Anonymous: SYSTEM_INFO_0_0, -} -impl ::core::marker::Copy for SYSTEM_INFO_0 {} -impl ::core::clone::Clone for SYSTEM_INFO_0 { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct SYSTEM_INFO_0_0 { - pub wProcessorArchitecture: PROCESSOR_ARCHITECTURE, - pub wReserved: u16, -} -impl ::core::marker::Copy for SYSTEM_INFO_0_0 {} -impl ::core::clone::Clone for SYSTEM_INFO_0_0 { - fn clone(&self) -> Self { - *self - } -} -pub const TCP_NODELAY: i32 = 1i32; -pub const THREAD_CREATE_RUN_IMMEDIATELY: THREAD_CREATION_FLAGS = 0u32; -pub const THREAD_CREATE_SUSPENDED: THREAD_CREATION_FLAGS = 4u32; -pub type THREAD_CREATION_FLAGS = u32; -pub const TIMER_ALL_ACCESS: SYNCHRONIZATION_ACCESS_RIGHTS = 2031619u32; -pub const TIMER_MODIFY_STATE: SYNCHRONIZATION_ACCESS_RIGHTS = 2u32; -#[repr(C)] -pub struct TIMEVAL { - pub tv_sec: i32, - pub tv_usec: i32, -} -impl ::core::marker::Copy for TIMEVAL {} -impl ::core::clone::Clone for TIMEVAL { - fn clone(&self) -> Self { - *self - } -} -pub const TLS_OUT_OF_INDEXES: u32 = 4294967295u32; -pub type TOKEN_ACCESS_MASK = u32; -pub const TOKEN_ACCESS_PSEUDO_HANDLE: TOKEN_ACCESS_MASK = 24u32; -pub const TOKEN_ACCESS_PSEUDO_HANDLE_WIN8: TOKEN_ACCESS_MASK = 24u32; -pub const TOKEN_ACCESS_SYSTEM_SECURITY: TOKEN_ACCESS_MASK = 16777216u32; -pub const TOKEN_ADJUST_DEFAULT: TOKEN_ACCESS_MASK = 128u32; -pub const TOKEN_ADJUST_GROUPS: TOKEN_ACCESS_MASK = 64u32; -pub const TOKEN_ADJUST_PRIVILEGES: TOKEN_ACCESS_MASK = 32u32; -pub const TOKEN_ADJUST_SESSIONID: TOKEN_ACCESS_MASK = 256u32; -pub const TOKEN_ALL_ACCESS: TOKEN_ACCESS_MASK = 983551u32; -pub const TOKEN_ASSIGN_PRIMARY: TOKEN_ACCESS_MASK = 1u32; -pub const TOKEN_DELETE: TOKEN_ACCESS_MASK = 65536u32; -pub const TOKEN_DUPLICATE: TOKEN_ACCESS_MASK = 2u32; -pub const TOKEN_EXECUTE: TOKEN_ACCESS_MASK = 131072u32; -pub const TOKEN_IMPERSONATE: TOKEN_ACCESS_MASK = 4u32; -pub const TOKEN_QUERY: TOKEN_ACCESS_MASK = 8u32; -pub const TOKEN_QUERY_SOURCE: TOKEN_ACCESS_MASK = 16u32; -pub const TOKEN_READ: TOKEN_ACCESS_MASK = 131080u32; -pub const TOKEN_READ_CONTROL: TOKEN_ACCESS_MASK = 131072u32; -pub const TOKEN_TRUST_CONSTRAINT_MASK: TOKEN_ACCESS_MASK = 131096u32; -pub const TOKEN_WRITE: TOKEN_ACCESS_MASK = 131296u32; -pub const TOKEN_WRITE_DAC: TOKEN_ACCESS_MASK = 262144u32; -pub const TOKEN_WRITE_OWNER: TOKEN_ACCESS_MASK = 524288u32; -pub const TRUE: BOOL = 1i32; -pub const TRUNCATE_EXISTING: FILE_CREATION_DISPOSITION = 5u32; -#[repr(C)] -pub struct UNICODE_STRING { - pub Length: u16, - pub MaximumLength: u16, - pub Buffer: PWSTR, -} -impl ::core::marker::Copy for UNICODE_STRING {} -impl ::core::clone::Clone for UNICODE_STRING { - fn clone(&self) -> Self { - *self - } -} -pub const VOLUME_NAME_DOS: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32; -pub const VOLUME_NAME_GUID: GETFINALPATHNAMEBYHANDLE_FLAGS = 1u32; -pub const VOLUME_NAME_NONE: GETFINALPATHNAMEBYHANDLE_FLAGS = 4u32; -pub const WAIT_ABANDONED: WAIT_EVENT = 128u32; -pub const WAIT_ABANDONED_0: WAIT_EVENT = 128u32; -pub type WAIT_EVENT = u32; -pub const WAIT_FAILED: WAIT_EVENT = 4294967295u32; -pub const WAIT_IO_COMPLETION: WAIT_EVENT = 192u32; -pub const WAIT_OBJECT_0: WAIT_EVENT = 0u32; -pub const WAIT_TIMEOUT: WAIT_EVENT = 258u32; -pub const WC_ERR_INVALID_CHARS: u32 = 128u32; -pub type WIN32_ERROR = u32; -#[repr(C)] -pub struct WIN32_FIND_DATAW { - pub dwFileAttributes: u32, - pub ftCreationTime: FILETIME, - pub ftLastAccessTime: FILETIME, - pub ftLastWriteTime: FILETIME, - pub nFileSizeHigh: u32, - pub nFileSizeLow: u32, - pub dwReserved0: u32, - pub dwReserved1: u32, - pub cFileName: [u16; 260], - pub cAlternateFileName: [u16; 14], -} -impl ::core::marker::Copy for WIN32_FIND_DATAW {} -impl ::core::clone::Clone for WIN32_FIND_DATAW { - fn clone(&self) -> Self { - *self - } -} -pub type WINSOCK_SHUTDOWN_HOW = i32; -pub type WINSOCK_SOCKET_TYPE = i32; -pub const WRITE_DAC: FILE_ACCESS_RIGHTS = 262144u32; -pub const WRITE_OWNER: FILE_ACCESS_RIGHTS = 524288u32; -pub const WSABASEERR: WSA_ERROR = 10000i32; -#[repr(C)] -pub struct WSABUF { - pub len: u32, - pub buf: PSTR, -} -impl ::core::marker::Copy for WSABUF {} -impl ::core::clone::Clone for WSABUF { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -pub struct WSADATA { - pub wVersion: u16, - pub wHighVersion: u16, - pub iMaxSockets: u16, - pub iMaxUdpDg: u16, - pub lpVendorInfo: PSTR, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], -} -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for WSADATA {} -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for WSADATA { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86")] -pub struct WSADATA { - pub wVersion: u16, - pub wHighVersion: u16, - pub szDescription: [u8; 257], - pub szSystemStatus: [u8; 129], - pub iMaxSockets: u16, - pub iMaxUdpDg: u16, - pub lpVendorInfo: PSTR, -} -#[cfg(target_arch = "x86")] -impl ::core::marker::Copy for WSADATA {} -#[cfg(target_arch = "x86")] -impl ::core::clone::Clone for WSADATA { - fn clone(&self) -> Self { - *self - } -} -pub const WSAEACCES: WSA_ERROR = 10013i32; -pub const WSAEADDRINUSE: WSA_ERROR = 10048i32; -pub const WSAEADDRNOTAVAIL: WSA_ERROR = 10049i32; -pub const WSAEAFNOSUPPORT: WSA_ERROR = 10047i32; -pub const WSAEALREADY: WSA_ERROR = 10037i32; -pub const WSAEBADF: WSA_ERROR = 10009i32; -pub const WSAECANCELLED: WSA_ERROR = 10103i32; -pub const WSAECONNABORTED: WSA_ERROR = 10053i32; -pub const WSAECONNREFUSED: WSA_ERROR = 10061i32; -pub const WSAECONNRESET: WSA_ERROR = 10054i32; -pub const WSAEDESTADDRREQ: WSA_ERROR = 10039i32; -pub const WSAEDISCON: WSA_ERROR = 10101i32; -pub const WSAEDQUOT: WSA_ERROR = 10069i32; -pub const WSAEFAULT: WSA_ERROR = 10014i32; -pub const WSAEHOSTDOWN: WSA_ERROR = 10064i32; -pub const WSAEHOSTUNREACH: WSA_ERROR = 10065i32; -pub const WSAEINPROGRESS: WSA_ERROR = 10036i32; -pub const WSAEINTR: WSA_ERROR = 10004i32; -pub const WSAEINVAL: WSA_ERROR = 10022i32; -pub const WSAEINVALIDPROCTABLE: WSA_ERROR = 10104i32; -pub const WSAEINVALIDPROVIDER: WSA_ERROR = 10105i32; -pub const WSAEISCONN: WSA_ERROR = 10056i32; -pub const WSAELOOP: WSA_ERROR = 10062i32; -pub const WSAEMFILE: WSA_ERROR = 10024i32; -pub const WSAEMSGSIZE: WSA_ERROR = 10040i32; -pub const WSAENAMETOOLONG: WSA_ERROR = 10063i32; -pub const WSAENETDOWN: WSA_ERROR = 10050i32; -pub const WSAENETRESET: WSA_ERROR = 10052i32; -pub const WSAENETUNREACH: WSA_ERROR = 10051i32; -pub const WSAENOBUFS: WSA_ERROR = 10055i32; -pub const WSAENOMORE: WSA_ERROR = 10102i32; -pub const WSAENOPROTOOPT: WSA_ERROR = 10042i32; -pub const WSAENOTCONN: WSA_ERROR = 10057i32; -pub const WSAENOTEMPTY: WSA_ERROR = 10066i32; -pub const WSAENOTSOCK: WSA_ERROR = 10038i32; -pub const WSAEOPNOTSUPP: WSA_ERROR = 10045i32; -pub const WSAEPFNOSUPPORT: WSA_ERROR = 10046i32; -pub const WSAEPROCLIM: WSA_ERROR = 10067i32; -pub const WSAEPROTONOSUPPORT: WSA_ERROR = 10043i32; -pub const WSAEPROTOTYPE: WSA_ERROR = 10041i32; -pub const WSAEPROVIDERFAILEDINIT: WSA_ERROR = 10106i32; -pub const WSAEREFUSED: WSA_ERROR = 10112i32; -pub const WSAEREMOTE: WSA_ERROR = 10071i32; -pub const WSAESHUTDOWN: WSA_ERROR = 10058i32; -pub const WSAESOCKTNOSUPPORT: WSA_ERROR = 10044i32; -pub const WSAESTALE: WSA_ERROR = 10070i32; -pub const WSAETIMEDOUT: WSA_ERROR = 10060i32; -pub const WSAETOOMANYREFS: WSA_ERROR = 10059i32; -pub const WSAEUSERS: WSA_ERROR = 10068i32; -pub const WSAEWOULDBLOCK: WSA_ERROR = 10035i32; -pub const WSAHOST_NOT_FOUND: WSA_ERROR = 11001i32; -pub const WSANOTINITIALISED: WSA_ERROR = 10093i32; -pub const WSANO_DATA: WSA_ERROR = 11004i32; -pub const WSANO_RECOVERY: WSA_ERROR = 11003i32; -#[repr(C)] -pub struct WSAPROTOCOLCHAIN { - pub ChainLen: i32, - pub ChainEntries: [u32; 7], -} -impl ::core::marker::Copy for WSAPROTOCOLCHAIN {} -impl ::core::clone::Clone for WSAPROTOCOLCHAIN { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -pub struct WSAPROTOCOL_INFOW { - pub dwServiceFlags1: u32, - pub dwServiceFlags2: u32, - pub dwServiceFlags3: u32, - pub dwServiceFlags4: u32, - pub dwProviderFlags: u32, - pub ProviderId: GUID, - pub dwCatalogEntryId: u32, - pub ProtocolChain: WSAPROTOCOLCHAIN, - pub iVersion: i32, - pub iAddressFamily: i32, - pub iMaxSockAddr: i32, - pub iMinSockAddr: i32, - pub iSocketType: i32, - pub iProtocol: i32, - pub iProtocolMaxOffset: i32, - pub iNetworkByteOrder: i32, - pub iSecurityScheme: i32, - pub dwMessageSize: u32, - pub dwProviderReserved: u32, - pub szProtocol: [u16; 256], -} -impl ::core::marker::Copy for WSAPROTOCOL_INFOW {} -impl ::core::clone::Clone for WSAPROTOCOL_INFOW { - fn clone(&self) -> Self { - *self - } -} -pub const WSASERVICE_NOT_FOUND: WSA_ERROR = 10108i32; -pub const WSASYSCALLFAILURE: WSA_ERROR = 10107i32; -pub const WSASYSNOTREADY: WSA_ERROR = 10091i32; -pub const WSATRY_AGAIN: WSA_ERROR = 11002i32; -pub const WSATYPE_NOT_FOUND: WSA_ERROR = 10109i32; -pub const WSAVERNOTSUPPORTED: WSA_ERROR = 10092i32; -pub type WSA_ERROR = i32; -pub const WSA_E_CANCELLED: WSA_ERROR = 10111i32; -pub const WSA_E_NO_MORE: WSA_ERROR = 10110i32; -pub const WSA_FLAG_NO_HANDLE_INHERIT: u32 = 128u32; -pub const WSA_FLAG_OVERLAPPED: u32 = 1u32; -pub const WSA_INVALID_HANDLE: WSA_ERROR = 6i32; -pub const WSA_INVALID_PARAMETER: WSA_ERROR = 87i32; -pub const WSA_IO_INCOMPLETE: WSA_ERROR = 996i32; -pub const WSA_IO_PENDING: WSA_ERROR = 997i32; -pub const WSA_IPSEC_NAME_POLICY_ERROR: WSA_ERROR = 11033i32; -pub const WSA_NOT_ENOUGH_MEMORY: WSA_ERROR = 8i32; -pub const WSA_OPERATION_ABORTED: WSA_ERROR = 995i32; -pub const WSA_QOS_ADMISSION_FAILURE: WSA_ERROR = 11010i32; -pub const WSA_QOS_BAD_OBJECT: WSA_ERROR = 11013i32; -pub const WSA_QOS_BAD_STYLE: WSA_ERROR = 11012i32; -pub const WSA_QOS_EFILTERCOUNT: WSA_ERROR = 11021i32; -pub const WSA_QOS_EFILTERSTYLE: WSA_ERROR = 11019i32; -pub const WSA_QOS_EFILTERTYPE: WSA_ERROR = 11020i32; -pub const WSA_QOS_EFLOWCOUNT: WSA_ERROR = 11023i32; -pub const WSA_QOS_EFLOWDESC: WSA_ERROR = 11026i32; -pub const WSA_QOS_EFLOWSPEC: WSA_ERROR = 11017i32; -pub const WSA_QOS_EOBJLENGTH: WSA_ERROR = 11022i32; -pub const WSA_QOS_EPOLICYOBJ: WSA_ERROR = 11025i32; -pub const WSA_QOS_EPROVSPECBUF: WSA_ERROR = 11018i32; -pub const WSA_QOS_EPSFILTERSPEC: WSA_ERROR = 11028i32; -pub const WSA_QOS_EPSFLOWSPEC: WSA_ERROR = 11027i32; -pub const WSA_QOS_ESDMODEOBJ: WSA_ERROR = 11029i32; -pub const WSA_QOS_ESERVICETYPE: WSA_ERROR = 11016i32; -pub const WSA_QOS_ESHAPERATEOBJ: WSA_ERROR = 11030i32; -pub const WSA_QOS_EUNKOWNPSOBJ: WSA_ERROR = 11024i32; -pub const WSA_QOS_GENERIC_ERROR: WSA_ERROR = 11015i32; -pub const WSA_QOS_NO_RECEIVERS: WSA_ERROR = 11008i32; -pub const WSA_QOS_NO_SENDERS: WSA_ERROR = 11007i32; -pub const WSA_QOS_POLICY_FAILURE: WSA_ERROR = 11011i32; -pub const WSA_QOS_RECEIVERS: WSA_ERROR = 11005i32; -pub const WSA_QOS_REQUEST_CONFIRMED: WSA_ERROR = 11009i32; -pub const WSA_QOS_RESERVED_PETYPE: WSA_ERROR = 11031i32; -pub const WSA_QOS_SENDERS: WSA_ERROR = 11006i32; -pub const WSA_QOS_TRAFFIC_CTRL_ERROR: WSA_ERROR = 11014i32; -pub const WSA_SECURE_HOST_NOT_FOUND: WSA_ERROR = 11032i32; -pub const WSA_WAIT_EVENT_0: WSA_ERROR = 0i32; -pub const WSA_WAIT_IO_COMPLETION: WSA_ERROR = 192i32; -#[repr(C)] -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -pub struct XSAVE_FORMAT { - pub ControlWord: u16, - pub StatusWord: u16, - pub TagWord: u8, - pub Reserved1: u8, - pub ErrorOpcode: u16, - pub ErrorOffset: u32, - pub ErrorSelector: u16, - pub Reserved2: u16, - pub DataOffset: u32, - pub DataSelector: u16, - pub Reserved3: u16, - pub MxCsr: u32, - pub MxCsr_Mask: u32, - pub FloatRegisters: [M128A; 8], - pub XmmRegisters: [M128A; 16], - pub Reserved4: [u8; 96], -} -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::marker::Copy for XSAVE_FORMAT {} -#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] -impl ::core::clone::Clone for XSAVE_FORMAT { - fn clone(&self) -> Self { - *self - } -} -#[repr(C)] -#[cfg(target_arch = "x86")] -pub struct XSAVE_FORMAT { - pub ControlWord: u16, - pub StatusWord: u16, - pub TagWord: u8, - pub Reserved1: u8, - pub ErrorOpcode: u16, - pub ErrorOffset: u32, - pub ErrorSelector: u16, - pub Reserved2: u16, - pub DataOffset: u32, - pub DataSelector: u16, - pub Reserved3: u16, - pub MxCsr: u32, - pub MxCsr_Mask: u32, - pub FloatRegisters: [M128A; 8], - pub XmmRegisters: [M128A; 8], - pub Reserved4: [u8; 224], -} -#[cfg(target_arch = "x86")] -impl ::core::marker::Copy for XSAVE_FORMAT {} -#[cfg(target_arch = "x86")] -impl ::core::clone::Clone for XSAVE_FORMAT { - fn clone(&self) -> Self { - *self - } -} diff --git a/library/std/src/sys/windows/cmath.rs b/library/std/src/sys/windows/cmath.rs deleted file mode 100644 index 36578d5a34e..00000000000 --- a/library/std/src/sys/windows/cmath.rs +++ /dev/null @@ -1,96 +0,0 @@ -#![cfg(not(test))] - -use core::ffi::{c_double, c_float, c_int}; - -extern "C" { - pub fn acos(n: c_double) -> c_double; - pub fn asin(n: c_double) -> c_double; - pub fn atan(n: c_double) -> c_double; - pub fn atan2(a: c_double, b: c_double) -> c_double; - pub fn cbrt(n: c_double) -> c_double; - pub fn cbrtf(n: c_float) -> c_float; - pub fn cosh(n: c_double) -> c_double; - pub fn expm1(n: c_double) -> c_double; - pub fn expm1f(n: c_float) -> c_float; - pub fn fdim(a: c_double, b: c_double) -> c_double; - pub fn fdimf(a: c_float, b: c_float) -> c_float; - #[cfg_attr(target_env = "msvc", link_name = "_hypot")] - pub fn hypot(x: c_double, y: c_double) -> c_double; - #[cfg_attr(target_env = "msvc", link_name = "_hypotf")] - pub fn hypotf(x: c_float, y: c_float) -> c_float; - pub fn log1p(n: c_double) -> c_double; - pub fn log1pf(n: c_float) -> c_float; - pub fn sinh(n: c_double) -> c_double; - pub fn tan(n: c_double) -> c_double; - pub fn tanh(n: c_double) -> c_double; - pub fn tgamma(n: c_double) -> c_double; - pub fn tgammaf(n: c_float) -> c_float; - pub fn lgamma_r(n: c_double, s: &mut c_int) -> c_double; - pub fn lgammaf_r(n: c_float, s: &mut c_int) -> c_float; -} - -pub use self::shims::*; - -#[cfg(not(all(target_env = "msvc", target_arch = "x86")))] -mod shims { - use core::ffi::c_float; - - extern "C" { - pub fn acosf(n: c_float) -> c_float; - pub fn asinf(n: c_float) -> c_float; - pub fn atan2f(a: c_float, b: c_float) -> c_float; - pub fn atanf(n: c_float) -> c_float; - pub fn coshf(n: c_float) -> c_float; - pub fn sinhf(n: c_float) -> c_float; - pub fn tanf(n: c_float) -> c_float; - pub fn tanhf(n: c_float) -> c_float; - } -} - -// On 32-bit x86 MSVC these functions aren't defined, so we just define shims -// which promote everything to f64, perform the calculation, and then demote -// back to f32. While not precisely correct should be "correct enough" for now. -#[cfg(all(target_env = "msvc", target_arch = "x86"))] -mod shims { - use core::ffi::c_float; - - #[inline] - pub unsafe fn acosf(n: c_float) -> c_float { - f64::acos(n as f64) as c_float - } - - #[inline] - pub unsafe fn asinf(n: c_float) -> c_float { - f64::asin(n as f64) as c_float - } - - #[inline] - pub unsafe fn atan2f(n: c_float, b: c_float) -> c_float { - f64::atan2(n as f64, b as f64) as c_float - } - - #[inline] - pub unsafe fn atanf(n: c_float) -> c_float { - f64::atan(n as f64) as c_float - } - - #[inline] - pub unsafe fn coshf(n: c_float) -> c_float { - f64::cosh(n as f64) as c_float - } - - #[inline] - pub unsafe fn sinhf(n: c_float) -> c_float { - f64::sinh(n as f64) as c_float - } - - #[inline] - pub unsafe fn tanf(n: c_float) -> c_float { - f64::tan(n as f64) as c_float - } - - #[inline] - pub unsafe fn tanhf(n: c_float) -> c_float { - f64::tanh(n as f64) as c_float - } -} diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/windows/compat.rs deleted file mode 100644 index f60b3a2c700..00000000000 --- a/library/std/src/sys/windows/compat.rs +++ /dev/null @@ -1,244 +0,0 @@ -//! A "compatibility layer" for supporting older versions of Windows -//! -//! The standard library uses some Windows API functions that are not present -//! on older versions of Windows. (Note that the oldest version of Windows -//! that Rust supports is Windows 7 (client) and Windows Server 2008 (server).) -//! This module implements a form of delayed DLL import binding, using -//! `GetModuleHandle` and `GetProcAddress` to look up DLL entry points at -//! runtime. -//! -//! This is implemented simply by storing a function pointer in an atomic. -//! Loading and calling this function will have little or no overhead -//! compared with calling any other dynamically imported function. -//! -//! The stored function pointer starts out as an importer function which will -//! swap itself with the real function when it's called for the first time. If -//! the real function can't be imported then a fallback function is used in its -//! place. While this is low cost for the happy path (where the function is -//! already loaded) it does mean there's some overhead the first time the -//! function is called. In the worst case, multiple threads may all end up -//! importing the same function unnecessarily. - -use crate::ffi::{c_void, CStr}; -use crate::ptr::NonNull; -use crate::sync::atomic::Ordering; -use crate::sys::c; - -// This uses a static initializer to preload some imported functions. -// The CRT (C runtime) executes static initializers before `main` -// is called (for binaries) and before `DllMain` is called (for DLLs). -// -// It works by contributing a global symbol to the `.CRT$XCT` section. -// The linker builds a table of all static initializer functions. -// The CRT startup code then iterates that table, calling each -// initializer function. -// -// NOTE: User code should instead use .CRT$XCU to reliably run after std's initializer. -// If you're reading this and would like a guarantee here, please -// file an issue for discussion; currently we don't guarantee any functionality -// before main. -// See https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-initialization?view=msvc-170 -#[used] -#[link_section = ".CRT$XCT"] -static INIT_TABLE_ENTRY: unsafe extern "C" fn() = init; - -/// Preload some imported functions. -/// -/// Note that any functions included here will be unconditionally loaded in -/// the final binary, regardless of whether or not they're actually used. -/// -/// Therefore, this should be limited to `compat_fn_optional` functions which -/// must be preloaded or any functions where lazier loading demonstrates a -/// negative performance impact in practical situations. -/// -/// Currently we only preload `WaitOnAddress` and `WakeByAddressSingle`. -unsafe extern "C" fn init() { - // In an exe this code is executed before main() so is single threaded. - // In a DLL the system's loader lock will be held thereby synchronizing - // access. So the same best practices apply here as they do to running in DllMain: - // https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices - // - // DO NOT do anything interesting or complicated in this function! DO NOT call - // any Rust functions or CRT functions if those functions touch any global state, - // because this function runs during global initialization. For example, DO NOT - // do any dynamic allocation, don't call LoadLibrary, etc. - - // Attempt to preload the synch functions. - load_synch_functions(); -} - -/// Helper macro for creating CStrs from literals and symbol names. -macro_rules! ansi_str { - (sym $ident:ident) => {{ crate::sys::compat::const_cstr_from_bytes(concat!(stringify!($ident), "\0").as_bytes()) }}; - ($lit:literal) => {{ crate::sys::compat::const_cstr_from_bytes(concat!($lit, "\0").as_bytes()) }}; -} - -/// Creates a C string wrapper from a byte slice, in a constant context. -/// -/// This is a utility function used by the [`ansi_str`] macro. -/// -/// # Panics -/// -/// Panics if the slice is not null terminated or contains nulls, except as the last item -pub(crate) const fn const_cstr_from_bytes(bytes: &'static [u8]) -> &'static CStr { - if !matches!(bytes.last(), Some(&0)) { - panic!("A CStr must be null terminated"); - } - let mut i = 0; - // At this point `len()` is at least 1. - while i < bytes.len() - 1 { - if bytes[i] == 0 { - panic!("A CStr must not have interior nulls") - } - i += 1; - } - // SAFETY: The safety is ensured by the above checks. - unsafe { crate::ffi::CStr::from_bytes_with_nul_unchecked(bytes) } -} - -/// Represents a loaded module. -/// -/// Note that the modules std depends on must not be unloaded. -/// Therefore a `Module` is always valid for the lifetime of std. -#[derive(Copy, Clone)] -pub(in crate::sys) struct Module(NonNull<c_void>); -impl Module { - /// Try to get a handle to a loaded module. - /// - /// # SAFETY - /// - /// This should only be use for modules that exist for the lifetime of std - /// (e.g. kernel32 and ntdll). - pub unsafe fn new(name: &CStr) -> Option<Self> { - // SAFETY: A CStr is always null terminated. - let module = c::GetModuleHandleA(name.as_ptr().cast::<u8>()); - NonNull::new(module).map(Self) - } - - // Try to get the address of a function. - pub fn proc_address(self, name: &CStr) -> Option<NonNull<c_void>> { - unsafe { - // SAFETY: - // `self.0` will always be a valid module. - // A CStr is always null terminated. - let proc = c::GetProcAddress(self.0.as_ptr(), name.as_ptr().cast::<u8>()); - // SAFETY: `GetProcAddress` returns None on null. - proc.map(|p| NonNull::new_unchecked(p as *mut c_void)) - } - } -} - -/// Load a function or use a fallback implementation if that fails. -macro_rules! compat_fn_with_fallback { - (pub static $module:ident: &CStr = $name:expr; $( - $(#[$meta:meta])* - $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block - )*) => ( - pub static $module: &CStr = $name; - $( - $(#[$meta])* - pub mod $symbol { - #[allow(unused_imports)] - use super::*; - use crate::mem; - use crate::ffi::CStr; - use crate::sync::atomic::{AtomicPtr, Ordering}; - use crate::sys::compat::Module; - - type F = unsafe extern "system" fn($($argtype),*) -> $rettype; - - /// `PTR` contains a function pointer to one of three functions. - /// It starts with the `load` function. - /// When that is called it attempts to load the requested symbol. - /// If it succeeds, `PTR` is set to the address of that symbol. - /// If it fails, then `PTR` is set to `fallback`. - static PTR: AtomicPtr<c_void> = AtomicPtr::new(load as *mut _); - - unsafe extern "system" fn load($($argname: $argtype),*) -> $rettype { - let func = load_from_module(Module::new($module)); - func($($argname),*) - } - - fn load_from_module(module: Option<Module>) -> F { - unsafe { - static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol); - if let Some(f) = module.and_then(|m| m.proc_address(SYMBOL_NAME)) { - PTR.store(f.as_ptr(), Ordering::Relaxed); - mem::transmute(f) - } else { - PTR.store(fallback as *mut _, Ordering::Relaxed); - fallback - } - } - } - - #[allow(unused_variables)] - unsafe extern "system" fn fallback($($argname: $argtype),*) -> $rettype { - $fallback_body - } - - #[inline(always)] - pub unsafe fn call($($argname: $argtype),*) -> $rettype { - let func: F = mem::transmute(PTR.load(Ordering::Relaxed)); - func($($argname),*) - } - } - $(#[$meta])* - $vis use $symbol::call as $symbol; - )*) -} - -/// Optionally loaded functions. -/// -/// Actual loading of the function defers to $load_functions. -macro_rules! compat_fn_optional { - ($load_functions:expr; - $( - $(#[$meta:meta])* - $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) $(-> $rettype:ty)?; - )+) => ( - $( - pub mod $symbol { - #[allow(unused_imports)] - use super::*; - use crate::ffi::c_void; - use crate::mem; - use crate::ptr::{self, NonNull}; - use crate::sync::atomic::{AtomicPtr, Ordering}; - - pub(in crate::sys) static PTR: AtomicPtr<c_void> = AtomicPtr::new(ptr::null_mut()); - - type F = unsafe extern "system" fn($($argtype),*) $(-> $rettype)?; - - #[inline(always)] - pub fn option() -> Option<F> { - // Miri does not understand the way we do preloading - // therefore load the function here instead. - #[cfg(miri)] $load_functions; - NonNull::new(PTR.load(Ordering::Relaxed)).map(|f| unsafe { mem::transmute(f) }) - } - } - )+ - ) -} - -/// Load all needed functions from "api-ms-win-core-synch-l1-2-0". -pub(super) fn load_synch_functions() { - fn try_load() -> Option<()> { - const MODULE_NAME: &CStr = c"api-ms-win-core-synch-l1-2-0"; - const WAIT_ON_ADDRESS: &CStr = c"WaitOnAddress"; - const WAKE_BY_ADDRESS_SINGLE: &CStr = c"WakeByAddressSingle"; - - // Try loading the library and all the required functions. - // If any step fails, then they all fail. - let library = unsafe { Module::new(MODULE_NAME) }?; - let wait_on_address = library.proc_address(WAIT_ON_ADDRESS)?; - let wake_by_address_single = library.proc_address(WAKE_BY_ADDRESS_SINGLE)?; - - c::WaitOnAddress::PTR.store(wait_on_address.as_ptr(), Ordering::Relaxed); - c::WakeByAddressSingle::PTR.store(wake_by_address_single.as_ptr(), Ordering::Relaxed); - Some(()) - } - - try_load(); -} diff --git a/library/std/src/sys/windows/env.rs b/library/std/src/sys/windows/env.rs deleted file mode 100644 index f0a99d6200c..00000000000 --- a/library/std/src/sys/windows/env.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod os { - pub const FAMILY: &str = "windows"; - pub const OS: &str = "windows"; - pub const DLL_PREFIX: &str = ""; - pub const DLL_SUFFIX: &str = ".dll"; - pub const DLL_EXTENSION: &str = "dll"; - pub const EXE_SUFFIX: &str = ".exe"; - pub const EXE_EXTENSION: &str = "exe"; -} diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs deleted file mode 100644 index 42484543686..00000000000 --- a/library/std/src/sys/windows/fs.rs +++ /dev/null @@ -1,1528 +0,0 @@ -use crate::os::windows::prelude::*; - -use crate::borrow::Cow; -use crate::ffi::{c_void, OsString}; -use crate::fmt; -use crate::io::{self, BorrowedCursor, Error, IoSlice, IoSliceMut, SeekFrom}; -use crate::mem::{self, MaybeUninit}; -use crate::os::windows::io::{AsHandle, BorrowedHandle}; -use crate::path::{Path, PathBuf}; -use crate::ptr; -use crate::slice; -use crate::sync::Arc; -use crate::sys::handle::Handle; -use crate::sys::time::SystemTime; -use crate::sys::{c, cvt, Align8}; -use crate::sys_common::{AsInner, FromInner, IntoInner}; -use crate::thread; - -use super::path::maybe_verbatim; -use super::{api, to_u16s, IoResult}; - -pub struct File { - handle: Handle, -} - -#[derive(Clone)] -pub struct FileAttr { - attributes: c::DWORD, - creation_time: c::FILETIME, - last_access_time: c::FILETIME, - last_write_time: c::FILETIME, - file_size: u64, - reparse_tag: c::DWORD, - volume_serial_number: Option<u32>, - number_of_links: Option<u32>, - file_index: Option<u64>, -} - -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] -pub struct FileType { - attributes: c::DWORD, - reparse_tag: c::DWORD, -} - -pub struct ReadDir { - handle: FindNextFileHandle, - root: Arc<PathBuf>, - first: Option<c::WIN32_FIND_DATAW>, -} - -struct FindNextFileHandle(c::HANDLE); - -unsafe impl Send for FindNextFileHandle {} -unsafe impl Sync for FindNextFileHandle {} - -pub struct DirEntry { - root: Arc<PathBuf>, - data: c::WIN32_FIND_DATAW, -} - -unsafe impl Send for OpenOptions {} -unsafe impl Sync for OpenOptions {} - -#[derive(Clone, Debug)] -pub struct OpenOptions { - // generic - read: bool, - write: bool, - append: bool, - truncate: bool, - create: bool, - create_new: bool, - // system-specific - custom_flags: u32, - access_mode: Option<c::DWORD>, - attributes: c::DWORD, - share_mode: c::DWORD, - security_qos_flags: c::DWORD, - security_attributes: c::LPSECURITY_ATTRIBUTES, -} - -#[derive(Clone, PartialEq, Eq, Debug)] -pub struct FilePermissions { - attrs: c::DWORD, -} - -#[derive(Copy, Clone, Debug, Default)] -pub struct FileTimes { - accessed: Option<c::FILETIME>, - modified: Option<c::FILETIME>, - created: Option<c::FILETIME>, -} - -impl fmt::Debug for c::FILETIME { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let time = ((self.dwHighDateTime as u64) << 32) | self.dwLowDateTime as u64; - f.debug_tuple("FILETIME").field(&time).finish() - } -} - -#[derive(Debug)] -pub struct DirBuilder; - -impl fmt::Debug for ReadDir { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // This will only be called from std::fs::ReadDir, which will add a "ReadDir()" frame. - // Thus the result will be e g 'ReadDir("C:\")' - fmt::Debug::fmt(&*self.root, f) - } -} - -impl Iterator for ReadDir { - type Item = io::Result<DirEntry>; - fn next(&mut self) -> Option<io::Result<DirEntry>> { - if let Some(first) = self.first.take() { - if let Some(e) = DirEntry::new(&self.root, &first) { - return Some(Ok(e)); - } - } - unsafe { - let mut wfd = mem::zeroed(); - loop { - if c::FindNextFileW(self.handle.0, &mut wfd) == 0 { - if api::get_last_error().code == c::ERROR_NO_MORE_FILES { - return None; - } else { - return Some(Err(Error::last_os_error())); - } - } - if let Some(e) = DirEntry::new(&self.root, &wfd) { - return Some(Ok(e)); - } - } - } - } -} - -impl Drop for FindNextFileHandle { - fn drop(&mut self) { - let r = unsafe { c::FindClose(self.0) }; - debug_assert!(r != 0); - } -} - -impl DirEntry { - fn new(root: &Arc<PathBuf>, wfd: &c::WIN32_FIND_DATAW) -> Option<DirEntry> { - match &wfd.cFileName[0..3] { - // check for '.' and '..' - &[46, 0, ..] | &[46, 46, 0, ..] => return None, - _ => {} - } - - Some(DirEntry { root: root.clone(), data: *wfd }) - } - - pub fn path(&self) -> PathBuf { - self.root.join(self.file_name()) - } - - pub fn file_name(&self) -> OsString { - let filename = super::truncate_utf16_at_nul(&self.data.cFileName); - OsString::from_wide(filename) - } - - pub fn file_type(&self) -> io::Result<FileType> { - Ok(FileType::new( - self.data.dwFileAttributes, - /* reparse_tag = */ self.data.dwReserved0, - )) - } - - pub fn metadata(&self) -> io::Result<FileAttr> { - Ok(self.data.into()) - } -} - -impl OpenOptions { - pub fn new() -> OpenOptions { - OpenOptions { - // generic - read: false, - write: false, - append: false, - truncate: false, - create: false, - create_new: false, - // system-specific - custom_flags: 0, - access_mode: None, - share_mode: c::FILE_SHARE_READ | c::FILE_SHARE_WRITE | c::FILE_SHARE_DELETE, - attributes: 0, - security_qos_flags: 0, - security_attributes: ptr::null_mut(), - } - } - - pub fn read(&mut self, read: bool) { - self.read = read; - } - pub fn write(&mut self, write: bool) { - self.write = write; - } - pub fn append(&mut self, append: bool) { - self.append = append; - } - pub fn truncate(&mut self, truncate: bool) { - self.truncate = truncate; - } - pub fn create(&mut self, create: bool) { - self.create = create; - } - pub fn create_new(&mut self, create_new: bool) { - self.create_new = create_new; - } - - pub fn custom_flags(&mut self, flags: u32) { - self.custom_flags = flags; - } - pub fn access_mode(&mut self, access_mode: u32) { - self.access_mode = Some(access_mode); - } - pub fn share_mode(&mut self, share_mode: u32) { - self.share_mode = share_mode; - } - pub fn attributes(&mut self, attrs: u32) { - self.attributes = attrs; - } - pub fn security_qos_flags(&mut self, flags: u32) { - // We have to set `SECURITY_SQOS_PRESENT` here, because one of the valid flags we can - // receive is `SECURITY_ANONYMOUS = 0x0`, which we can't check for later on. - self.security_qos_flags = flags | c::SECURITY_SQOS_PRESENT; - } - pub fn security_attributes(&mut self, attrs: c::LPSECURITY_ATTRIBUTES) { - self.security_attributes = attrs; - } - - fn get_access_mode(&self) -> io::Result<c::DWORD> { - const ERROR_INVALID_PARAMETER: i32 = 87; - - match (self.read, self.write, self.append, self.access_mode) { - (.., Some(mode)) => Ok(mode), - (true, false, false, None) => Ok(c::GENERIC_READ), - (false, true, false, None) => Ok(c::GENERIC_WRITE), - (true, true, false, None) => Ok(c::GENERIC_READ | c::GENERIC_WRITE), - (false, _, true, None) => Ok(c::FILE_GENERIC_WRITE & !c::FILE_WRITE_DATA), - (true, _, true, None) => { - Ok(c::GENERIC_READ | (c::FILE_GENERIC_WRITE & !c::FILE_WRITE_DATA)) - } - (false, false, false, None) => Err(Error::from_raw_os_error(ERROR_INVALID_PARAMETER)), - } - } - - fn get_creation_mode(&self) -> io::Result<c::DWORD> { - const ERROR_INVALID_PARAMETER: i32 = 87; - - match (self.write, self.append) { - (true, false) => {} - (false, false) => { - if self.truncate || self.create || self.create_new { - return Err(Error::from_raw_os_error(ERROR_INVALID_PARAMETER)); - } - } - (_, true) => { - if self.truncate && !self.create_new { - return Err(Error::from_raw_os_error(ERROR_INVALID_PARAMETER)); - } - } - } - - Ok(match (self.create, self.truncate, self.create_new) { - (false, false, false) => c::OPEN_EXISTING, - (true, false, false) => c::OPEN_ALWAYS, - (false, true, false) => c::TRUNCATE_EXISTING, - // `CREATE_ALWAYS` has weird semantics so we emulate it using - // `OPEN_ALWAYS` and a manual truncation step. See #115745. - (true, true, false) => c::OPEN_ALWAYS, - (_, _, true) => c::CREATE_NEW, - }) - } - - fn get_flags_and_attributes(&self) -> c::DWORD { - self.custom_flags - | self.attributes - | self.security_qos_flags - | if self.create_new { c::FILE_FLAG_OPEN_REPARSE_POINT } else { 0 } - } -} - -impl File { - pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> { - let path = maybe_verbatim(path)?; - let creation = opts.get_creation_mode()?; - let handle = unsafe { - c::CreateFileW( - path.as_ptr(), - opts.get_access_mode()?, - opts.share_mode, - opts.security_attributes, - creation, - opts.get_flags_and_attributes(), - ptr::null_mut(), - ) - }; - let handle = unsafe { HandleOrInvalid::from_raw_handle(handle) }; - if let Ok(handle) = OwnedHandle::try_from(handle) { - // Manual truncation. See #115745. - if opts.truncate - && creation == c::OPEN_ALWAYS - && unsafe { c::GetLastError() } == c::ERROR_ALREADY_EXISTS - { - unsafe { - // This originally used `FileAllocationInfo` instead of - // `FileEndOfFileInfo` but that wasn't supported by WINE. - // It's arguable which fits the semantics of `OpenOptions` - // better so let's just use the more widely supported method. - let eof = c::FILE_END_OF_FILE_INFO { EndOfFile: 0 }; - let result = c::SetFileInformationByHandle( - handle.as_raw_handle(), - c::FileEndOfFileInfo, - ptr::addr_of!(eof).cast::<c_void>(), - mem::size_of::<c::FILE_END_OF_FILE_INFO>() as u32, - ); - if result == 0 { - return Err(io::Error::last_os_error()); - } - } - } - Ok(File { handle: Handle::from_inner(handle) }) - } else { - Err(Error::last_os_error()) - } - } - - pub fn fsync(&self) -> io::Result<()> { - cvt(unsafe { c::FlushFileBuffers(self.handle.as_raw_handle()) })?; - Ok(()) - } - - pub fn datasync(&self) -> io::Result<()> { - self.fsync() - } - - pub fn truncate(&self, size: u64) -> io::Result<()> { - let info = c::FILE_END_OF_FILE_INFO { EndOfFile: size as i64 }; - api::set_file_information_by_handle(self.handle.as_raw_handle(), &info).io_result() - } - - #[cfg(not(target_vendor = "uwp"))] - pub fn file_attr(&self) -> io::Result<FileAttr> { - unsafe { - let mut info: c::BY_HANDLE_FILE_INFORMATION = mem::zeroed(); - cvt(c::GetFileInformationByHandle(self.handle.as_raw_handle(), &mut info))?; - let mut reparse_tag = 0; - if info.dwFileAttributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 { - let mut attr_tag: c::FILE_ATTRIBUTE_TAG_INFO = mem::zeroed(); - cvt(c::GetFileInformationByHandleEx( - self.handle.as_raw_handle(), - c::FileAttributeTagInfo, - ptr::addr_of_mut!(attr_tag).cast(), - mem::size_of::<c::FILE_ATTRIBUTE_TAG_INFO>().try_into().unwrap(), - ))?; - if attr_tag.FileAttributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 { - reparse_tag = attr_tag.ReparseTag; - } - } - Ok(FileAttr { - attributes: info.dwFileAttributes, - creation_time: info.ftCreationTime, - last_access_time: info.ftLastAccessTime, - last_write_time: info.ftLastWriteTime, - file_size: (info.nFileSizeLow as u64) | ((info.nFileSizeHigh as u64) << 32), - reparse_tag, - volume_serial_number: Some(info.dwVolumeSerialNumber), - number_of_links: Some(info.nNumberOfLinks), - file_index: Some( - (info.nFileIndexLow as u64) | ((info.nFileIndexHigh as u64) << 32), - ), - }) - } - } - - #[cfg(target_vendor = "uwp")] - pub fn file_attr(&self) -> io::Result<FileAttr> { - unsafe { - let mut info: c::FILE_BASIC_INFO = mem::zeroed(); - let size = mem::size_of_val(&info); - cvt(c::GetFileInformationByHandleEx( - self.handle.as_raw_handle(), - c::FileBasicInfo, - &mut info as *mut _ as *mut c_void, - size as c::DWORD, - ))?; - let mut attr = FileAttr { - attributes: info.FileAttributes, - creation_time: c::FILETIME { - dwLowDateTime: info.CreationTime as c::DWORD, - dwHighDateTime: (info.CreationTime >> 32) as c::DWORD, - }, - last_access_time: c::FILETIME { - dwLowDateTime: info.LastAccessTime as c::DWORD, - dwHighDateTime: (info.LastAccessTime >> 32) as c::DWORD, - }, - last_write_time: c::FILETIME { - dwLowDateTime: info.LastWriteTime as c::DWORD, - dwHighDateTime: (info.LastWriteTime >> 32) as c::DWORD, - }, - file_size: 0, - reparse_tag: 0, - volume_serial_number: None, - number_of_links: None, - file_index: None, - }; - let mut info: c::FILE_STANDARD_INFO = mem::zeroed(); - let size = mem::size_of_val(&info); - cvt(c::GetFileInformationByHandleEx( - self.handle.as_raw_handle(), - c::FileStandardInfo, - &mut info as *mut _ as *mut c_void, - size as c::DWORD, - ))?; - attr.file_size = info.AllocationSize as u64; - attr.number_of_links = Some(info.NumberOfLinks); - if attr.file_type().is_reparse_point() { - let mut attr_tag: c::FILE_ATTRIBUTE_TAG_INFO = mem::zeroed(); - cvt(c::GetFileInformationByHandleEx( - self.handle.as_raw_handle(), - c::FileAttributeTagInfo, - ptr::addr_of_mut!(attr_tag).cast(), - mem::size_of::<c::FILE_ATTRIBUTE_TAG_INFO>().try_into().unwrap(), - ))?; - if attr_tag.FileAttributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 { - attr.reparse_tag = attr_tag.ReparseTag; - } - } - Ok(attr) - } - } - - pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> { - self.handle.read(buf) - } - - pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { - self.handle.read_vectored(bufs) - } - - #[inline] - pub fn is_read_vectored(&self) -> bool { - self.handle.is_read_vectored() - } - - pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> { - self.handle.read_at(buf, offset) - } - - pub fn read_buf(&self, cursor: BorrowedCursor<'_>) -> io::Result<()> { - self.handle.read_buf(cursor) - } - - pub fn write(&self, buf: &[u8]) -> io::Result<usize> { - self.handle.write(buf) - } - - pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { - self.handle.write_vectored(bufs) - } - - #[inline] - pub fn is_write_vectored(&self) -> bool { - self.handle.is_write_vectored() - } - - pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> { - self.handle.write_at(buf, offset) - } - - pub fn flush(&self) -> io::Result<()> { - Ok(()) - } - - pub fn seek(&self, pos: SeekFrom) -> io::Result<u64> { - let (whence, pos) = match pos { - // Casting to `i64` is fine, `SetFilePointerEx` reinterprets this - // integer as `u64`. - SeekFrom::Start(n) => (c::FILE_BEGIN, n as i64), - SeekFrom::End(n) => (c::FILE_END, n), - SeekFrom::Current(n) => (c::FILE_CURRENT, n), - }; - let pos = pos as c::LARGE_INTEGER; - let mut newpos = 0; - cvt(unsafe { c::SetFilePointerEx(self.handle.as_raw_handle(), pos, &mut newpos, whence) })?; - Ok(newpos as u64) - } - - pub fn duplicate(&self) -> io::Result<File> { - Ok(Self { handle: self.handle.try_clone()? }) - } - - // NB: returned pointer is derived from `space`, and has provenance to - // match. A raw pointer is returned rather than a reference in order to - // avoid narrowing provenance to the actual `REPARSE_DATA_BUFFER`. - fn reparse_point( - &self, - space: &mut Align8<[MaybeUninit<u8>]>, - ) -> io::Result<(c::DWORD, *mut c::REPARSE_DATA_BUFFER)> { - unsafe { - let mut bytes = 0; - cvt({ - // Grab this in advance to avoid it invalidating the pointer - // we get from `space.0.as_mut_ptr()`. - let len = space.0.len(); - c::DeviceIoControl( - self.handle.as_raw_handle(), - c::FSCTL_GET_REPARSE_POINT, - ptr::null_mut(), - 0, - space.0.as_mut_ptr().cast(), - len as c::DWORD, - &mut bytes, - ptr::null_mut(), - ) - })?; - const _: () = assert!(core::mem::align_of::<c::REPARSE_DATA_BUFFER>() <= 8); - Ok((bytes, space.0.as_mut_ptr().cast::<c::REPARSE_DATA_BUFFER>())) - } - } - - fn readlink(&self) -> io::Result<PathBuf> { - let mut space = - Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]); - let (_bytes, buf) = self.reparse_point(&mut space)?; - unsafe { - let (path_buffer, subst_off, subst_len, relative) = match (*buf).ReparseTag { - c::IO_REPARSE_TAG_SYMLINK => { - let info: *mut c::SYMBOLIC_LINK_REPARSE_BUFFER = - ptr::addr_of_mut!((*buf).rest).cast(); - assert!(info.is_aligned()); - ( - ptr::addr_of_mut!((*info).PathBuffer).cast::<u16>(), - (*info).SubstituteNameOffset / 2, - (*info).SubstituteNameLength / 2, - (*info).Flags & c::SYMLINK_FLAG_RELATIVE != 0, - ) - } - c::IO_REPARSE_TAG_MOUNT_POINT => { - let info: *mut c::MOUNT_POINT_REPARSE_BUFFER = - ptr::addr_of_mut!((*buf).rest).cast(); - assert!(info.is_aligned()); - ( - ptr::addr_of_mut!((*info).PathBuffer).cast::<u16>(), - (*info).SubstituteNameOffset / 2, - (*info).SubstituteNameLength / 2, - false, - ) - } - _ => { - return Err(io::const_io_error!( - io::ErrorKind::Uncategorized, - "Unsupported reparse point type", - )); - } - }; - let subst_ptr = path_buffer.add(subst_off.into()); - let subst = slice::from_raw_parts_mut(subst_ptr, subst_len as usize); - // Absolute paths start with an NT internal namespace prefix `\??\` - // We should not let it leak through. - if !relative && subst.starts_with(&[92u16, 63u16, 63u16, 92u16]) { - // Turn `\??\` into `\\?\` (a verbatim path). - subst[1] = b'\\' as u16; - // Attempt to convert to a more user-friendly path. - let user = super::args::from_wide_to_user_path( - subst.iter().copied().chain([0]).collect(), - )?; - Ok(PathBuf::from(OsString::from_wide(user.strip_suffix(&[0]).unwrap_or(&user)))) - } else { - Ok(PathBuf::from(OsString::from_wide(subst))) - } - } - } - - pub fn set_permissions(&self, perm: FilePermissions) -> io::Result<()> { - let info = c::FILE_BASIC_INFO { - CreationTime: 0, - LastAccessTime: 0, - LastWriteTime: 0, - ChangeTime: 0, - FileAttributes: perm.attrs, - }; - api::set_file_information_by_handle(self.handle.as_raw_handle(), &info).io_result() - } - - pub fn set_times(&self, times: FileTimes) -> io::Result<()> { - let is_zero = |t: c::FILETIME| t.dwLowDateTime == 0 && t.dwHighDateTime == 0; - if times.accessed.map_or(false, is_zero) - || times.modified.map_or(false, is_zero) - || times.created.map_or(false, is_zero) - { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "Cannot set file timestamp to 0", - )); - } - let is_max = - |t: c::FILETIME| t.dwLowDateTime == c::DWORD::MAX && t.dwHighDateTime == c::DWORD::MAX; - if times.accessed.map_or(false, is_max) - || times.modified.map_or(false, is_max) - || times.created.map_or(false, is_max) - { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "Cannot set file timestamp to 0xFFFF_FFFF_FFFF_FFFF", - )); - } - cvt(unsafe { - let created = - times.created.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null()); - let accessed = - times.accessed.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null()); - let modified = - times.modified.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null()); - c::SetFileTime(self.as_raw_handle(), created, accessed, modified) - })?; - Ok(()) - } - - /// Get only basic file information such as attributes and file times. - fn basic_info(&self) -> io::Result<c::FILE_BASIC_INFO> { - unsafe { - let mut info: c::FILE_BASIC_INFO = mem::zeroed(); - let size = mem::size_of_val(&info); - cvt(c::GetFileInformationByHandleEx( - self.handle.as_raw_handle(), - c::FileBasicInfo, - &mut info as *mut _ as *mut c_void, - size as c::DWORD, - ))?; - Ok(info) - } - } - /// Delete using POSIX semantics. - /// - /// Files will be deleted as soon as the handle is closed. This is supported - /// for Windows 10 1607 (aka RS1) and later. However some filesystem - /// drivers will not support it even then, e.g. FAT32. - /// - /// If the operation is not supported for this filesystem or OS version - /// then errors will be `ERROR_NOT_SUPPORTED` or `ERROR_INVALID_PARAMETER`. - fn posix_delete(&self) -> io::Result<()> { - let info = c::FILE_DISPOSITION_INFO_EX { - Flags: c::FILE_DISPOSITION_FLAG_DELETE - | c::FILE_DISPOSITION_FLAG_POSIX_SEMANTICS - | c::FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE, - }; - api::set_file_information_by_handle(self.handle.as_raw_handle(), &info).io_result() - } - - /// Delete a file using win32 semantics. The file won't actually be deleted - /// until all file handles are closed. However, marking a file for deletion - /// will prevent anyone from opening a new handle to the file. - fn win32_delete(&self) -> io::Result<()> { - let info = c::FILE_DISPOSITION_INFO { DeleteFile: c::TRUE as _ }; - api::set_file_information_by_handle(self.handle.as_raw_handle(), &info).io_result() - } - - /// Fill the given buffer with as many directory entries as will fit. - /// This will remember its position and continue from the last call unless - /// `restart` is set to `true`. - /// - /// The returned bool indicates if there are more entries or not. - /// It is an error if `self` is not a directory. - /// - /// # Symlinks and other reparse points - /// - /// On Windows a file is either a directory or a non-directory. - /// A symlink directory is simply an empty directory with some "reparse" metadata attached. - /// So if you open a link (not its target) and iterate the directory, - /// you will always iterate an empty directory regardless of the target. - fn fill_dir_buff(&self, buffer: &mut DirBuff, restart: bool) -> io::Result<bool> { - let class = - if restart { c::FileIdBothDirectoryRestartInfo } else { c::FileIdBothDirectoryInfo }; - - unsafe { - let result = cvt(c::GetFileInformationByHandleEx( - self.handle.as_raw_handle(), - class, - buffer.as_mut_ptr().cast(), - buffer.capacity() as _, - )); - match result { - Ok(_) => Ok(true), - Err(e) if e.raw_os_error() == Some(c::ERROR_NO_MORE_FILES as _) => Ok(false), - Err(e) => Err(e), - } - } - } -} - -/// A buffer for holding directory entries. -struct DirBuff { - buffer: Box<Align8<[MaybeUninit<u8>; Self::BUFFER_SIZE]>>, -} -impl DirBuff { - const BUFFER_SIZE: usize = 1024; - fn new() -> Self { - Self { - // Safety: `Align8<[MaybeUninit<u8>; N]>` does not need - // initialization. - buffer: unsafe { Box::new_uninit().assume_init() }, - } - } - fn capacity(&self) -> usize { - self.buffer.0.len() - } - fn as_mut_ptr(&mut self) -> *mut u8 { - self.buffer.0.as_mut_ptr().cast() - } - /// Returns a `DirBuffIter`. - fn iter(&self) -> DirBuffIter<'_> { - DirBuffIter::new(self) - } -} -impl AsRef<[MaybeUninit<u8>]> for DirBuff { - fn as_ref(&self) -> &[MaybeUninit<u8>] { - &self.buffer.0 - } -} - -/// An iterator over entries stored in a `DirBuff`. -/// -/// Currently only returns file names (UTF-16 encoded). -struct DirBuffIter<'a> { - buffer: Option<&'a [MaybeUninit<u8>]>, - cursor: usize, -} -impl<'a> DirBuffIter<'a> { - fn new(buffer: &'a DirBuff) -> Self { - Self { buffer: Some(buffer.as_ref()), cursor: 0 } - } -} -impl<'a> Iterator for DirBuffIter<'a> { - type Item = (Cow<'a, [u16]>, bool); - fn next(&mut self) -> Option<Self::Item> { - use crate::mem::size_of; - let buffer = &self.buffer?[self.cursor..]; - - // Get the name and next entry from the buffer. - // SAFETY: - // - The buffer contains a `FILE_ID_BOTH_DIR_INFO` struct but the last - // field (the file name) is unsized. So an offset has to be used to - // get the file name slice. - // - The OS has guaranteed initialization of the fields of - // `FILE_ID_BOTH_DIR_INFO` and the trailing filename (for at least - // `FileNameLength` bytes) - let (name, is_directory, next_entry) = unsafe { - let info = buffer.as_ptr().cast::<c::FILE_ID_BOTH_DIR_INFO>(); - // While this is guaranteed to be aligned in documentation for - // https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_both_dir_info - // it does not seem that reality is so kind, and assuming this - // caused crashes in some cases (https://github.com/rust-lang/rust/issues/104530) - // presumably, this can be blamed on buggy filesystem drivers, but who knows. - let next_entry = ptr::addr_of!((*info).NextEntryOffset).read_unaligned() as usize; - let length = ptr::addr_of!((*info).FileNameLength).read_unaligned() as usize; - let attrs = ptr::addr_of!((*info).FileAttributes).read_unaligned(); - let name = from_maybe_unaligned( - ptr::addr_of!((*info).FileName).cast::<u16>(), - length / size_of::<u16>(), - ); - let is_directory = (attrs & c::FILE_ATTRIBUTE_DIRECTORY) != 0; - - (name, is_directory, next_entry) - }; - - if next_entry == 0 { - self.buffer = None - } else { - self.cursor += next_entry - } - - // Skip `.` and `..` pseudo entries. - const DOT: u16 = b'.' as u16; - match &name[..] { - [DOT] | [DOT, DOT] => self.next(), - _ => Some((name, is_directory)), - } - } -} - -unsafe fn from_maybe_unaligned<'a>(p: *const u16, len: usize) -> Cow<'a, [u16]> { - if p.is_aligned() { - Cow::Borrowed(crate::slice::from_raw_parts(p, len)) - } else { - Cow::Owned((0..len).map(|i| p.add(i).read_unaligned()).collect()) - } -} - -/// Open a link relative to the parent directory, ensure no symlinks are followed. -fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result<File> { - // This is implemented using the lower level `NtCreateFile` function as - // unfortunately opening a file relative to a parent is not supported by - // win32 functions. It is however a fundamental feature of the NT kernel. - // - // See https://docs.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntcreatefile - unsafe { - let mut handle = ptr::null_mut(); - let mut io_status = c::IO_STATUS_BLOCK::PENDING; - let mut name_str = c::UNICODE_STRING::from_ref(name); - use crate::sync::atomic::{AtomicU32, Ordering}; - // The `OBJ_DONT_REPARSE` attribute ensures that we haven't been - // tricked into following a symlink. However, it may not be available in - // earlier versions of Windows. - static ATTRIBUTES: AtomicU32 = AtomicU32::new(c::OBJ_DONT_REPARSE); - let object = c::OBJECT_ATTRIBUTES { - ObjectName: &mut name_str, - RootDirectory: parent.as_raw_handle(), - Attributes: ATTRIBUTES.load(Ordering::Relaxed), - ..c::OBJECT_ATTRIBUTES::default() - }; - let status = c::NtCreateFile( - &mut handle, - access, - &object, - &mut io_status, - crate::ptr::null_mut(), - 0, - c::FILE_SHARE_DELETE | c::FILE_SHARE_READ | c::FILE_SHARE_WRITE, - c::FILE_OPEN, - // If `name` is a symlink then open the link rather than the target. - c::FILE_OPEN_REPARSE_POINT, - crate::ptr::null_mut(), - 0, - ); - // Convert an NTSTATUS to the more familiar Win32 error codes (aka "DosError") - if c::nt_success(status) { - Ok(File::from_raw_handle(handle)) - } else if status == c::STATUS_DELETE_PENDING { - // We make a special exception for `STATUS_DELETE_PENDING` because - // otherwise this will be mapped to `ERROR_ACCESS_DENIED` which is - // very unhelpful. - Err(io::Error::from_raw_os_error(c::ERROR_DELETE_PENDING as _)) - } else if status == c::STATUS_INVALID_PARAMETER - && ATTRIBUTES.load(Ordering::Relaxed) == c::OBJ_DONT_REPARSE - { - // Try without `OBJ_DONT_REPARSE`. See above. - ATTRIBUTES.store(0, Ordering::Relaxed); - open_link_no_reparse(parent, name, access) - } else { - Err(io::Error::from_raw_os_error(c::RtlNtStatusToDosError(status) as _)) - } - } -} - -impl AsInner<Handle> for File { - #[inline] - fn as_inner(&self) -> &Handle { - &self.handle - } -} - -impl IntoInner<Handle> for File { - fn into_inner(self) -> Handle { - self.handle - } -} - -impl FromInner<Handle> for File { - fn from_inner(handle: Handle) -> File { - File { handle } - } -} - -impl AsHandle for File { - fn as_handle(&self) -> BorrowedHandle<'_> { - self.as_inner().as_handle() - } -} - -impl AsRawHandle for File { - fn as_raw_handle(&self) -> RawHandle { - self.as_inner().as_raw_handle() - } -} - -impl IntoRawHandle for File { - fn into_raw_handle(self) -> RawHandle { - self.into_inner().into_raw_handle() - } -} - -impl FromRawHandle for File { - unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self { - Self { handle: FromInner::from_inner(FromRawHandle::from_raw_handle(raw_handle)) } - } -} - -impl fmt::Debug for File { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // FIXME(#24570): add more info here (e.g., mode) - let mut b = f.debug_struct("File"); - b.field("handle", &self.handle.as_raw_handle()); - if let Ok(path) = get_path(self) { - b.field("path", &path); - } - b.finish() - } -} - -impl FileAttr { - pub fn size(&self) -> u64 { - self.file_size - } - - pub fn perm(&self) -> FilePermissions { - FilePermissions { attrs: self.attributes } - } - - pub fn attrs(&self) -> u32 { - self.attributes - } - - pub fn file_type(&self) -> FileType { - FileType::new(self.attributes, self.reparse_tag) - } - - pub fn modified(&self) -> io::Result<SystemTime> { - Ok(SystemTime::from(self.last_write_time)) - } - - pub fn accessed(&self) -> io::Result<SystemTime> { - Ok(SystemTime::from(self.last_access_time)) - } - - pub fn created(&self) -> io::Result<SystemTime> { - Ok(SystemTime::from(self.creation_time)) - } - - pub fn modified_u64(&self) -> u64 { - to_u64(&self.last_write_time) - } - - pub fn accessed_u64(&self) -> u64 { - to_u64(&self.last_access_time) - } - - pub fn created_u64(&self) -> u64 { - to_u64(&self.creation_time) - } - - pub fn volume_serial_number(&self) -> Option<u32> { - self.volume_serial_number - } - - pub fn number_of_links(&self) -> Option<u32> { - self.number_of_links - } - - pub fn file_index(&self) -> Option<u64> { - self.file_index - } -} -impl From<c::WIN32_FIND_DATAW> for FileAttr { - fn from(wfd: c::WIN32_FIND_DATAW) -> Self { - FileAttr { - attributes: wfd.dwFileAttributes, - creation_time: wfd.ftCreationTime, - last_access_time: wfd.ftLastAccessTime, - last_write_time: wfd.ftLastWriteTime, - file_size: ((wfd.nFileSizeHigh as u64) << 32) | (wfd.nFileSizeLow as u64), - reparse_tag: if wfd.dwFileAttributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 { - // reserved unless this is a reparse point - wfd.dwReserved0 - } else { - 0 - }, - volume_serial_number: None, - number_of_links: None, - file_index: None, - } - } -} - -fn to_u64(ft: &c::FILETIME) -> u64 { - (ft.dwLowDateTime as u64) | ((ft.dwHighDateTime as u64) << 32) -} - -impl FilePermissions { - pub fn readonly(&self) -> bool { - self.attrs & c::FILE_ATTRIBUTE_READONLY != 0 - } - - pub fn set_readonly(&mut self, readonly: bool) { - if readonly { - self.attrs |= c::FILE_ATTRIBUTE_READONLY; - } else { - self.attrs &= !c::FILE_ATTRIBUTE_READONLY; - } - } -} - -impl FileTimes { - pub fn set_accessed(&mut self, t: SystemTime) { - self.accessed = Some(t.into_inner()); - } - - pub fn set_modified(&mut self, t: SystemTime) { - self.modified = Some(t.into_inner()); - } - - pub fn set_created(&mut self, t: SystemTime) { - self.created = Some(t.into_inner()); - } -} - -impl FileType { - fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType { - FileType { attributes: attrs, reparse_tag } - } - pub fn is_dir(&self) -> bool { - !self.is_symlink() && self.is_directory() - } - pub fn is_file(&self) -> bool { - !self.is_symlink() && !self.is_directory() - } - pub fn is_symlink(&self) -> bool { - self.is_reparse_point() && self.is_reparse_tag_name_surrogate() - } - pub fn is_symlink_dir(&self) -> bool { - self.is_symlink() && self.is_directory() - } - pub fn is_symlink_file(&self) -> bool { - self.is_symlink() && !self.is_directory() - } - fn is_directory(&self) -> bool { - self.attributes & c::FILE_ATTRIBUTE_DIRECTORY != 0 - } - fn is_reparse_point(&self) -> bool { - self.attributes & c::FILE_ATTRIBUTE_REPARSE_POINT != 0 - } - fn is_reparse_tag_name_surrogate(&self) -> bool { - self.reparse_tag & 0x20000000 != 0 - } -} - -impl DirBuilder { - pub fn new() -> DirBuilder { - DirBuilder - } - - pub fn mkdir(&self, p: &Path) -> io::Result<()> { - let p = maybe_verbatim(p)?; - cvt(unsafe { c::CreateDirectoryW(p.as_ptr(), ptr::null_mut()) })?; - Ok(()) - } -} - -pub fn readdir(p: &Path) -> io::Result<ReadDir> { - // We push a `*` to the end of the path which cause the empty path to be - // treated as the current directory. So, for consistency with other platforms, - // we explicitly error on the empty path. - if p.as_os_str().is_empty() { - // Return an error code consistent with other ways of opening files. - // E.g. fs::metadata or File::open. - return Err(io::Error::from_raw_os_error(c::ERROR_PATH_NOT_FOUND as i32)); - } - let root = p.to_path_buf(); - let star = p.join("*"); - let path = maybe_verbatim(&star)?; - - unsafe { - let mut wfd = mem::zeroed(); - let find_handle = c::FindFirstFileW(path.as_ptr(), &mut wfd); - if find_handle != c::INVALID_HANDLE_VALUE { - Ok(ReadDir { - handle: FindNextFileHandle(find_handle), - root: Arc::new(root), - first: Some(wfd), - }) - } else { - Err(Error::last_os_error()) - } - } -} - -pub fn unlink(p: &Path) -> io::Result<()> { - let p_u16s = maybe_verbatim(p)?; - cvt(unsafe { c::DeleteFileW(p_u16s.as_ptr()) })?; - Ok(()) -} - -pub fn rename(old: &Path, new: &Path) -> io::Result<()> { - let old = maybe_verbatim(old)?; - let new = maybe_verbatim(new)?; - cvt(unsafe { c::MoveFileExW(old.as_ptr(), new.as_ptr(), c::MOVEFILE_REPLACE_EXISTING) })?; - Ok(()) -} - -pub fn rmdir(p: &Path) -> io::Result<()> { - let p = maybe_verbatim(p)?; - cvt(unsafe { c::RemoveDirectoryW(p.as_ptr()) })?; - Ok(()) -} - -/// Open a file or directory without following symlinks. -fn open_link(path: &Path, access_mode: u32) -> io::Result<File> { - let mut opts = OpenOptions::new(); - opts.access_mode(access_mode); - // `FILE_FLAG_BACKUP_SEMANTICS` allows opening directories. - // `FILE_FLAG_OPEN_REPARSE_POINT` opens a link instead of its target. - opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS | c::FILE_FLAG_OPEN_REPARSE_POINT); - File::open(path, &opts) -} - -pub fn remove_dir_all(path: &Path) -> io::Result<()> { - let file = open_link(path, c::DELETE | c::FILE_LIST_DIRECTORY)?; - - // Test if the file is not a directory or a symlink to a directory. - if (file.basic_info()?.FileAttributes & c::FILE_ATTRIBUTE_DIRECTORY) == 0 { - return Err(io::Error::from_raw_os_error(c::ERROR_DIRECTORY as _)); - } - - match remove_dir_all_iterative(&file, File::posix_delete) { - Err(e) => { - if let Some(code) = e.raw_os_error() { - match code as u32 { - // If POSIX delete is not supported for this filesystem then fallback to win32 delete. - c::ERROR_NOT_SUPPORTED - | c::ERROR_INVALID_FUNCTION - | c::ERROR_INVALID_PARAMETER => { - remove_dir_all_iterative(&file, File::win32_delete) - } - _ => Err(e), - } - } else { - Err(e) - } - } - ok => ok, - } -} - -fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io::Result<()> { - // When deleting files we may loop this many times when certain error conditions occur. - // This allows remove_dir_all to succeed when the error is temporary. - const MAX_RETRIES: u32 = 10; - - let mut buffer = DirBuff::new(); - let mut dirlist = vec![f.duplicate()?]; - - // FIXME: This is a hack so we can push to the dirlist vec after borrowing from it. - fn copy_handle(f: &File) -> mem::ManuallyDrop<File> { - unsafe { mem::ManuallyDrop::new(File::from_raw_handle(f.as_raw_handle())) } - } - - let mut restart = true; - while let Some(dir) = dirlist.last() { - let dir = copy_handle(dir); - - // Fill the buffer and iterate the entries. - let more_data = dir.fill_dir_buff(&mut buffer, restart)?; - restart = false; - for (name, is_directory) in buffer.iter() { - if is_directory { - let child_dir = open_link_no_reparse( - &dir, - &name, - c::SYNCHRONIZE | c::DELETE | c::FILE_LIST_DIRECTORY, - ); - // On success, add the handle to the queue. - // If opening the directory fails we treat it the same as a file - if let Ok(child_dir) = child_dir { - dirlist.push(child_dir); - continue; - } - } - for i in 1..=MAX_RETRIES { - let result = open_link_no_reparse(&dir, &name, c::SYNCHRONIZE | c::DELETE); - match result { - Ok(f) => delete(&f)?, - // Already deleted, so skip. - Err(e) if e.kind() == io::ErrorKind::NotFound => break, - // Retry a few times if the file is locked or a delete is already in progress. - Err(e) - if i < MAX_RETRIES - && (e.raw_os_error() == Some(c::ERROR_DELETE_PENDING as _) - || e.raw_os_error() == Some(c::ERROR_SHARING_VIOLATION as _)) => {} - // Otherwise return the error. - Err(e) => return Err(e), - } - thread::yield_now(); - } - } - // If there were no more files then delete the directory. - if !more_data { - if let Some(dir) = dirlist.pop() { - // Retry deleting a few times in case we need to wait for a file to be deleted. - for i in 1..=MAX_RETRIES { - let result = delete(&dir); - if let Err(e) = result { - if i == MAX_RETRIES || e.kind() != io::ErrorKind::DirectoryNotEmpty { - return Err(e); - } - thread::yield_now(); - } else { - break; - } - } - } - } - } - Ok(()) -} - -pub fn readlink(path: &Path) -> io::Result<PathBuf> { - // Open the link with no access mode, instead of generic read. - // By default FILE_LIST_DIRECTORY is denied for the junction "C:\Documents and Settings", so - // this is needed for a common case. - let mut opts = OpenOptions::new(); - opts.access_mode(0); - opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT | c::FILE_FLAG_BACKUP_SEMANTICS); - let file = File::open(path, &opts)?; - file.readlink() -} - -pub fn symlink(original: &Path, link: &Path) -> io::Result<()> { - symlink_inner(original, link, false) -} - -pub fn symlink_inner(original: &Path, link: &Path, dir: bool) -> io::Result<()> { - let original = to_u16s(original)?; - let link = maybe_verbatim(link)?; - let flags = if dir { c::SYMBOLIC_LINK_FLAG_DIRECTORY } else { 0 }; - // Formerly, symlink creation required the SeCreateSymbolicLink privilege. For the Windows 10 - // Creators Update, Microsoft loosened this to allow unprivileged symlink creation if the - // computer is in Developer Mode, but SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE must be - // added to dwFlags to opt into this behaviour. - let result = cvt(unsafe { - c::CreateSymbolicLinkW( - link.as_ptr(), - original.as_ptr(), - flags | c::SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, - ) as c::BOOL - }); - if let Err(err) = result { - if err.raw_os_error() == Some(c::ERROR_INVALID_PARAMETER as i32) { - // Older Windows objects to SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, - // so if we encounter ERROR_INVALID_PARAMETER, retry without that flag. - cvt(unsafe { - c::CreateSymbolicLinkW(link.as_ptr(), original.as_ptr(), flags) as c::BOOL - })?; - } else { - return Err(err); - } - } - Ok(()) -} - -#[cfg(not(target_vendor = "uwp"))] -pub fn link(original: &Path, link: &Path) -> io::Result<()> { - let original = maybe_verbatim(original)?; - let link = maybe_verbatim(link)?; - cvt(unsafe { c::CreateHardLinkW(link.as_ptr(), original.as_ptr(), ptr::null_mut()) })?; - Ok(()) -} - -#[cfg(target_vendor = "uwp")] -pub fn link(_original: &Path, _link: &Path) -> io::Result<()> { - return Err(io::const_io_error!( - io::ErrorKind::Unsupported, - "hard link are not supported on UWP", - )); -} - -pub fn stat(path: &Path) -> io::Result<FileAttr> { - match metadata(path, ReparsePoint::Follow) { - Err(err) if err.raw_os_error() == Some(c::ERROR_CANT_ACCESS_FILE as i32) => { - if let Ok(attrs) = lstat(path) { - if !attrs.file_type().is_symlink() { - return Ok(attrs); - } - } - Err(err) - } - result => result, - } -} - -pub fn lstat(path: &Path) -> io::Result<FileAttr> { - metadata(path, ReparsePoint::Open) -} - -#[repr(u32)] -#[derive(Clone, Copy, PartialEq, Eq)] -enum ReparsePoint { - Follow = 0, - Open = c::FILE_FLAG_OPEN_REPARSE_POINT, -} -impl ReparsePoint { - fn as_flag(self) -> u32 { - self as u32 - } -} - -fn metadata(path: &Path, reparse: ReparsePoint) -> io::Result<FileAttr> { - let mut opts = OpenOptions::new(); - // No read or write permissions are necessary - opts.access_mode(0); - opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS | reparse.as_flag()); - - // Attempt to open the file normally. - // If that fails with `ERROR_SHARING_VIOLATION` then retry using `FindFirstFileW`. - // If the fallback fails for any reason we return the original error. - match File::open(path, &opts) { - Ok(file) => file.file_attr(), - Err(e) - if [Some(c::ERROR_SHARING_VIOLATION as _), Some(c::ERROR_ACCESS_DENIED as _)] - .contains(&e.raw_os_error()) => - { - // `ERROR_ACCESS_DENIED` is returned when the user doesn't have permission for the resource. - // One such example is `System Volume Information` as default but can be created as well - // `ERROR_SHARING_VIOLATION` will almost never be returned. - // Usually if a file is locked you can still read some metadata. - // However, there are special system files, such as - // `C:\hiberfil.sys`, that are locked in a way that denies even that. - unsafe { - let path = maybe_verbatim(path)?; - - // `FindFirstFileW` accepts wildcard file names. - // Fortunately wildcards are not valid file names and - // `ERROR_SHARING_VIOLATION` means the file exists (but is locked) - // therefore it's safe to assume the file name given does not - // include wildcards. - let mut wfd = mem::zeroed(); - let handle = c::FindFirstFileW(path.as_ptr(), &mut wfd); - - if handle == c::INVALID_HANDLE_VALUE { - // This can fail if the user does not have read access to the - // directory. - Err(e) - } else { - // We no longer need the find handle. - c::FindClose(handle); - - // `FindFirstFileW` reads the cached file information from the - // directory. The downside is that this metadata may be outdated. - let attrs = FileAttr::from(wfd); - if reparse == ReparsePoint::Follow && attrs.file_type().is_symlink() { - Err(e) - } else { - Ok(attrs) - } - } - } - } - Err(e) => Err(e), - } -} - -pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> { - let p = maybe_verbatim(p)?; - unsafe { - cvt(c::SetFileAttributesW(p.as_ptr(), perm.attrs))?; - Ok(()) - } -} - -fn get_path(f: &File) -> io::Result<PathBuf> { - super::fill_utf16_buf( - |buf, sz| unsafe { - c::GetFinalPathNameByHandleW(f.handle.as_raw_handle(), buf, sz, c::VOLUME_NAME_DOS) - }, - |buf| PathBuf::from(OsString::from_wide(buf)), - ) -} - -pub fn canonicalize(p: &Path) -> io::Result<PathBuf> { - let mut opts = OpenOptions::new(); - // No read or write permissions are necessary - opts.access_mode(0); - // This flag is so we can open directories too - opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS); - let f = File::open(p, &opts)?; - get_path(&f) -} - -pub fn copy(from: &Path, to: &Path) -> io::Result<u64> { - unsafe extern "system" fn callback( - _TotalFileSize: c::LARGE_INTEGER, - _TotalBytesTransferred: c::LARGE_INTEGER, - _StreamSize: c::LARGE_INTEGER, - StreamBytesTransferred: c::LARGE_INTEGER, - dwStreamNumber: c::DWORD, - _dwCallbackReason: c::DWORD, - _hSourceFile: c::HANDLE, - _hDestinationFile: c::HANDLE, - lpData: c::LPCVOID, - ) -> c::DWORD { - if dwStreamNumber == 1 { - *(lpData as *mut i64) = StreamBytesTransferred; - } - c::PROGRESS_CONTINUE - } - let pfrom = maybe_verbatim(from)?; - let pto = maybe_verbatim(to)?; - let mut size = 0i64; - cvt(unsafe { - c::CopyFileExW( - pfrom.as_ptr(), - pto.as_ptr(), - Some(callback), - &mut size as *mut _ as *mut _, - ptr::null_mut(), - 0, - ) - })?; - Ok(size as u64) -} - -#[allow(dead_code)] -pub fn symlink_junction<P: AsRef<Path>, Q: AsRef<Path>>( - original: P, - junction: Q, -) -> io::Result<()> { - symlink_junction_inner(original.as_ref(), junction.as_ref()) -} - -// Creating a directory junction on windows involves dealing with reparse -// points and the DeviceIoControl function, and this code is a skeleton of -// what can be found here: -// -// http://www.flexhex.com/docs/articles/hard-links.phtml -#[allow(dead_code)] -fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> { - let d = DirBuilder::new(); - d.mkdir(junction)?; - - let mut opts = OpenOptions::new(); - opts.write(true); - opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT | c::FILE_FLAG_BACKUP_SEMANTICS); - let f = File::open(junction, &opts)?; - let h = f.as_inner().as_raw_handle(); - unsafe { - let mut data = - Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]); - let data_ptr = data.0.as_mut_ptr(); - let data_end = data_ptr.add(c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize); - let db = data_ptr.cast::<c::REPARSE_MOUNTPOINT_DATA_BUFFER>(); - // Zero the header to ensure it's fully initialized, including reserved parameters. - *db = mem::zeroed(); - let reparse_target_slice = { - let buf_start = ptr::addr_of_mut!((*db).ReparseTarget).cast::<c::WCHAR>(); - // Compute offset in bytes and then divide so that we round down - // rather than hit any UB (admittedly this arithmetic should work - // out so that this isn't necessary) - let buf_len_bytes = usize::try_from(data_end.byte_offset_from(buf_start)).unwrap(); - let buf_len_wchars = buf_len_bytes / core::mem::size_of::<c::WCHAR>(); - core::slice::from_raw_parts_mut(buf_start, buf_len_wchars) - }; - - // FIXME: this conversion is very hacky - let iter = br"\??\" - .iter() - .map(|x| *x as u16) - .chain(original.as_os_str().encode_wide()) - .chain(core::iter::once(0)); - let mut i = 0; - for c in iter { - if i >= reparse_target_slice.len() { - return Err(crate::io::const_io_error!( - crate::io::ErrorKind::InvalidFilename, - "Input filename is too long" - )); - } - reparse_target_slice[i] = c; - i += 1; - } - (*db).ReparseTag = c::IO_REPARSE_TAG_MOUNT_POINT; - (*db).ReparseTargetMaximumLength = (i * 2) as c::WORD; - (*db).ReparseTargetLength = ((i - 1) * 2) as c::WORD; - (*db).ReparseDataLength = (*db).ReparseTargetLength as c::DWORD + 12; - - let mut ret = 0; - cvt(c::DeviceIoControl( - h as *mut _, - c::FSCTL_SET_REPARSE_POINT, - data_ptr.cast(), - (*db).ReparseDataLength + 8, - ptr::null_mut(), - 0, - &mut ret, - ptr::null_mut(), - )) - .map(drop) - } -} - -// Try to see if a file exists but, unlike `exists`, report I/O errors. -pub fn try_exists(path: &Path) -> io::Result<bool> { - // Open the file to ensure any symlinks are followed to their target. - let mut opts = OpenOptions::new(); - // No read, write, etc access rights are needed. - opts.access_mode(0); - // Backup semantics enables opening directories as well as files. - opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS); - match File::open(path, &opts) { - Err(e) => match e.kind() { - // The file definitely does not exist - io::ErrorKind::NotFound => Ok(false), - - // `ERROR_SHARING_VIOLATION` means that the file has been locked by - // another process. This is often temporary so we simply report it - // as the file existing. - _ if e.raw_os_error() == Some(c::ERROR_SHARING_VIOLATION as i32) => Ok(true), - - // `ERROR_CANT_ACCESS_FILE` means that a file exists but that the - // reparse point could not be handled by `CreateFile`. - // This can happen for special files such as: - // * Unix domain sockets which you need to `connect` to - // * App exec links which require using `CreateProcess` - _ if e.raw_os_error() == Some(c::ERROR_CANT_ACCESS_FILE as i32) => Ok(true), - - // Other errors such as `ERROR_ACCESS_DENIED` may indicate that the - // file exists. However, these types of errors are usually more - // permanent so we report them here. - _ => Err(e), - }, - // The file was opened successfully therefore it must exist, - Ok(_) => Ok(true), - } -} diff --git a/library/std/src/sys/windows/handle.rs b/library/std/src/sys/windows/handle.rs deleted file mode 100644 index c4495f81a5a..00000000000 --- a/library/std/src/sys/windows/handle.rs +++ /dev/null @@ -1,338 +0,0 @@ -#![unstable(issue = "none", feature = "windows_handle")] - -#[cfg(test)] -mod tests; - -use crate::cmp; -use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, Read}; -use crate::mem; -use crate::os::windows::io::{ - AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle, -}; -use crate::ptr; -use crate::sys::c; -use crate::sys::cvt; -use crate::sys_common::{AsInner, FromInner, IntoInner}; - -/// An owned container for `HANDLE` object, closing them on Drop. -/// -/// All methods are inherited through a `Deref` impl to `RawHandle` -pub struct Handle(OwnedHandle); - -impl Handle { - pub fn new_event(manual: bool, init: bool) -> io::Result<Handle> { - unsafe { - let event = - c::CreateEventW(ptr::null_mut(), manual as c::BOOL, init as c::BOOL, ptr::null()); - if event.is_null() { - Err(io::Error::last_os_error()) - } else { - Ok(Handle::from_raw_handle(event)) - } - } - } -} - -impl AsInner<OwnedHandle> for Handle { - #[inline] - fn as_inner(&self) -> &OwnedHandle { - &self.0 - } -} - -impl IntoInner<OwnedHandle> for Handle { - fn into_inner(self) -> OwnedHandle { - self.0 - } -} - -impl FromInner<OwnedHandle> for Handle { - fn from_inner(file_desc: OwnedHandle) -> Self { - Self(file_desc) - } -} - -impl AsHandle for Handle { - fn as_handle(&self) -> BorrowedHandle<'_> { - self.0.as_handle() - } -} - -impl AsRawHandle for Handle { - fn as_raw_handle(&self) -> RawHandle { - self.0.as_raw_handle() - } -} - -impl IntoRawHandle for Handle { - fn into_raw_handle(self) -> RawHandle { - self.0.into_raw_handle() - } -} - -impl FromRawHandle for Handle { - unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self { - Self(FromRawHandle::from_raw_handle(raw_handle)) - } -} - -impl Handle { - pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> { - let res = unsafe { self.synchronous_read(buf.as_mut_ptr().cast(), buf.len(), None) }; - - match res { - Ok(read) => Ok(read), - - // The special treatment of BrokenPipe is to deal with Windows - // pipe semantics, which yields this error when *reading* from - // a pipe after the other end has closed; we interpret that as - // EOF on the pipe. - Err(ref e) if e.kind() == ErrorKind::BrokenPipe => Ok(0), - - Err(e) => Err(e), - } - } - - pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { - crate::io::default_read_vectored(|buf| self.read(buf), bufs) - } - - #[inline] - pub fn is_read_vectored(&self) -> bool { - false - } - - pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> { - let res = - unsafe { self.synchronous_read(buf.as_mut_ptr().cast(), buf.len(), Some(offset)) }; - - match res { - Ok(read) => Ok(read), - Err(ref e) if e.raw_os_error() == Some(c::ERROR_HANDLE_EOF as i32) => Ok(0), - Err(e) => Err(e), - } - } - - pub fn read_buf(&self, mut cursor: BorrowedCursor<'_>) -> io::Result<()> { - let res = - unsafe { self.synchronous_read(cursor.as_mut().as_mut_ptr(), cursor.capacity(), None) }; - - match res { - Ok(read) => { - // Safety: `read` bytes were written to the initialized portion of the buffer - unsafe { - cursor.advance(read); - } - Ok(()) - } - - // The special treatment of BrokenPipe is to deal with Windows - // pipe semantics, which yields this error when *reading* from - // a pipe after the other end has closed; we interpret that as - // EOF on the pipe. - Err(ref e) if e.kind() == ErrorKind::BrokenPipe => Ok(()), - - Err(e) => Err(e), - } - } - - pub unsafe fn read_overlapped( - &self, - buf: &mut [u8], - overlapped: *mut c::OVERLAPPED, - ) -> io::Result<Option<usize>> { - let len = cmp::min(buf.len(), <c::DWORD>::MAX as usize) as c::DWORD; - let mut amt = 0; - let res = - cvt(c::ReadFile(self.as_raw_handle(), buf.as_mut_ptr(), len, &mut amt, overlapped)); - match res { - Ok(_) => Ok(Some(amt as usize)), - Err(e) => { - if e.raw_os_error() == Some(c::ERROR_IO_PENDING as i32) { - Ok(None) - } else if e.raw_os_error() == Some(c::ERROR_BROKEN_PIPE as i32) { - Ok(Some(0)) - } else { - Err(e) - } - } - } - } - - pub fn overlapped_result( - &self, - overlapped: *mut c::OVERLAPPED, - wait: bool, - ) -> io::Result<usize> { - unsafe { - let mut bytes = 0; - let wait = if wait { c::TRUE } else { c::FALSE }; - let res = - cvt(c::GetOverlappedResult(self.as_raw_handle(), overlapped, &mut bytes, wait)); - match res { - Ok(_) => Ok(bytes as usize), - Err(e) => { - if e.raw_os_error() == Some(c::ERROR_HANDLE_EOF as i32) - || e.raw_os_error() == Some(c::ERROR_BROKEN_PIPE as i32) - { - Ok(0) - } else { - Err(e) - } - } - } - } - } - - pub fn cancel_io(&self) -> io::Result<()> { - unsafe { cvt(c::CancelIo(self.as_raw_handle())).map(drop) } - } - - pub fn write(&self, buf: &[u8]) -> io::Result<usize> { - self.synchronous_write(buf, None) - } - - pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { - crate::io::default_write_vectored(|buf| self.write(buf), bufs) - } - - #[inline] - pub fn is_write_vectored(&self) -> bool { - false - } - - pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> { - self.synchronous_write(buf, Some(offset)) - } - - pub fn try_clone(&self) -> io::Result<Self> { - Ok(Self(self.0.try_clone()?)) - } - - pub fn duplicate( - &self, - access: c::DWORD, - inherit: bool, - options: c::DWORD, - ) -> io::Result<Self> { - Ok(Self(self.0.as_handle().duplicate(access, inherit, options)?)) - } - - /// Performs a synchronous read. - /// - /// If the handle is opened for asynchronous I/O then this abort the process. - /// See #81357. - /// - /// If `offset` is `None` then the current file position is used. - unsafe fn synchronous_read( - &self, - buf: *mut mem::MaybeUninit<u8>, - len: usize, - offset: Option<u64>, - ) -> io::Result<usize> { - let mut io_status = c::IO_STATUS_BLOCK::PENDING; - - // The length is clamped at u32::MAX. - let len = cmp::min(len, c::DWORD::MAX as usize) as c::DWORD; - let status = c::NtReadFile( - self.as_handle(), - ptr::null_mut(), - None, - ptr::null_mut(), - &mut io_status, - buf, - len, - offset.map(|n| n as _).as_ref(), - None, - ); - - let status = if status == c::STATUS_PENDING { - c::WaitForSingleObject(self.as_raw_handle(), c::INFINITE); - io_status.status() - } else { - status - }; - match status { - // If the operation has not completed then abort the process. - // Doing otherwise means that the buffer and stack may be written to - // after this function returns. - c::STATUS_PENDING => rtabort!("I/O error: operation failed to complete synchronously"), - - // Return `Ok(0)` when there's nothing more to read. - c::STATUS_END_OF_FILE => Ok(0), - - // Success! - status if c::nt_success(status) => Ok(io_status.Information), - - status => { - let error = c::RtlNtStatusToDosError(status); - Err(io::Error::from_raw_os_error(error as _)) - } - } - } - - /// Performs a synchronous write. - /// - /// If the handle is opened for asynchronous I/O then this abort the process. - /// See #81357. - /// - /// If `offset` is `None` then the current file position is used. - fn synchronous_write(&self, buf: &[u8], offset: Option<u64>) -> io::Result<usize> { - let mut io_status = c::IO_STATUS_BLOCK::PENDING; - - // The length is clamped at u32::MAX. - let len = cmp::min(buf.len(), c::DWORD::MAX as usize) as c::DWORD; - let status = unsafe { - c::NtWriteFile( - self.as_handle(), - ptr::null_mut(), - None, - ptr::null_mut(), - &mut io_status, - buf.as_ptr(), - len, - offset.map(|n| n as _).as_ref(), - None, - ) - }; - let status = if status == c::STATUS_PENDING { - unsafe { c::WaitForSingleObject(self.as_raw_handle(), c::INFINITE) }; - io_status.status() - } else { - status - }; - match status { - // If the operation has not completed then abort the process. - // Doing otherwise means that the buffer may be read and the stack - // written to after this function returns. - c::STATUS_PENDING => rtabort!("I/O error: operation failed to complete synchronously"), - - // Success! - status if c::nt_success(status) => Ok(io_status.Information), - - status => { - let error = unsafe { c::RtlNtStatusToDosError(status) }; - Err(io::Error::from_raw_os_error(error as _)) - } - } - } -} - -impl<'a> Read for &'a Handle { - fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { - (**self).read(buf) - } - - fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> { - (**self).read_buf(buf) - } - - fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { - (**self).read_vectored(bufs) - } - - #[inline] - fn is_read_vectored(&self) -> bool { - (**self).is_read_vectored() - } -} diff --git a/library/std/src/sys/windows/handle/tests.rs b/library/std/src/sys/windows/handle/tests.rs deleted file mode 100644 index d836dae4c30..00000000000 --- a/library/std/src/sys/windows/handle/tests.rs +++ /dev/null @@ -1,22 +0,0 @@ -use crate::sys::pipe::{anon_pipe, Pipes}; -use crate::{thread, time}; - -/// Test the synchronous fallback for overlapped I/O. -#[test] -fn overlapped_handle_fallback() { - // Create some pipes. `ours` will be asynchronous. - let Pipes { ours, theirs } = anon_pipe(true, false).unwrap(); - - let async_readable = ours.into_handle(); - let sync_writeable = theirs.into_handle(); - - thread::scope(|_| { - thread::sleep(time::Duration::from_millis(100)); - sync_writeable.write(b"hello world!").unwrap(); - }); - - // The pipe buffer starts empty so reading won't complete synchronously unless - // our fallback path works. - let mut buffer = [0u8; 1024]; - async_readable.read(&mut buffer).unwrap(); -} diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs deleted file mode 100644 index 649826d25ce..00000000000 --- a/library/std/src/sys/windows/io.rs +++ /dev/null @@ -1,161 +0,0 @@ -use crate::marker::PhantomData; -use crate::mem::size_of; -use crate::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle}; -use crate::slice; -use crate::sys::c; -use core::ffi::c_void; - -#[derive(Copy, Clone)] -#[repr(transparent)] -pub struct IoSlice<'a> { - vec: c::WSABUF, - _p: PhantomData<&'a [u8]>, -} - -impl<'a> IoSlice<'a> { - #[inline] - pub fn new(buf: &'a [u8]) -> IoSlice<'a> { - assert!(buf.len() <= c::ULONG::MAX as usize); - IoSlice { - vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_ptr() as *mut u8 }, - _p: PhantomData, - } - } - - #[inline] - pub fn advance(&mut self, n: usize) { - if (self.vec.len as usize) < n { - panic!("advancing IoSlice beyond its length"); - } - - unsafe { - self.vec.len -= n as c::ULONG; - self.vec.buf = self.vec.buf.add(n); - } - } - - #[inline] - pub fn as_slice(&self) -> &[u8] { - unsafe { slice::from_raw_parts(self.vec.buf, self.vec.len as usize) } - } -} - -#[repr(transparent)] -pub struct IoSliceMut<'a> { - vec: c::WSABUF, - _p: PhantomData<&'a mut [u8]>, -} - -impl<'a> IoSliceMut<'a> { - #[inline] - pub fn new(buf: &'a mut [u8]) -> IoSliceMut<'a> { - assert!(buf.len() <= c::ULONG::MAX as usize); - IoSliceMut { - vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_mut_ptr() }, - _p: PhantomData, - } - } - - #[inline] - pub fn advance(&mut self, n: usize) { - if (self.vec.len as usize) < n { - panic!("advancing IoSliceMut beyond its length"); - } - - unsafe { - self.vec.len -= n as c::ULONG; - self.vec.buf = self.vec.buf.add(n); - } - } - - #[inline] - pub fn as_slice(&self) -> &[u8] { - unsafe { slice::from_raw_parts(self.vec.buf, self.vec.len as usize) } - } - - #[inline] - pub fn as_mut_slice(&mut self) -> &mut [u8] { - unsafe { slice::from_raw_parts_mut(self.vec.buf, self.vec.len as usize) } - } -} - -pub fn is_terminal(h: &impl AsHandle) -> bool { - unsafe { handle_is_console(h.as_handle()) } -} - -unsafe fn handle_is_console(handle: BorrowedHandle<'_>) -> bool { - let handle = handle.as_raw_handle(); - - // A null handle means the process has no console. - if handle.is_null() { - return false; - } - - let mut out = 0; - if c::GetConsoleMode(handle, &mut out) != 0 { - // False positives aren't possible. If we got a console then we definitely have a console. - return true; - } - - // At this point, we *could* have a false negative. We can determine that this is a true - // negative if we can detect the presence of a console on any of the standard I/O streams. If - // another stream has a console, then we know we're in a Windows console and can therefore - // trust the negative. - for std_handle in [c::STD_INPUT_HANDLE, c::STD_OUTPUT_HANDLE, c::STD_ERROR_HANDLE] { - let std_handle = c::GetStdHandle(std_handle); - if !std_handle.is_null() - && std_handle != handle - && c::GetConsoleMode(std_handle, &mut out) != 0 - { - return false; - } - } - - // Otherwise, we fall back to an msys hack to see if we can detect the presence of a pty. - msys_tty_on(handle) -} - -unsafe fn msys_tty_on(handle: c::HANDLE) -> bool { - // Early return if the handle is not a pipe. - if c::GetFileType(handle) != c::FILE_TYPE_PIPE { - return false; - } - - /// Mirrors [`FILE_NAME_INFO`], giving it a fixed length that we can stack - /// allocate - /// - /// [`FILE_NAME_INFO`]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_name_info - #[repr(C)] - #[allow(non_snake_case)] - struct FILE_NAME_INFO { - FileNameLength: u32, - FileName: [u16; c::MAX_PATH as usize], - } - let mut name_info = FILE_NAME_INFO { FileNameLength: 0, FileName: [0; c::MAX_PATH as usize] }; - // Safety: buffer length is fixed. - let res = c::GetFileInformationByHandleEx( - handle, - c::FileNameInfo, - &mut name_info as *mut _ as *mut c_void, - size_of::<FILE_NAME_INFO>() as u32, - ); - if res == 0 { - return false; - } - - // Use `get` because `FileNameLength` can be out of range. - let s = match name_info.FileName.get(..name_info.FileNameLength as usize / 2) { - None => return false, - Some(s) => s, - }; - let name = String::from_utf16_lossy(s); - // Get the file name only. - let name = name.rsplit('\\').next().unwrap_or(&name); - // This checks whether 'pty' exists in the file name, which indicates that - // a pseudo-terminal is attached. To mitigate against false positives - // (e.g., an actual file name that contains 'pty'), we also require that - // the file name begins with either the strings 'msys-' or 'cygwin-'.) - let is_msys = name.starts_with("msys-") || name.starts_with("cygwin-"); - let is_pty = name.contains("-pty"); - is_msys && is_pty -} diff --git a/library/std/src/sys/windows/locks/condvar.rs b/library/std/src/sys/windows/locks/condvar.rs deleted file mode 100644 index 66fafa2c00b..00000000000 --- a/library/std/src/sys/windows/locks/condvar.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::cell::UnsafeCell; -use crate::sys::c; -use crate::sys::locks::{mutex, Mutex}; -use crate::sys::os; -use crate::time::Duration; - -pub struct Condvar { - inner: UnsafeCell<c::CONDITION_VARIABLE>, -} - -unsafe impl Send for Condvar {} -unsafe impl Sync for Condvar {} - -impl Condvar { - #[inline] - pub const fn new() -> Condvar { - Condvar { inner: UnsafeCell::new(c::CONDITION_VARIABLE_INIT) } - } - - #[inline] - pub unsafe fn wait(&self, mutex: &Mutex) { - let r = c::SleepConditionVariableSRW(self.inner.get(), mutex::raw(mutex), c::INFINITE, 0); - debug_assert!(r != 0); - } - - pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { - let r = c::SleepConditionVariableSRW( - self.inner.get(), - mutex::raw(mutex), - crate::sys::windows::dur2timeout(dur), - 0, - ); - if r == 0 { - debug_assert_eq!(os::errno() as usize, c::ERROR_TIMEOUT as usize); - false - } else { - true - } - } - - #[inline] - pub fn notify_one(&self) { - unsafe { c::WakeConditionVariable(self.inner.get()) } - } - - #[inline] - pub fn notify_all(&self) { - unsafe { c::WakeAllConditionVariable(self.inner.get()) } - } -} diff --git a/library/std/src/sys/windows/locks/mod.rs b/library/std/src/sys/windows/locks/mod.rs deleted file mode 100644 index 0e0f9eccb21..00000000000 --- a/library/std/src/sys/windows/locks/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -mod condvar; -mod mutex; -mod rwlock; -pub use condvar::Condvar; -pub use mutex::Mutex; -pub use rwlock::RwLock; diff --git a/library/std/src/sys/windows/locks/mutex.rs b/library/std/src/sys/windows/locks/mutex.rs deleted file mode 100644 index ef2f84082cd..00000000000 --- a/library/std/src/sys/windows/locks/mutex.rs +++ /dev/null @@ -1,54 +0,0 @@ -//! System Mutexes -//! -//! The Windows implementation of mutexes is a little odd and it might not be -//! immediately obvious what's going on. The primary oddness is that SRWLock is -//! used instead of CriticalSection, and this is done because: -//! -//! 1. SRWLock is several times faster than CriticalSection according to -//! benchmarks performed on both Windows 8 and Windows 7. -//! -//! 2. CriticalSection allows recursive locking while SRWLock deadlocks. The -//! Unix implementation deadlocks so consistency is preferred. See #19962 for -//! more details. -//! -//! 3. While CriticalSection is fair and SRWLock is not, the current Rust policy -//! is that there are no guarantees of fairness. - -use crate::cell::UnsafeCell; -use crate::sys::c; - -pub struct Mutex { - srwlock: UnsafeCell<c::SRWLOCK>, -} - -unsafe impl Send for Mutex {} -unsafe impl Sync for Mutex {} - -#[inline] -pub unsafe fn raw(m: &Mutex) -> c::PSRWLOCK { - m.srwlock.get() -} - -impl Mutex { - #[inline] - pub const fn new() -> Mutex { - Mutex { srwlock: UnsafeCell::new(c::SRWLOCK_INIT) } - } - - #[inline] - pub fn lock(&self) { - unsafe { - c::AcquireSRWLockExclusive(raw(self)); - } - } - - #[inline] - pub fn try_lock(&self) -> bool { - unsafe { c::TryAcquireSRWLockExclusive(raw(self)) != 0 } - } - - #[inline] - pub unsafe fn unlock(&self) { - c::ReleaseSRWLockExclusive(raw(self)); - } -} diff --git a/library/std/src/sys/windows/locks/rwlock.rs b/library/std/src/sys/windows/locks/rwlock.rs deleted file mode 100644 index e69415baac4..00000000000 --- a/library/std/src/sys/windows/locks/rwlock.rs +++ /dev/null @@ -1,40 +0,0 @@ -use crate::cell::UnsafeCell; -use crate::sys::c; - -pub struct RwLock { - inner: UnsafeCell<c::SRWLOCK>, -} - -unsafe impl Send for RwLock {} -unsafe impl Sync for RwLock {} - -impl RwLock { - #[inline] - pub const fn new() -> RwLock { - RwLock { inner: UnsafeCell::new(c::SRWLOCK_INIT) } - } - #[inline] - pub fn read(&self) { - unsafe { c::AcquireSRWLockShared(self.inner.get()) } - } - #[inline] - pub fn try_read(&self) -> bool { - unsafe { c::TryAcquireSRWLockShared(self.inner.get()) != 0 } - } - #[inline] - pub fn write(&self) { - unsafe { c::AcquireSRWLockExclusive(self.inner.get()) } - } - #[inline] - pub fn try_write(&self) -> bool { - unsafe { c::TryAcquireSRWLockExclusive(self.inner.get()) != 0 } - } - #[inline] - pub unsafe fn read_unlock(&self) { - c::ReleaseSRWLockShared(self.inner.get()) - } - #[inline] - pub unsafe fn write_unlock(&self) { - c::ReleaseSRWLockExclusive(self.inner.get()) - } -} diff --git a/library/std/src/sys/windows/memchr.rs b/library/std/src/sys/windows/memchr.rs deleted file mode 100644 index b9e5bcc1b4b..00000000000 --- a/library/std/src/sys/windows/memchr.rs +++ /dev/null @@ -1,5 +0,0 @@ -// Original implementation taken from rust-memchr. -// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch - -// Fallback memchr is fastest on Windows. -pub use core::slice::memchr::{memchr, memrchr}; diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs deleted file mode 100644 index 8b722f01a5d..00000000000 --- a/library/std/src/sys/windows/mod.rs +++ /dev/null @@ -1,357 +0,0 @@ -#![allow(missing_docs, nonstandard_style)] - -use crate::ffi::{OsStr, OsString}; -use crate::io::ErrorKind; -use crate::mem::MaybeUninit; -use crate::os::windows::ffi::{OsStrExt, OsStringExt}; -use crate::path::PathBuf; -use crate::time::Duration; - -pub use self::rand::hashmap_random_keys; - -#[macro_use] -pub mod compat; - -pub mod alloc; -pub mod args; -pub mod c; -pub mod cmath; -pub mod env; -pub mod fs; -pub mod handle; -pub mod io; -pub mod locks; -pub mod memchr; -pub mod net; -pub mod os; -pub mod os_str; -pub mod path; -pub mod pipe; -pub mod process; -pub mod rand; -pub mod stdio; -pub mod thread; -pub mod thread_local_dtor; -pub mod thread_local_key; -pub mod thread_parking; -pub mod time; -cfg_if::cfg_if! { - if #[cfg(not(target_vendor = "uwp"))] { - pub mod stack_overflow; - } else { - pub mod stack_overflow_uwp; - pub use self::stack_overflow_uwp as stack_overflow; - } -} - -mod api; - -/// Map a Result<T, WinError> to io::Result<T>. -trait IoResult<T> { - fn io_result(self) -> crate::io::Result<T>; -} -impl<T> IoResult<T> for Result<T, api::WinError> { - fn io_result(self) -> crate::io::Result<T> { - self.map_err(|e| crate::io::Error::from_raw_os_error(e.code as i32)) - } -} - -// SAFETY: must be called only once during runtime initialization. -// NOTE: this is not guaranteed to run, for example when Rust code is called externally. -pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) { - stack_overflow::init(); - - // Normally, `thread::spawn` will call `Thread::set_name` but since this thread already - // exists, we have to call it ourselves. - thread::Thread::set_name(&c"main"); -} - -// SAFETY: must be called only once during runtime cleanup. -// NOTE: this is not guaranteed to run, for example when the program aborts. -pub unsafe fn cleanup() { - net::cleanup(); -} - -#[inline] -pub fn is_interrupted(_errno: i32) -> bool { - false -} - -pub fn decode_error_kind(errno: i32) -> ErrorKind { - use ErrorKind::*; - - match errno as c::DWORD { - c::ERROR_ACCESS_DENIED => return PermissionDenied, - c::ERROR_ALREADY_EXISTS => return AlreadyExists, - c::ERROR_FILE_EXISTS => return AlreadyExists, - c::ERROR_BROKEN_PIPE => return BrokenPipe, - c::ERROR_FILE_NOT_FOUND - | c::ERROR_PATH_NOT_FOUND - | c::ERROR_INVALID_DRIVE - | c::ERROR_BAD_NETPATH - | c::ERROR_BAD_NET_NAME => return NotFound, - c::ERROR_NO_DATA => return BrokenPipe, - c::ERROR_INVALID_NAME | c::ERROR_BAD_PATHNAME => return InvalidFilename, - c::ERROR_INVALID_PARAMETER => return InvalidInput, - c::ERROR_NOT_ENOUGH_MEMORY | c::ERROR_OUTOFMEMORY => return OutOfMemory, - c::ERROR_SEM_TIMEOUT - | c::WAIT_TIMEOUT - | c::ERROR_DRIVER_CANCEL_TIMEOUT - | c::ERROR_OPERATION_ABORTED - | c::ERROR_SERVICE_REQUEST_TIMEOUT - | c::ERROR_COUNTER_TIMEOUT - | c::ERROR_TIMEOUT - | c::ERROR_RESOURCE_CALL_TIMED_OUT - | c::ERROR_CTX_MODEM_RESPONSE_TIMEOUT - | c::ERROR_CTX_CLIENT_QUERY_TIMEOUT - | c::FRS_ERR_SYSVOL_POPULATE_TIMEOUT - | c::ERROR_DS_TIMELIMIT_EXCEEDED - | c::DNS_ERROR_RECORD_TIMED_OUT - | c::ERROR_IPSEC_IKE_TIMED_OUT - | c::ERROR_RUNLEVEL_SWITCH_TIMEOUT - | c::ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT => return TimedOut, - c::ERROR_CALL_NOT_IMPLEMENTED => return Unsupported, - c::ERROR_HOST_UNREACHABLE => return HostUnreachable, - c::ERROR_NETWORK_UNREACHABLE => return NetworkUnreachable, - c::ERROR_DIRECTORY => return NotADirectory, - c::ERROR_DIRECTORY_NOT_SUPPORTED => return IsADirectory, - c::ERROR_DIR_NOT_EMPTY => return DirectoryNotEmpty, - c::ERROR_WRITE_PROTECT => return ReadOnlyFilesystem, - c::ERROR_DISK_FULL | c::ERROR_HANDLE_DISK_FULL => return StorageFull, - c::ERROR_SEEK_ON_DEVICE => return NotSeekable, - c::ERROR_DISK_QUOTA_EXCEEDED => return FilesystemQuotaExceeded, - c::ERROR_FILE_TOO_LARGE => return FileTooLarge, - c::ERROR_BUSY => return ResourceBusy, - c::ERROR_POSSIBLE_DEADLOCK => return Deadlock, - c::ERROR_NOT_SAME_DEVICE => return CrossesDevices, - c::ERROR_TOO_MANY_LINKS => return TooManyLinks, - c::ERROR_FILENAME_EXCED_RANGE => return InvalidFilename, - _ => {} - } - - match errno { - c::WSAEACCES => PermissionDenied, - c::WSAEADDRINUSE => AddrInUse, - c::WSAEADDRNOTAVAIL => AddrNotAvailable, - c::WSAECONNABORTED => ConnectionAborted, - c::WSAECONNREFUSED => ConnectionRefused, - c::WSAECONNRESET => ConnectionReset, - c::WSAEINVAL => InvalidInput, - c::WSAENOTCONN => NotConnected, - c::WSAEWOULDBLOCK => WouldBlock, - c::WSAETIMEDOUT => TimedOut, - c::WSAEHOSTUNREACH => HostUnreachable, - c::WSAENETDOWN => NetworkDown, - c::WSAENETUNREACH => NetworkUnreachable, - - _ => Uncategorized, - } -} - -pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> { - let ptr = haystack.as_ptr(); - let mut start = haystack; - - // For performance reasons unfold the loop eight times. - while start.len() >= 8 { - macro_rules! if_return { - ($($n:literal,)+) => { - $( - if start[$n] == needle { - return Some(((&start[$n] as *const u16).addr() - ptr.addr()) / 2); - } - )+ - } - } - - if_return!(0, 1, 2, 3, 4, 5, 6, 7,); - - start = &start[8..]; - } - - for c in start { - if *c == needle { - return Some(((c as *const u16).addr() - ptr.addr()) / 2); - } - } - None -} - -pub fn to_u16s<S: AsRef<OsStr>>(s: S) -> crate::io::Result<Vec<u16>> { - fn inner(s: &OsStr) -> crate::io::Result<Vec<u16>> { - // Most paths are ASCII, so reserve capacity for as much as there are bytes - // in the OsStr plus one for the null-terminating character. We are not - // wasting bytes here as paths created by this function are primarily used - // in an ephemeral fashion. - let mut maybe_result = Vec::with_capacity(s.len() + 1); - maybe_result.extend(s.encode_wide()); - - if unrolled_find_u16s(0, &maybe_result).is_some() { - return Err(crate::io::const_io_error!( - ErrorKind::InvalidInput, - "strings passed to WinAPI cannot contain NULs", - )); - } - maybe_result.push(0); - Ok(maybe_result) - } - inner(s.as_ref()) -} - -// Many Windows APIs follow a pattern of where we hand a buffer and then they -// will report back to us how large the buffer should be or how many bytes -// currently reside in the buffer. This function is an abstraction over these -// functions by making them easier to call. -// -// The first callback, `f1`, is yielded a (pointer, len) pair which can be -// passed to a syscall. The `ptr` is valid for `len` items (u16 in this case). -// The closure is expected to return what the syscall returns which will be -// interpreted by this function to determine if the syscall needs to be invoked -// again (with more buffer space). -// -// Once the syscall has completed (errors bail out early) the second closure is -// yielded the data which has been read from the syscall. The return value -// from this closure is then the return value of the function. -fn fill_utf16_buf<F1, F2, T>(mut f1: F1, f2: F2) -> crate::io::Result<T> -where - F1: FnMut(*mut u16, c::DWORD) -> c::DWORD, - F2: FnOnce(&[u16]) -> T, -{ - // Start off with a stack buf but then spill over to the heap if we end up - // needing more space. - // - // This initial size also works around `GetFullPathNameW` returning - // incorrect size hints for some short paths: - // https://github.com/dylni/normpath/issues/5 - let mut stack_buf: [MaybeUninit<u16>; 512] = MaybeUninit::uninit_array(); - let mut heap_buf: Vec<MaybeUninit<u16>> = Vec::new(); - unsafe { - let mut n = stack_buf.len(); - loop { - let buf = if n <= stack_buf.len() { - &mut stack_buf[..] - } else { - let extra = n - heap_buf.len(); - heap_buf.reserve(extra); - // We used `reserve` and not `reserve_exact`, so in theory we - // may have gotten more than requested. If so, we'd like to use - // it... so long as we won't cause overflow. - n = heap_buf.capacity().min(c::DWORD::MAX as usize); - // Safety: MaybeUninit<u16> does not need initialization - heap_buf.set_len(n); - &mut heap_buf[..] - }; - - // This function is typically called on windows API functions which - // will return the correct length of the string, but these functions - // also return the `0` on error. In some cases, however, the - // returned "correct length" may actually be 0! - // - // To handle this case we call `SetLastError` to reset it to 0 and - // then check it again if we get the "0 error value". If the "last - // error" is still 0 then we interpret it as a 0 length buffer and - // not an actual error. - c::SetLastError(0); - let k = match f1(buf.as_mut_ptr().cast::<u16>(), n as c::DWORD) { - 0 if api::get_last_error().code == 0 => 0, - 0 => return Err(crate::io::Error::last_os_error()), - n => n, - } as usize; - if k == n && api::get_last_error().code == c::ERROR_INSUFFICIENT_BUFFER { - n = n.saturating_mul(2).min(c::DWORD::MAX as usize); - } else if k > n { - n = k; - } else if k == n { - // It is impossible to reach this point. - // On success, k is the returned string length excluding the null. - // On failure, k is the required buffer length including the null. - // Therefore k never equals n. - unreachable!(); - } else { - // Safety: First `k` values are initialized. - let slice: &[u16] = MaybeUninit::slice_assume_init_ref(&buf[..k]); - return Ok(f2(slice)); - } - } - } -} - -fn os2path(s: &[u16]) -> PathBuf { - PathBuf::from(OsString::from_wide(s)) -} - -pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] { - match unrolled_find_u16s(0, v) { - // don't include the 0 - Some(i) => &v[..i], - None => v, - } -} - -pub trait IsZero { - fn is_zero(&self) -> bool; -} - -macro_rules! impl_is_zero { - ($($t:ident)*) => ($(impl IsZero for $t { - fn is_zero(&self) -> bool { - *self == 0 - } - })*) -} - -impl_is_zero! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } - -pub fn cvt<I: IsZero>(i: I) -> crate::io::Result<I> { - if i.is_zero() { Err(crate::io::Error::last_os_error()) } else { Ok(i) } -} - -pub fn dur2timeout(dur: Duration) -> c::DWORD { - // Note that a duration is a (u64, u32) (seconds, nanoseconds) pair, and the - // timeouts in windows APIs are typically u32 milliseconds. To translate, we - // have two pieces to take care of: - // - // * Nanosecond precision is rounded up - // * Greater than u32::MAX milliseconds (50 days) is rounded up to INFINITE - // (never time out). - dur.as_secs() - .checked_mul(1000) - .and_then(|ms| ms.checked_add((dur.subsec_nanos() as u64) / 1_000_000)) - .and_then(|ms| ms.checked_add(if dur.subsec_nanos() % 1_000_000 > 0 { 1 } else { 0 })) - .map(|ms| if ms > <c::DWORD>::MAX as u64 { c::INFINITE } else { ms as c::DWORD }) - .unwrap_or(c::INFINITE) -} - -/// Use `__fastfail` to abort the process -/// -/// This is the same implementation as in libpanic_abort's `__rust_start_panic`. See -/// that function for more information on `__fastfail` -#[allow(unreachable_code)] -pub fn abort_internal() -> ! { - #[allow(unused)] - const FAST_FAIL_FATAL_APP_EXIT: usize = 7; - #[cfg(not(miri))] // inline assembly does not work in Miri - unsafe { - cfg_if::cfg_if! { - if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - core::arch::asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT); - crate::intrinsics::unreachable(); - } else if #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] { - core::arch::asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT); - crate::intrinsics::unreachable(); - } else if #[cfg(target_arch = "aarch64")] { - core::arch::asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT); - crate::intrinsics::unreachable(); - } - } - } - crate::intrinsics::abort(); -} - -/// Align the inner value to 8 bytes. -/// -/// This is enough for almost all of the buffers we're likely to work with in -/// the Windows APIs we use. -#[repr(C, align(8))] -#[derive(Copy, Clone)] -pub(crate) struct Align8<T: ?Sized>(pub T); diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/windows/net.rs deleted file mode 100644 index 6cd758ec5c3..00000000000 --- a/library/std/src/sys/windows/net.rs +++ /dev/null @@ -1,497 +0,0 @@ -#![unstable(issue = "none", feature = "windows_net")] - -use crate::cmp; -use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut, Read}; -use crate::mem; -use crate::net::{Shutdown, SocketAddr}; -use crate::os::windows::io::{ - AsRawSocket, AsSocket, BorrowedSocket, FromRawSocket, IntoRawSocket, OwnedSocket, RawSocket, -}; -use crate::ptr; -use crate::sync::OnceLock; -use crate::sys; -use crate::sys::c; -use crate::sys_common::net; -use crate::sys_common::{AsInner, FromInner, IntoInner}; -use crate::time::Duration; - -use core::ffi::{c_int, c_long, c_ulong, c_ushort}; - -pub type wrlen_t = i32; - -pub mod netc { - pub use crate::sys::c::ADDRESS_FAMILY as sa_family_t; - pub use crate::sys::c::ADDRINFOA as addrinfo; - pub use crate::sys::c::SOCKADDR as sockaddr; - pub use crate::sys::c::SOCKADDR_STORAGE_LH as sockaddr_storage; - pub use crate::sys::c::*; -} - -pub struct Socket(OwnedSocket); - -static WSA_CLEANUP: OnceLock<unsafe extern "system" fn() -> i32> = OnceLock::new(); - -/// Checks whether the Windows socket interface has been started already, and -/// if not, starts it. -pub fn init() { - let _ = WSA_CLEANUP.get_or_init(|| unsafe { - let mut data: c::WSADATA = mem::zeroed(); - let ret = c::WSAStartup( - 0x202, // version 2.2 - &mut data, - ); - assert_eq!(ret, 0); - - // Only register `WSACleanup` if `WSAStartup` is actually ever called. - // Workaround to prevent linking to `WS2_32.dll` when no network functionality is used. - // See issue #85441. - c::WSACleanup - }); -} - -pub fn cleanup() { - // only perform cleanup if network functionality was actually initialized - if let Some(cleanup) = WSA_CLEANUP.get() { - unsafe { - cleanup(); - } - } -} - -/// Returns the last error from the Windows socket interface. -fn last_error() -> io::Error { - io::Error::from_raw_os_error(unsafe { c::WSAGetLastError() }) -} - -#[doc(hidden)] -pub trait IsMinusOne { - fn is_minus_one(&self) -> bool; -} - -macro_rules! impl_is_minus_one { - ($($t:ident)*) => ($(impl IsMinusOne for $t { - fn is_minus_one(&self) -> bool { - *self == -1 - } - })*) -} - -impl_is_minus_one! { i8 i16 i32 i64 isize } - -/// Checks if the signed integer is the Windows constant `SOCKET_ERROR` (-1) -/// and if so, returns the last error from the Windows socket interface. This -/// function must be called before another call to the socket API is made. -pub fn cvt<T: IsMinusOne>(t: T) -> io::Result<T> { - if t.is_minus_one() { Err(last_error()) } else { Ok(t) } -} - -/// A variant of `cvt` for `getaddrinfo` which return 0 for a success. -pub fn cvt_gai(err: c_int) -> io::Result<()> { - if err == 0 { Ok(()) } else { Err(last_error()) } -} - -/// Just to provide the same interface as sys/unix/net.rs -pub fn cvt_r<T, F>(mut f: F) -> io::Result<T> -where - T: IsMinusOne, - F: FnMut() -> T, -{ - cvt(f()) -} - -impl Socket { - pub fn new(addr: &SocketAddr, ty: c_int) -> io::Result<Socket> { - let family = match *addr { - SocketAddr::V4(..) => c::AF_INET, - SocketAddr::V6(..) => c::AF_INET6, - }; - let socket = unsafe { - c::WSASocketW( - family, - ty, - 0, - ptr::null_mut(), - 0, - c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT, - ) - }; - - if socket != c::INVALID_SOCKET { - unsafe { Ok(Self::from_raw(socket)) } - } else { - let error = unsafe { c::WSAGetLastError() }; - - if error != c::WSAEPROTOTYPE && error != c::WSAEINVAL { - return Err(io::Error::from_raw_os_error(error)); - } - - let socket = - unsafe { c::WSASocketW(family, ty, 0, ptr::null_mut(), 0, c::WSA_FLAG_OVERLAPPED) }; - - if socket == c::INVALID_SOCKET { - return Err(last_error()); - } - - unsafe { - let socket = Self::from_raw(socket); - socket.0.set_no_inherit()?; - Ok(socket) - } - } - } - - pub fn connect(&self, addr: &SocketAddr) -> io::Result<()> { - let (addr, len) = addr.into_inner(); - let result = unsafe { c::connect(self.as_raw(), addr.as_ptr(), len) }; - cvt(result).map(drop) - } - - pub fn connect_timeout(&self, addr: &SocketAddr, timeout: Duration) -> io::Result<()> { - self.set_nonblocking(true)?; - let result = self.connect(addr); - self.set_nonblocking(false)?; - - match result { - Err(ref error) if error.kind() == io::ErrorKind::WouldBlock => { - if timeout.as_secs() == 0 && timeout.subsec_nanos() == 0 { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "cannot set a 0 duration timeout", - )); - } - - let mut timeout = c::timeval { - tv_sec: cmp::min(timeout.as_secs(), c_long::MAX as u64) as c_long, - tv_usec: timeout.subsec_micros() as c_long, - }; - - if timeout.tv_sec == 0 && timeout.tv_usec == 0 { - timeout.tv_usec = 1; - } - - let fds = { - let mut fds = unsafe { mem::zeroed::<c::fd_set>() }; - fds.fd_count = 1; - fds.fd_array[0] = self.as_raw(); - fds - }; - - let mut writefds = fds; - let mut errorfds = fds; - - let count = { - let result = unsafe { - c::select(1, ptr::null_mut(), &mut writefds, &mut errorfds, &timeout) - }; - cvt(result)? - }; - - match count { - 0 => Err(io::const_io_error!(io::ErrorKind::TimedOut, "connection timed out")), - _ => { - if writefds.fd_count != 1 { - if let Some(e) = self.take_error()? { - return Err(e); - } - } - - Ok(()) - } - } - } - _ => result, - } - } - - pub fn accept(&self, storage: *mut c::SOCKADDR, len: *mut c_int) -> io::Result<Socket> { - let socket = unsafe { c::accept(self.as_raw(), storage, len) }; - - match socket { - c::INVALID_SOCKET => Err(last_error()), - _ => unsafe { Ok(Self::from_raw(socket)) }, - } - } - - pub fn duplicate(&self) -> io::Result<Socket> { - Ok(Self(self.0.try_clone()?)) - } - - fn recv_with_flags(&self, mut buf: BorrowedCursor<'_>, flags: c_int) -> io::Result<()> { - // On unix when a socket is shut down all further reads return 0, so we - // do the same on windows to map a shut down socket to returning EOF. - let length = cmp::min(buf.capacity(), i32::MAX as usize) as i32; - let result = - unsafe { c::recv(self.as_raw(), buf.as_mut().as_mut_ptr() as *mut _, length, flags) }; - - match result { - c::SOCKET_ERROR => { - let error = unsafe { c::WSAGetLastError() }; - - if error == c::WSAESHUTDOWN { - Ok(()) - } else { - Err(io::Error::from_raw_os_error(error)) - } - } - _ => { - unsafe { buf.advance(result as usize) }; - Ok(()) - } - } - } - - pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> { - let mut buf = BorrowedBuf::from(buf); - self.recv_with_flags(buf.unfilled(), 0)?; - Ok(buf.len()) - } - - pub fn read_buf(&self, buf: BorrowedCursor<'_>) -> io::Result<()> { - self.recv_with_flags(buf, 0) - } - - pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { - // On unix when a socket is shut down all further reads return 0, so we - // do the same on windows to map a shut down socket to returning EOF. - let length = cmp::min(bufs.len(), c::DWORD::MAX as usize) as c::DWORD; - let mut nread = 0; - let mut flags = 0; - let result = unsafe { - c::WSARecv( - self.as_raw(), - bufs.as_mut_ptr() as *mut c::WSABUF, - length, - &mut nread, - &mut flags, - ptr::null_mut(), - None, - ) - }; - - match result { - 0 => Ok(nread as usize), - _ => { - let error = unsafe { c::WSAGetLastError() }; - - if error == c::WSAESHUTDOWN { - Ok(0) - } else { - Err(io::Error::from_raw_os_error(error)) - } - } - } - } - - #[inline] - pub fn is_read_vectored(&self) -> bool { - true - } - - pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> { - let mut buf = BorrowedBuf::from(buf); - self.recv_with_flags(buf.unfilled(), c::MSG_PEEK)?; - Ok(buf.len()) - } - - fn recv_from_with_flags( - &self, - buf: &mut [u8], - flags: c_int, - ) -> io::Result<(usize, SocketAddr)> { - let mut storage = unsafe { mem::zeroed::<c::SOCKADDR_STORAGE_LH>() }; - let mut addrlen = mem::size_of_val(&storage) as c::socklen_t; - let length = cmp::min(buf.len(), <wrlen_t>::MAX as usize) as wrlen_t; - - // On unix when a socket is shut down all further reads return 0, so we - // do the same on windows to map a shut down socket to returning EOF. - let result = unsafe { - c::recvfrom( - self.as_raw(), - buf.as_mut_ptr() as *mut _, - length, - flags, - &mut storage as *mut _ as *mut _, - &mut addrlen, - ) - }; - - match result { - c::SOCKET_ERROR => { - let error = unsafe { c::WSAGetLastError() }; - - if error == c::WSAESHUTDOWN { - Ok((0, net::sockaddr_to_addr(&storage, addrlen as usize)?)) - } else { - Err(io::Error::from_raw_os_error(error)) - } - } - _ => Ok((result as usize, net::sockaddr_to_addr(&storage, addrlen as usize)?)), - } - } - - pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> { - self.recv_from_with_flags(buf, 0) - } - - pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> { - self.recv_from_with_flags(buf, c::MSG_PEEK) - } - - pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { - let length = cmp::min(bufs.len(), c::DWORD::MAX as usize) as c::DWORD; - let mut nwritten = 0; - let result = unsafe { - c::WSASend( - self.as_raw(), - bufs.as_ptr() as *const c::WSABUF as *mut _, - length, - &mut nwritten, - 0, - ptr::null_mut(), - None, - ) - }; - cvt(result).map(|_| nwritten as usize) - } - - #[inline] - pub fn is_write_vectored(&self) -> bool { - true - } - - pub fn set_timeout(&self, dur: Option<Duration>, kind: c_int) -> io::Result<()> { - let timeout = match dur { - Some(dur) => { - let timeout = sys::dur2timeout(dur); - if timeout == 0 { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "cannot set a 0 duration timeout", - )); - } - timeout - } - None => 0, - }; - net::setsockopt(self, c::SOL_SOCKET, kind, timeout) - } - - pub fn timeout(&self, kind: c_int) -> io::Result<Option<Duration>> { - let raw: c::DWORD = net::getsockopt(self, c::SOL_SOCKET, kind)?; - if raw == 0 { - Ok(None) - } else { - let secs = raw / 1000; - let nsec = (raw % 1000) * 1000000; - Ok(Some(Duration::new(secs as u64, nsec as u32))) - } - } - - pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { - let how = match how { - Shutdown::Write => c::SD_SEND, - Shutdown::Read => c::SD_RECEIVE, - Shutdown::Both => c::SD_BOTH, - }; - let result = unsafe { c::shutdown(self.as_raw(), how) }; - cvt(result).map(drop) - } - - pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { - let mut nonblocking = nonblocking as c_ulong; - let result = - unsafe { c::ioctlsocket(self.as_raw(), c::FIONBIO as c_int, &mut nonblocking) }; - cvt(result).map(drop) - } - - pub fn set_linger(&self, linger: Option<Duration>) -> io::Result<()> { - let linger = c::linger { - l_onoff: linger.is_some() as c_ushort, - l_linger: linger.unwrap_or_default().as_secs() as c_ushort, - }; - - net::setsockopt(self, c::SOL_SOCKET, c::SO_LINGER, linger) - } - - pub fn linger(&self) -> io::Result<Option<Duration>> { - let val: c::linger = net::getsockopt(self, c::SOL_SOCKET, c::SO_LINGER)?; - - Ok((val.l_onoff != 0).then(|| Duration::from_secs(val.l_linger as u64))) - } - - pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> { - net::setsockopt(self, c::IPPROTO_TCP, c::TCP_NODELAY, nodelay as c::BOOL) - } - - pub fn nodelay(&self) -> io::Result<bool> { - let raw: c::BOOL = net::getsockopt(self, c::IPPROTO_TCP, c::TCP_NODELAY)?; - Ok(raw != 0) - } - - pub fn take_error(&self) -> io::Result<Option<io::Error>> { - let raw: c_int = net::getsockopt(self, c::SOL_SOCKET, c::SO_ERROR)?; - if raw == 0 { Ok(None) } else { Ok(Some(io::Error::from_raw_os_error(raw as i32))) } - } - - // This is used by sys_common code to abstract over Windows and Unix. - pub fn as_raw(&self) -> c::SOCKET { - debug_assert_eq!(mem::size_of::<c::SOCKET>(), mem::size_of::<RawSocket>()); - debug_assert_eq!(mem::align_of::<c::SOCKET>(), mem::align_of::<RawSocket>()); - self.as_inner().as_raw_socket() as c::SOCKET - } - pub unsafe fn from_raw(raw: c::SOCKET) -> Self { - debug_assert_eq!(mem::size_of::<c::SOCKET>(), mem::size_of::<RawSocket>()); - debug_assert_eq!(mem::align_of::<c::SOCKET>(), mem::align_of::<RawSocket>()); - Self::from_raw_socket(raw as RawSocket) - } -} - -#[unstable(reason = "not public", issue = "none", feature = "fd_read")] -impl<'a> Read for &'a Socket { - fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { - (**self).read(buf) - } -} - -impl AsInner<OwnedSocket> for Socket { - #[inline] - fn as_inner(&self) -> &OwnedSocket { - &self.0 - } -} - -impl FromInner<OwnedSocket> for Socket { - fn from_inner(sock: OwnedSocket) -> Socket { - Socket(sock) - } -} - -impl IntoInner<OwnedSocket> for Socket { - fn into_inner(self) -> OwnedSocket { - self.0 - } -} - -impl AsSocket for Socket { - fn as_socket(&self) -> BorrowedSocket<'_> { - self.0.as_socket() - } -} - -impl AsRawSocket for Socket { - fn as_raw_socket(&self) -> RawSocket { - self.0.as_raw_socket() - } -} - -impl IntoRawSocket for Socket { - fn into_raw_socket(self) -> RawSocket { - self.0.into_raw_socket() - } -} - -impl FromRawSocket for Socket { - unsafe fn from_raw_socket(raw_socket: RawSocket) -> Self { - Self(FromRawSocket::from_raw_socket(raw_socket)) - } -} diff --git a/library/std/src/sys/windows/os.rs b/library/std/src/sys/windows/os.rs deleted file mode 100644 index 829dd5eb97a..00000000000 --- a/library/std/src/sys/windows/os.rs +++ /dev/null @@ -1,368 +0,0 @@ -//! Implementation of `std::os` functionality for Windows. - -#![allow(nonstandard_style)] - -#[cfg(test)] -mod tests; - -use crate::os::windows::prelude::*; - -use crate::error::Error as StdError; -use crate::ffi::{OsStr, OsString}; -use crate::fmt; -use crate::io; -use crate::os::windows::ffi::EncodeWide; -use crate::path::{self, PathBuf}; -use crate::ptr; -use crate::slice; -use crate::sys::{c, cvt}; - -use super::{api, to_u16s}; - -pub fn errno() -> i32 { - api::get_last_error().code as i32 -} - -/// Gets a detailed string description for the given error number. -pub fn error_string(mut errnum: i32) -> String { - let mut buf = [0 as c::WCHAR; 2048]; - - unsafe { - let mut module = ptr::null_mut(); - let mut flags = 0; - - // NTSTATUS errors may be encoded as HRESULT, which may returned from - // GetLastError. For more information about Windows error codes, see - // `[MS-ERREF]`: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a - if (errnum & c::FACILITY_NT_BIT as i32) != 0 { - // format according to https://support.microsoft.com/en-us/help/259693 - const NTDLL_DLL: &[u16] = &[ - 'N' as _, 'T' as _, 'D' as _, 'L' as _, 'L' as _, '.' as _, 'D' as _, 'L' as _, - 'L' as _, 0, - ]; - module = c::GetModuleHandleW(NTDLL_DLL.as_ptr()); - - if !module.is_null() { - errnum ^= c::FACILITY_NT_BIT as i32; - flags = c::FORMAT_MESSAGE_FROM_HMODULE; - } - } - - let res = c::FormatMessageW( - flags | c::FORMAT_MESSAGE_FROM_SYSTEM | c::FORMAT_MESSAGE_IGNORE_INSERTS, - module, - errnum as c::DWORD, - 0, - buf.as_mut_ptr(), - buf.len() as c::DWORD, - ptr::null(), - ) as usize; - if res == 0 { - // Sometimes FormatMessageW can fail e.g., system doesn't like 0 as langId, - let fm_err = errno(); - return format!("OS Error {errnum} (FormatMessageW() returned error {fm_err})"); - } - - match String::from_utf16(&buf[..res]) { - Ok(mut msg) => { - // Trim trailing CRLF inserted by FormatMessageW - let len = msg.trim_end().len(); - msg.truncate(len); - msg - } - Err(..) => format!( - "OS Error {} (FormatMessageW() returned \ - invalid UTF-16)", - errnum - ), - } - } -} - -pub struct Env { - base: c::LPWCH, - iter: EnvIterator, -} - -// FIXME(https://github.com/rust-lang/rust/issues/114583): Remove this when <OsStr as Debug>::fmt matches <str as Debug>::fmt. -pub struct EnvStrDebug<'a> { - iter: &'a EnvIterator, -} - -impl fmt::Debug for EnvStrDebug<'_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let Self { iter } = self; - let iter: EnvIterator = (*iter).clone(); - let mut list = f.debug_list(); - for (a, b) in iter { - list.entry(&(a.to_str().unwrap(), b.to_str().unwrap())); - } - list.finish() - } -} - -impl Env { - pub fn str_debug(&self) -> impl fmt::Debug + '_ { - let Self { base: _, iter } = self; - EnvStrDebug { iter } - } -} - -impl fmt::Debug for Env { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let Self { base: _, iter } = self; - f.debug_list().entries(iter.clone()).finish() - } -} - -impl Iterator for Env { - type Item = (OsString, OsString); - - fn next(&mut self) -> Option<(OsString, OsString)> { - let Self { base: _, iter } = self; - iter.next() - } -} - -#[derive(Clone)] -struct EnvIterator(c::LPWCH); - -impl Iterator for EnvIterator { - type Item = (OsString, OsString); - - fn next(&mut self) -> Option<(OsString, OsString)> { - let Self(cur) = self; - loop { - unsafe { - if **cur == 0 { - return None; - } - let p = *cur as *const u16; - let mut len = 0; - while *p.add(len) != 0 { - len += 1; - } - let s = slice::from_raw_parts(p, len); - *cur = cur.add(len + 1); - - // Windows allows environment variables to start with an equals - // symbol (in any other position, this is the separator between - // variable name and value). Since`s` has at least length 1 at - // this point (because the empty string terminates the array of - // environment variables), we can safely slice. - let pos = match s[1..].iter().position(|&u| u == b'=' as u16).map(|p| p + 1) { - Some(p) => p, - None => continue, - }; - return Some(( - OsStringExt::from_wide(&s[..pos]), - OsStringExt::from_wide(&s[pos + 1..]), - )); - } - } - } -} - -impl Drop for Env { - fn drop(&mut self) { - unsafe { - c::FreeEnvironmentStringsW(self.base); - } - } -} - -pub fn env() -> Env { - unsafe { - let ch = c::GetEnvironmentStringsW(); - if ch.is_null() { - panic!("failure getting env string from OS: {}", io::Error::last_os_error()); - } - Env { base: ch, iter: EnvIterator(ch) } - } -} - -pub struct SplitPaths<'a> { - data: EncodeWide<'a>, - must_yield: bool, -} - -pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> { - SplitPaths { data: unparsed.encode_wide(), must_yield: true } -} - -impl<'a> Iterator for SplitPaths<'a> { - type Item = PathBuf; - fn next(&mut self) -> Option<PathBuf> { - // On Windows, the PATH environment variable is semicolon separated. - // Double quotes are used as a way of introducing literal semicolons - // (since c:\some;dir is a valid Windows path). Double quotes are not - // themselves permitted in path names, so there is no way to escape a - // double quote. Quoted regions can appear in arbitrary locations, so - // - // c:\foo;c:\som"e;di"r;c:\bar - // - // Should parse as [c:\foo, c:\some;dir, c:\bar]. - // - // (The above is based on testing; there is no clear reference available - // for the grammar.) - - let must_yield = self.must_yield; - self.must_yield = false; - - let mut in_progress = Vec::new(); - let mut in_quote = false; - for b in self.data.by_ref() { - if b == '"' as u16 { - in_quote = !in_quote; - } else if b == ';' as u16 && !in_quote { - self.must_yield = true; - break; - } else { - in_progress.push(b) - } - } - - if !must_yield && in_progress.is_empty() { - None - } else { - Some(super::os2path(&in_progress)) - } - } -} - -#[derive(Debug)] -pub struct JoinPathsError; - -pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> -where - I: Iterator<Item = T>, - T: AsRef<OsStr>, -{ - let mut joined = Vec::new(); - let sep = b';' as u16; - - for (i, path) in paths.enumerate() { - let path = path.as_ref(); - if i > 0 { - joined.push(sep) - } - let v = path.encode_wide().collect::<Vec<u16>>(); - if v.contains(&(b'"' as u16)) { - return Err(JoinPathsError); - } else if v.contains(&sep) { - joined.push(b'"' as u16); - joined.extend_from_slice(&v[..]); - joined.push(b'"' as u16); - } else { - joined.extend_from_slice(&v[..]); - } - } - - Ok(OsStringExt::from_wide(&joined[..])) -} - -impl fmt::Display for JoinPathsError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - "path segment contains `\"`".fmt(f) - } -} - -impl StdError for JoinPathsError { - #[allow(deprecated)] - fn description(&self) -> &str { - "failed to join paths" - } -} - -pub fn current_exe() -> io::Result<PathBuf> { - super::fill_utf16_buf( - |buf, sz| unsafe { c::GetModuleFileNameW(ptr::null_mut(), buf, sz) }, - super::os2path, - ) -} - -pub fn getcwd() -> io::Result<PathBuf> { - super::fill_utf16_buf(|buf, sz| unsafe { c::GetCurrentDirectoryW(sz, buf) }, super::os2path) -} - -pub fn chdir(p: &path::Path) -> io::Result<()> { - let p: &OsStr = p.as_ref(); - let mut p = p.encode_wide().collect::<Vec<_>>(); - p.push(0); - - cvt(unsafe { c::SetCurrentDirectoryW(p.as_ptr()) }).map(drop) -} - -pub fn getenv(k: &OsStr) -> Option<OsString> { - let k = to_u16s(k).ok()?; - super::fill_utf16_buf( - |buf, sz| unsafe { c::GetEnvironmentVariableW(k.as_ptr(), buf, sz) }, - OsStringExt::from_wide, - ) - .ok() -} - -pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> { - let k = to_u16s(k)?; - let v = to_u16s(v)?; - - cvt(unsafe { c::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr()) }).map(drop) -} - -pub fn unsetenv(n: &OsStr) -> io::Result<()> { - let v = to_u16s(n)?; - cvt(unsafe { c::SetEnvironmentVariableW(v.as_ptr(), ptr::null()) }).map(drop) -} - -pub fn temp_dir() -> PathBuf { - super::fill_utf16_buf(|buf, sz| unsafe { c::GetTempPath2W(sz, buf) }, super::os2path).unwrap() -} - -#[cfg(not(target_vendor = "uwp"))] -fn home_dir_crt() -> Option<PathBuf> { - unsafe { - // The magic constant -4 can be used as the token passed to GetUserProfileDirectoryW below - // instead of us having to go through these multiple steps to get a token. However this is - // not implemented on Windows 7, only Windows 8 and up. When we drop support for Windows 7 - // we can simplify this code. See #90144 for details. - use crate::sys::handle::Handle; - - let me = c::GetCurrentProcess(); - let mut token = ptr::null_mut(); - if c::OpenProcessToken(me, c::TOKEN_READ, &mut token) == 0 { - return None; - } - let _handle = Handle::from_raw_handle(token); - super::fill_utf16_buf( - |buf, mut sz| { - match c::GetUserProfileDirectoryW(token, buf, &mut sz) { - 0 if api::get_last_error().code != c::ERROR_INSUFFICIENT_BUFFER => 0, - 0 => sz, - _ => sz - 1, // sz includes the null terminator - } - }, - super::os2path, - ) - .ok() - } -} - -#[cfg(target_vendor = "uwp")] -fn home_dir_crt() -> Option<PathBuf> { - None -} - -pub fn home_dir() -> Option<PathBuf> { - crate::env::var_os("HOME") - .or_else(|| crate::env::var_os("USERPROFILE")) - .map(PathBuf::from) - .or_else(home_dir_crt) -} - -pub fn exit(code: i32) -> ! { - unsafe { c::ExitProcess(code as c::UINT) } -} - -pub fn getpid() -> u32 { - unsafe { c::GetCurrentProcessId() } -} diff --git a/library/std/src/sys/windows/os/tests.rs b/library/std/src/sys/windows/os/tests.rs deleted file mode 100644 index 458d6e11c20..00000000000 --- a/library/std/src/sys/windows/os/tests.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::io::Error; -use crate::sys::c; - -// tests `error_string` above -#[test] -fn ntstatus_error() { - const STATUS_UNSUCCESSFUL: u32 = 0xc000_0001; - assert!( - !Error::from_raw_os_error((STATUS_UNSUCCESSFUL | c::FACILITY_NT_BIT) as _) - .to_string() - .contains("FormatMessageW() returned error") - ); -} diff --git a/library/std/src/sys/windows/os_str.rs b/library/std/src/sys/windows/os_str.rs deleted file mode 100644 index 237854fac4e..00000000000 --- a/library/std/src/sys/windows/os_str.rs +++ /dev/null @@ -1,245 +0,0 @@ -/// The underlying OsString/OsStr implementation on Windows is a -/// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. -use crate::borrow::Cow; -use crate::collections::TryReserveError; -use crate::fmt; -use crate::mem; -use crate::rc::Rc; -use crate::sync::Arc; -use crate::sys_common::wtf8::{Wtf8, Wtf8Buf}; -use crate::sys_common::{AsInner, FromInner, IntoInner}; - -#[derive(Clone, Hash)] -pub struct Buf { - pub inner: Wtf8Buf, -} - -impl IntoInner<Wtf8Buf> for Buf { - fn into_inner(self) -> Wtf8Buf { - self.inner - } -} - -impl FromInner<Wtf8Buf> for Buf { - fn from_inner(inner: Wtf8Buf) -> Self { - Buf { inner } - } -} - -impl AsInner<Wtf8> for Buf { - #[inline] - fn as_inner(&self) -> &Wtf8 { - &self.inner - } -} - -impl fmt::Debug for Buf { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(self.as_slice(), formatter) - } -} - -impl fmt::Display for Buf { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(self.as_slice(), formatter) - } -} - -#[repr(transparent)] -pub struct Slice { - pub inner: Wtf8, -} - -impl fmt::Debug for Slice { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.inner, formatter) - } -} - -impl fmt::Display for Slice { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(&self.inner, formatter) - } -} - -impl Buf { - #[inline] - pub fn into_encoded_bytes(self) -> Vec<u8> { - self.inner.into_bytes() - } - - #[inline] - pub unsafe fn from_encoded_bytes_unchecked(s: Vec<u8>) -> Self { - Self { inner: Wtf8Buf::from_bytes_unchecked(s) } - } - - pub fn with_capacity(capacity: usize) -> Buf { - Buf { inner: Wtf8Buf::with_capacity(capacity) } - } - - pub fn clear(&mut self) { - self.inner.clear() - } - - pub fn capacity(&self) -> usize { - self.inner.capacity() - } - - pub fn from_string(s: String) -> Buf { - Buf { inner: Wtf8Buf::from_string(s) } - } - - pub fn as_slice(&self) -> &Slice { - // SAFETY: Slice is just a wrapper for Wtf8, - // and self.inner.as_slice() returns &Wtf8. - // Therefore, transmuting &Wtf8 to &Slice is safe. - unsafe { mem::transmute(self.inner.as_slice()) } - } - - pub fn as_mut_slice(&mut self) -> &mut Slice { - // SAFETY: Slice is just a wrapper for Wtf8, - // and self.inner.as_mut_slice() returns &mut Wtf8. - // Therefore, transmuting &mut Wtf8 to &mut Slice is safe. - // Additionally, care should be taken to ensure the slice - // is always valid Wtf8. - unsafe { mem::transmute(self.inner.as_mut_slice()) } - } - - pub fn into_string(self) -> Result<String, Buf> { - self.inner.into_string().map_err(|buf| Buf { inner: buf }) - } - - pub fn push_slice(&mut self, s: &Slice) { - self.inner.push_wtf8(&s.inner) - } - - pub fn reserve(&mut self, additional: usize) { - self.inner.reserve(additional) - } - - pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { - self.inner.try_reserve(additional) - } - - pub fn reserve_exact(&mut self, additional: usize) { - self.inner.reserve_exact(additional) - } - - pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> { - self.inner.try_reserve_exact(additional) - } - - pub fn shrink_to_fit(&mut self) { - self.inner.shrink_to_fit() - } - - #[inline] - pub fn shrink_to(&mut self, min_capacity: usize) { - self.inner.shrink_to(min_capacity) - } - - #[inline] - pub fn into_box(self) -> Box<Slice> { - unsafe { mem::transmute(self.inner.into_box()) } - } - - #[inline] - pub fn from_box(boxed: Box<Slice>) -> Buf { - let inner: Box<Wtf8> = unsafe { mem::transmute(boxed) }; - Buf { inner: Wtf8Buf::from_box(inner) } - } - - #[inline] - pub fn into_arc(&self) -> Arc<Slice> { - self.as_slice().into_arc() - } - - #[inline] - pub fn into_rc(&self) -> Rc<Slice> { - self.as_slice().into_rc() - } -} - -impl Slice { - #[inline] - pub fn as_encoded_bytes(&self) -> &[u8] { - self.inner.as_bytes() - } - - #[inline] - pub unsafe fn from_encoded_bytes_unchecked(s: &[u8]) -> &Slice { - mem::transmute(Wtf8::from_bytes_unchecked(s)) - } - - #[inline] - pub fn from_str(s: &str) -> &Slice { - unsafe { mem::transmute(Wtf8::from_str(s)) } - } - - pub fn to_str(&self) -> Result<&str, crate::str::Utf8Error> { - self.inner.as_str() - } - - pub fn to_string_lossy(&self) -> Cow<'_, str> { - self.inner.to_string_lossy() - } - - pub fn to_owned(&self) -> Buf { - Buf { inner: self.inner.to_owned() } - } - - pub fn clone_into(&self, buf: &mut Buf) { - self.inner.clone_into(&mut buf.inner) - } - - #[inline] - pub fn into_box(&self) -> Box<Slice> { - unsafe { mem::transmute(self.inner.into_box()) } - } - - pub fn empty_box() -> Box<Slice> { - unsafe { mem::transmute(Wtf8::empty_box()) } - } - - #[inline] - pub fn into_arc(&self) -> Arc<Slice> { - let arc = self.inner.into_arc(); - unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Slice) } - } - - #[inline] - pub fn into_rc(&self) -> Rc<Slice> { - let rc = self.inner.into_rc(); - unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } - } - - #[inline] - pub fn make_ascii_lowercase(&mut self) { - self.inner.make_ascii_lowercase() - } - - #[inline] - pub fn make_ascii_uppercase(&mut self) { - self.inner.make_ascii_uppercase() - } - - #[inline] - pub fn to_ascii_lowercase(&self) -> Buf { - Buf { inner: self.inner.to_ascii_lowercase() } - } - - #[inline] - pub fn to_ascii_uppercase(&self) -> Buf { - Buf { inner: self.inner.to_ascii_uppercase() } - } - - #[inline] - pub fn is_ascii(&self) -> bool { - self.inner.is_ascii() - } - - #[inline] - pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool { - self.inner.eq_ignore_ascii_case(&other.inner) - } -} diff --git a/library/std/src/sys/windows/path.rs b/library/std/src/sys/windows/path.rs deleted file mode 100644 index d9684f21753..00000000000 --- a/library/std/src/sys/windows/path.rs +++ /dev/null @@ -1,344 +0,0 @@ -use super::{c, fill_utf16_buf, to_u16s}; -use crate::ffi::{OsStr, OsString}; -use crate::io; -use crate::path::{Path, PathBuf, Prefix}; -use crate::ptr; - -#[cfg(test)] -mod tests; - -pub const MAIN_SEP_STR: &str = "\\"; -pub const MAIN_SEP: char = '\\'; - -#[inline] -pub fn is_sep_byte(b: u8) -> bool { - b == b'/' || b == b'\\' -} - -#[inline] -pub fn is_verbatim_sep(b: u8) -> bool { - b == b'\\' -} - -/// Returns true if `path` looks like a lone filename. -pub(crate) fn is_file_name(path: &OsStr) -> bool { - !path.as_encoded_bytes().iter().copied().any(is_sep_byte) -} -pub(crate) fn has_trailing_slash(path: &OsStr) -> bool { - let is_verbatim = path.as_encoded_bytes().starts_with(br"\\?\"); - let is_separator = if is_verbatim { is_verbatim_sep } else { is_sep_byte }; - if let Some(&c) = path.as_encoded_bytes().last() { is_separator(c) } else { false } -} - -/// Appends a suffix to a path. -/// -/// Can be used to append an extension without removing an existing extension. -pub(crate) fn append_suffix(path: PathBuf, suffix: &OsStr) -> PathBuf { - let mut path = OsString::from(path); - path.push(suffix); - path.into() -} - -struct PrefixParser<'a, const LEN: usize> { - path: &'a OsStr, - prefix: [u8; LEN], -} - -impl<'a, const LEN: usize> PrefixParser<'a, LEN> { - #[inline] - fn get_prefix(path: &OsStr) -> [u8; LEN] { - let mut prefix = [0; LEN]; - // SAFETY: Only ASCII characters are modified. - for (i, &ch) in path.as_encoded_bytes().iter().take(LEN).enumerate() { - prefix[i] = if ch == b'/' { b'\\' } else { ch }; - } - prefix - } - - fn new(path: &'a OsStr) -> Self { - Self { path, prefix: Self::get_prefix(path) } - } - - fn as_slice(&self) -> PrefixParserSlice<'a, '_> { - PrefixParserSlice { - path: self.path, - prefix: &self.prefix[..LEN.min(self.path.len())], - index: 0, - } - } -} - -struct PrefixParserSlice<'a, 'b> { - path: &'a OsStr, - prefix: &'b [u8], - index: usize, -} - -impl<'a> PrefixParserSlice<'a, '_> { - fn strip_prefix(&self, prefix: &str) -> Option<Self> { - self.prefix[self.index..] - .starts_with(prefix.as_bytes()) - .then_some(Self { index: self.index + prefix.len(), ..*self }) - } - - fn prefix_bytes(&self) -> &'a [u8] { - &self.path.as_encoded_bytes()[..self.index] - } - - fn finish(self) -> &'a OsStr { - // SAFETY: The unsafety here stems from converting between &OsStr and - // &[u8] and back. This is safe to do because (1) we only look at ASCII - // contents of the encoding and (2) new &OsStr values are produced only - // from ASCII-bounded slices of existing &OsStr values. - unsafe { OsStr::from_encoded_bytes_unchecked(&self.path.as_encoded_bytes()[self.index..]) } - } -} - -pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> { - use Prefix::{DeviceNS, Disk, Verbatim, VerbatimDisk, VerbatimUNC, UNC}; - - let parser = PrefixParser::<8>::new(path); - let parser = parser.as_slice(); - if let Some(parser) = parser.strip_prefix(r"\\") { - // \\ - - // The meaning of verbatim paths can change when they use a different - // separator. - if let Some(parser) = parser.strip_prefix(r"?\") - && !parser.prefix_bytes().iter().any(|&x| x == b'/') - { - // \\?\ - if let Some(parser) = parser.strip_prefix(r"UNC\") { - // \\?\UNC\server\share - - let path = parser.finish(); - let (server, path) = parse_next_component(path, true); - let (share, _) = parse_next_component(path, true); - - Some(VerbatimUNC(server, share)) - } else { - let path = parser.finish(); - - // in verbatim paths only recognize an exact drive prefix - if let Some(drive) = parse_drive_exact(path) { - // \\?\C: - Some(VerbatimDisk(drive)) - } else { - // \\?\prefix - let (prefix, _) = parse_next_component(path, true); - Some(Verbatim(prefix)) - } - } - } else if let Some(parser) = parser.strip_prefix(r".\") { - // \\.\COM42 - let path = parser.finish(); - let (prefix, _) = parse_next_component(path, false); - Some(DeviceNS(prefix)) - } else { - let path = parser.finish(); - let (server, path) = parse_next_component(path, false); - let (share, _) = parse_next_component(path, false); - - if !server.is_empty() && !share.is_empty() { - // \\server\share - Some(UNC(server, share)) - } else { - // no valid prefix beginning with "\\" recognized - None - } - } - } else { - // If it has a drive like `C:` then it's a disk. - // Otherwise there is no prefix. - parse_drive(path).map(Disk) - } -} - -// Parses a drive prefix, e.g. "C:" and "C:\whatever" -fn parse_drive(path: &OsStr) -> Option<u8> { - // In most DOS systems, it is not possible to have more than 26 drive letters. - // See <https://en.wikipedia.org/wiki/Drive_letter_assignment#Common_assignments>. - fn is_valid_drive_letter(drive: &u8) -> bool { - drive.is_ascii_alphabetic() - } - - match path.as_encoded_bytes() { - [drive, b':', ..] if is_valid_drive_letter(drive) => Some(drive.to_ascii_uppercase()), - _ => None, - } -} - -// Parses a drive prefix exactly, e.g. "C:" -fn parse_drive_exact(path: &OsStr) -> Option<u8> { - // only parse two bytes: the drive letter and the drive separator - if path.as_encoded_bytes().get(2).map(|&x| is_sep_byte(x)).unwrap_or(true) { - parse_drive(path) - } else { - None - } -} - -// Parse the next path component. -// -// Returns the next component and the rest of the path excluding the component and separator. -// Does not recognize `/` as a separator character if `verbatim` is true. -fn parse_next_component(path: &OsStr, verbatim: bool) -> (&OsStr, &OsStr) { - let separator = if verbatim { is_verbatim_sep } else { is_sep_byte }; - - match path.as_encoded_bytes().iter().position(|&x| separator(x)) { - Some(separator_start) => { - let separator_end = separator_start + 1; - - let component = &path.as_encoded_bytes()[..separator_start]; - - // Panic safe - // The max `separator_end` is `bytes.len()` and `bytes[bytes.len()..]` is a valid index. - let path = &path.as_encoded_bytes()[separator_end..]; - - // SAFETY: `path` is a valid wtf8 encoded slice and each of the separators ('/', '\') - // is encoded in a single byte, therefore `bytes[separator_start]` and - // `bytes[separator_end]` must be code point boundaries and thus - // `bytes[..separator_start]` and `bytes[separator_end..]` are valid wtf8 slices. - unsafe { - ( - OsStr::from_encoded_bytes_unchecked(component), - OsStr::from_encoded_bytes_unchecked(path), - ) - } - } - None => (path, OsStr::new("")), - } -} - -/// Returns a UTF-16 encoded path capable of bypassing the legacy `MAX_PATH` limits. -/// -/// This path may or may not have a verbatim prefix. -pub(crate) fn maybe_verbatim(path: &Path) -> io::Result<Vec<u16>> { - let path = to_u16s(path)?; - get_long_path(path, true) -} - -/// Get a normalized absolute path that can bypass path length limits. -/// -/// Setting prefer_verbatim to true suggests a stronger preference for verbatim -/// paths even when not strictly necessary. This allows the Windows API to avoid -/// repeating our work. However, if the path may be given back to users or -/// passed to other application then it's preferable to use non-verbatim paths -/// when possible. Non-verbatim paths are better understood by users and handled -/// by more software. -pub(crate) fn get_long_path(mut path: Vec<u16>, prefer_verbatim: bool) -> io::Result<Vec<u16>> { - // Normally the MAX_PATH is 260 UTF-16 code units (including the NULL). - // However, for APIs such as CreateDirectory[1], the limit is 248. - // - // [1]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createdirectorya#parameters - const LEGACY_MAX_PATH: usize = 248; - // UTF-16 encoded code points, used in parsing and building UTF-16 paths. - // All of these are in the ASCII range so they can be cast directly to `u16`. - const SEP: u16 = b'\\' as _; - const ALT_SEP: u16 = b'/' as _; - const QUERY: u16 = b'?' as _; - const COLON: u16 = b':' as _; - const DOT: u16 = b'.' as _; - const U: u16 = b'U' as _; - const N: u16 = b'N' as _; - const C: u16 = b'C' as _; - - // \\?\ - const VERBATIM_PREFIX: &[u16] = &[SEP, SEP, QUERY, SEP]; - // \??\ - const NT_PREFIX: &[u16] = &[SEP, QUERY, QUERY, SEP]; - // \\?\UNC\ - const UNC_PREFIX: &[u16] = &[SEP, SEP, QUERY, SEP, U, N, C, SEP]; - - if path.starts_with(VERBATIM_PREFIX) || path.starts_with(NT_PREFIX) || path == [0] { - // Early return for paths that are already verbatim or empty. - return Ok(path); - } else if path.len() < LEGACY_MAX_PATH { - // Early return if an absolute path is less < 260 UTF-16 code units. - // This is an optimization to avoid calling `GetFullPathNameW` unnecessarily. - match path.as_slice() { - // Starts with `D:`, `D:\`, `D:/`, etc. - // Does not match if the path starts with a `\` or `/`. - [drive, COLON, 0] | [drive, COLON, SEP | ALT_SEP, ..] - if *drive != SEP && *drive != ALT_SEP => - { - return Ok(path); - } - // Starts with `\\`, `//`, etc - [SEP | ALT_SEP, SEP | ALT_SEP, ..] => return Ok(path), - _ => {} - } - } - - // Firstly, get the absolute path using `GetFullPathNameW`. - // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew - let lpfilename = path.as_ptr(); - fill_utf16_buf( - // SAFETY: `fill_utf16_buf` ensures the `buffer` and `size` are valid. - // `lpfilename` is a pointer to a null terminated string that is not - // invalidated until after `GetFullPathNameW` returns successfully. - |buffer, size| unsafe { c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()) }, - |mut absolute| { - path.clear(); - - // Only prepend the prefix if needed. - if prefer_verbatim || absolute.len() + 1 >= LEGACY_MAX_PATH { - // Secondly, add the verbatim prefix. This is easier here because we know the - // path is now absolute and fully normalized (e.g. `/` has been changed to `\`). - let prefix = match absolute { - // C:\ => \\?\C:\ - [_, COLON, SEP, ..] => VERBATIM_PREFIX, - // \\.\ => \\?\ - [SEP, SEP, DOT, SEP, ..] => { - absolute = &absolute[4..]; - VERBATIM_PREFIX - } - // Leave \\?\ and \??\ as-is. - [SEP, SEP, QUERY, SEP, ..] | [SEP, QUERY, QUERY, SEP, ..] => &[], - // \\ => \\?\UNC\ - [SEP, SEP, ..] => { - absolute = &absolute[2..]; - UNC_PREFIX - } - // Anything else we leave alone. - _ => &[], - }; - - path.reserve_exact(prefix.len() + absolute.len() + 1); - path.extend_from_slice(prefix); - } else { - path.reserve_exact(absolute.len() + 1); - } - path.extend_from_slice(absolute); - path.push(0); - }, - )?; - Ok(path) -} - -/// Make a Windows path absolute. -pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> { - let path = path.as_os_str(); - let prefix = parse_prefix(path); - // Verbatim paths should not be modified. - if prefix.map(|x| x.is_verbatim()).unwrap_or(false) { - // NULs in verbatim paths are rejected for consistency. - if path.as_encoded_bytes().contains(&0) { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "strings passed to WinAPI cannot contain NULs", - )); - } - return Ok(path.to_owned().into()); - } - - let path = to_u16s(path)?; - let lpfilename = path.as_ptr(); - fill_utf16_buf( - // SAFETY: `fill_utf16_buf` ensures the `buffer` and `size` are valid. - // `lpfilename` is a pointer to a null terminated string that is not - // invalidated until after `GetFullPathNameW` returns successfully. - |buffer, size| unsafe { c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()) }, - super::os2path, - ) -} diff --git a/library/std/src/sys/windows/path/tests.rs b/library/std/src/sys/windows/path/tests.rs deleted file mode 100644 index 623c6236166..00000000000 --- a/library/std/src/sys/windows/path/tests.rs +++ /dev/null @@ -1,137 +0,0 @@ -use super::*; - -#[test] -fn test_parse_next_component() { - assert_eq!( - parse_next_component(OsStr::new(r"server\share"), true), - (OsStr::new(r"server"), OsStr::new(r"share")) - ); - - assert_eq!( - parse_next_component(OsStr::new(r"server/share"), true), - (OsStr::new(r"server/share"), OsStr::new(r"")) - ); - - assert_eq!( - parse_next_component(OsStr::new(r"server/share"), false), - (OsStr::new(r"server"), OsStr::new(r"share")) - ); - - assert_eq!( - parse_next_component(OsStr::new(r"server\"), false), - (OsStr::new(r"server"), OsStr::new(r"")) - ); - - assert_eq!( - parse_next_component(OsStr::new(r"\server\"), false), - (OsStr::new(r""), OsStr::new(r"server\")) - ); - - assert_eq!( - parse_next_component(OsStr::new(r"servershare"), false), - (OsStr::new(r"servershare"), OsStr::new("")) - ); -} - -#[test] -fn verbatim() { - use crate::path::Path; - fn check(path: &str, expected: &str) { - let verbatim = maybe_verbatim(Path::new(path)).unwrap(); - let verbatim = String::from_utf16_lossy(verbatim.strip_suffix(&[0]).unwrap()); - assert_eq!(&verbatim, expected, "{}", path); - } - - // Ensure long paths are correctly prefixed. - check( - r"C:\Program Files\Rust\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - r"\\?\C:\Program Files\Rust\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - ); - check( - r"\\server\share\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - r"\\?\UNC\server\share\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - ); - check( - r"\\.\PIPE\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - r"\\?\PIPE\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - ); - // `\\?\` prefixed paths are left unchanged... - check( - r"\\?\verbatim.\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - r"\\?\verbatim.\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - ); - // But `//?/` is not a verbatim prefix so it will be normalized. - check( - r"//?/E:/verbatim.\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - r"\\?\E:\verbatim\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\foo.txt", - ); - - // For performance, short absolute paths are left unchanged. - check(r"C:\Program Files\Rust", r"C:\Program Files\Rust"); - check(r"\\server\share", r"\\server\share"); - check(r"\\.\COM1", r"\\.\COM1"); - - // Check that paths of length 247 are converted to verbatim. - // This is necessary for `CreateDirectory`. - check( - r"C:\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - r"\\?\C:\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - ); - - // Make sure opening a drive will work. - check("Z:", "Z:"); - - // A path that contains null is not a valid path. - assert!(maybe_verbatim(Path::new("\0")).is_err()); -} - -fn parse_prefix(path: &str) -> Option<Prefix<'_>> { - super::parse_prefix(OsStr::new(path)) -} - -#[test] -fn test_parse_prefix_verbatim() { - let prefix = Some(Prefix::VerbatimDisk(b'C')); - assert_eq!(prefix, parse_prefix(r"\\?\C:/windows/system32/notepad.exe")); - assert_eq!(prefix, parse_prefix(r"\\?\C:\windows\system32\notepad.exe")); -} - -#[test] -fn test_parse_prefix_verbatim_device() { - let prefix = Some(Prefix::UNC(OsStr::new("?"), OsStr::new("C:"))); - assert_eq!(prefix, parse_prefix(r"//?/C:/windows/system32/notepad.exe")); - assert_eq!(prefix, parse_prefix(r"//?/C:\windows\system32\notepad.exe")); - assert_eq!(prefix, parse_prefix(r"/\?\C:\windows\system32\notepad.exe")); - assert_eq!(prefix, parse_prefix(r"\\?/C:\windows\system32\notepad.exe")); -} - -// See #93586 for more information. -#[test] -fn test_windows_prefix_components() { - use crate::path::Path; - - let path = Path::new("C:"); - let mut components = path.components(); - let drive = components.next().expect("drive is expected here"); - assert_eq!(drive.as_os_str(), OsStr::new("C:")); - assert_eq!(components.as_path(), Path::new("")); -} - -/// See #101358. -/// -/// Note that the exact behaviour here may change in the future. -/// In which case this test will need to adjusted. -#[test] -fn broken_unc_path() { - use crate::path::Component; - - let mut components = Path::new(r"\\foo\\bar\\").components(); - assert_eq!(components.next(), Some(Component::RootDir)); - assert_eq!(components.next(), Some(Component::Normal("foo".as_ref()))); - assert_eq!(components.next(), Some(Component::Normal("bar".as_ref()))); - - let mut components = Path::new("//foo//bar//").components(); - assert_eq!(components.next(), Some(Component::RootDir)); - assert_eq!(components.next(), Some(Component::Normal("foo".as_ref()))); - assert_eq!(components.next(), Some(Component::Normal("bar".as_ref()))); -} diff --git a/library/std/src/sys/windows/pipe.rs b/library/std/src/sys/windows/pipe.rs deleted file mode 100644 index 7624e746f5c..00000000000 --- a/library/std/src/sys/windows/pipe.rs +++ /dev/null @@ -1,571 +0,0 @@ -use crate::os::windows::prelude::*; - -use crate::ffi::OsStr; -use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read}; -use crate::mem; -use crate::path::Path; -use crate::ptr; -use crate::slice; -use crate::sync::atomic::AtomicUsize; -use crate::sync::atomic::Ordering::SeqCst; -use crate::sys::c; -use crate::sys::fs::{File, OpenOptions}; -use crate::sys::handle::Handle; -use crate::sys::hashmap_random_keys; -use crate::sys_common::{FromInner, IntoInner}; - -//////////////////////////////////////////////////////////////////////////////// -// Anonymous pipes -//////////////////////////////////////////////////////////////////////////////// - -pub struct AnonPipe { - inner: Handle, -} - -impl IntoInner<Handle> for AnonPipe { - fn into_inner(self) -> Handle { - self.inner - } -} - -impl FromInner<Handle> for AnonPipe { - fn from_inner(inner: Handle) -> AnonPipe { - Self { inner } - } -} - -pub struct Pipes { - pub ours: AnonPipe, - pub theirs: AnonPipe, -} - -/// Although this looks similar to `anon_pipe` in the Unix module it's actually -/// subtly different. Here we'll return two pipes in the `Pipes` return value, -/// but one is intended for "us" where as the other is intended for "someone -/// else". -/// -/// Currently the only use case for this function is pipes for stdio on -/// processes in the standard library, so "ours" is the one that'll stay in our -/// process whereas "theirs" will be inherited to a child. -/// -/// The ours/theirs pipes are *not* specifically readable or writable. Each -/// one only supports a read or a write, but which is which depends on the -/// boolean flag given. If `ours_readable` is `true`, then `ours` is readable and -/// `theirs` is writable. Conversely, if `ours_readable` is `false`, then `ours` -/// is writable and `theirs` is readable. -/// -/// Also note that the `ours` pipe is always a handle opened up in overlapped -/// mode. This means that technically speaking it should only ever be used -/// with `OVERLAPPED` instances, but also works out ok if it's only ever used -/// once at a time (which we do indeed guarantee). -pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Result<Pipes> { - // A 64kb pipe capacity is the same as a typical Linux default. - const PIPE_BUFFER_CAPACITY: u32 = 64 * 1024; - - // Note that we specifically do *not* use `CreatePipe` here because - // unfortunately the anonymous pipes returned do not support overlapped - // operations. Instead, we create a "hopefully unique" name and create a - // named pipe which has overlapped operations enabled. - // - // Once we do this, we connect do it as usual via `CreateFileW`, and then - // we return those reader/writer halves. Note that the `ours` pipe return - // value is always the named pipe, whereas `theirs` is just the normal file. - // This should hopefully shield us from child processes which assume their - // stdout is a named pipe, which would indeed be odd! - unsafe { - let ours; - let mut name; - let mut tries = 0; - let mut reject_remote_clients_flag = c::PIPE_REJECT_REMOTE_CLIENTS; - loop { - tries += 1; - name = format!( - r"\\.\pipe\__rust_anonymous_pipe1__.{}.{}", - c::GetCurrentProcessId(), - random_number() - ); - let wide_name = OsStr::new(&name).encode_wide().chain(Some(0)).collect::<Vec<_>>(); - let mut flags = c::FILE_FLAG_FIRST_PIPE_INSTANCE | c::FILE_FLAG_OVERLAPPED; - if ours_readable { - flags |= c::PIPE_ACCESS_INBOUND; - } else { - flags |= c::PIPE_ACCESS_OUTBOUND; - } - - let handle = c::CreateNamedPipeW( - wide_name.as_ptr(), - flags, - c::PIPE_TYPE_BYTE - | c::PIPE_READMODE_BYTE - | c::PIPE_WAIT - | reject_remote_clients_flag, - 1, - PIPE_BUFFER_CAPACITY, - PIPE_BUFFER_CAPACITY, - 0, - ptr::null_mut(), - ); - - // We pass the `FILE_FLAG_FIRST_PIPE_INSTANCE` flag above, and we're - // also just doing a best effort at selecting a unique name. If - // `ERROR_ACCESS_DENIED` is returned then it could mean that we - // accidentally conflicted with an already existing pipe, so we try - // again. - // - // Don't try again too much though as this could also perhaps be a - // legit error. - // If `ERROR_INVALID_PARAMETER` is returned, this probably means we're - // running on pre-Vista version where `PIPE_REJECT_REMOTE_CLIENTS` is - // not supported, so we continue retrying without it. This implies - // reduced security on Windows versions older than Vista by allowing - // connections to this pipe from remote machines. - // Proper fix would increase the number of FFI imports and introduce - // significant amount of Windows XP specific code with no clean - // testing strategy - // For more info, see https://github.com/rust-lang/rust/pull/37677. - if handle == c::INVALID_HANDLE_VALUE { - let err = io::Error::last_os_error(); - let raw_os_err = err.raw_os_error(); - if tries < 10 { - if raw_os_err == Some(c::ERROR_ACCESS_DENIED as i32) { - continue; - } else if reject_remote_clients_flag != 0 - && raw_os_err == Some(c::ERROR_INVALID_PARAMETER as i32) - { - reject_remote_clients_flag = 0; - tries -= 1; - continue; - } - } - return Err(err); - } - ours = Handle::from_raw_handle(handle); - break; - } - - // Connect to the named pipe we just created. This handle is going to be - // returned in `theirs`, so if `ours` is readable we want this to be - // writable, otherwise if `ours` is writable we want this to be - // readable. - // - // Additionally we don't enable overlapped mode on this because most - // client processes aren't enabled to work with that. - let mut opts = OpenOptions::new(); - opts.write(ours_readable); - opts.read(!ours_readable); - opts.share_mode(0); - let size = mem::size_of::<c::SECURITY_ATTRIBUTES>(); - let mut sa = c::SECURITY_ATTRIBUTES { - nLength: size as c::DWORD, - lpSecurityDescriptor: ptr::null_mut(), - bInheritHandle: their_handle_inheritable as i32, - }; - opts.security_attributes(&mut sa); - let theirs = File::open(Path::new(&name), &opts)?; - let theirs = AnonPipe { inner: theirs.into_inner() }; - - Ok(Pipes { - ours: AnonPipe { inner: ours }, - theirs: AnonPipe { inner: theirs.into_inner() }, - }) - } -} - -/// Takes an asynchronous source pipe and returns a synchronous pipe suitable -/// for sending to a child process. -/// -/// This is achieved by creating a new set of pipes and spawning a thread that -/// relays messages between the source and the synchronous pipe. -pub fn spawn_pipe_relay( - source: &AnonPipe, - ours_readable: bool, - their_handle_inheritable: bool, -) -> io::Result<AnonPipe> { - // We need this handle to live for the lifetime of the thread spawned below. - let source = source.duplicate()?; - - // create a new pair of anon pipes. - let Pipes { theirs, ours } = anon_pipe(ours_readable, their_handle_inheritable)?; - - // Spawn a thread that passes messages from one pipe to the other. - // Any errors will simply cause the thread to exit. - let (reader, writer) = if ours_readable { (ours, source) } else { (source, ours) }; - crate::thread::spawn(move || { - let mut buf = [0_u8; 4096]; - 'reader: while let Ok(len) = reader.read(&mut buf) { - if len == 0 { - break; - } - let mut start = 0; - while let Ok(written) = writer.write(&buf[start..len]) { - start += written; - if start == len { - continue 'reader; - } - } - break; - } - }); - - // Return the pipe that should be sent to the child process. - Ok(theirs) -} - -fn random_number() -> usize { - static N: AtomicUsize = AtomicUsize::new(0); - loop { - if N.load(SeqCst) != 0 { - return N.fetch_add(1, SeqCst); - } - - N.store(hashmap_random_keys().0 as usize, SeqCst); - } -} - -// Abstracts over `ReadFileEx` and `WriteFileEx` -type AlertableIoFn = unsafe extern "system" fn( - BorrowedHandle<'_>, - c::LPVOID, - c::DWORD, - c::LPOVERLAPPED, - c::LPOVERLAPPED_COMPLETION_ROUTINE, -) -> c::BOOL; - -impl AnonPipe { - pub fn handle(&self) -> &Handle { - &self.inner - } - pub fn into_handle(self) -> Handle { - self.inner - } - fn duplicate(&self) -> io::Result<Self> { - self.inner.duplicate(0, false, c::DUPLICATE_SAME_ACCESS).map(|inner| AnonPipe { inner }) - } - - pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> { - let result = unsafe { - let len = crate::cmp::min(buf.len(), c::DWORD::MAX as usize) as c::DWORD; - self.alertable_io_internal(c::ReadFileEx, buf.as_mut_ptr() as _, len) - }; - - match result { - // The special treatment of BrokenPipe is to deal with Windows - // pipe semantics, which yields this error when *reading* from - // a pipe after the other end has closed; we interpret that as - // EOF on the pipe. - Err(ref e) if e.kind() == io::ErrorKind::BrokenPipe => Ok(0), - _ => result, - } - } - - pub fn read_buf(&self, mut buf: BorrowedCursor<'_>) -> io::Result<()> { - let result = unsafe { - let len = crate::cmp::min(buf.capacity(), c::DWORD::MAX as usize) as c::DWORD; - self.alertable_io_internal(c::ReadFileEx, buf.as_mut().as_mut_ptr() as _, len) - }; - - match result { - // The special treatment of BrokenPipe is to deal with Windows - // pipe semantics, which yields this error when *reading* from - // a pipe after the other end has closed; we interpret that as - // EOF on the pipe. - Err(ref e) if e.kind() == io::ErrorKind::BrokenPipe => Ok(()), - Err(e) => Err(e), - Ok(n) => { - unsafe { - buf.advance(n); - } - Ok(()) - } - } - } - - pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { - self.inner.read_vectored(bufs) - } - - #[inline] - pub fn is_read_vectored(&self) -> bool { - self.inner.is_read_vectored() - } - - pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> { - self.handle().read_to_end(buf) - } - - pub fn write(&self, buf: &[u8]) -> io::Result<usize> { - unsafe { - let len = crate::cmp::min(buf.len(), c::DWORD::MAX as usize) as c::DWORD; - self.alertable_io_internal(c::WriteFileEx, buf.as_ptr() as _, len) - } - } - - pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { - self.inner.write_vectored(bufs) - } - - #[inline] - pub fn is_write_vectored(&self) -> bool { - self.inner.is_write_vectored() - } - - /// Synchronizes asynchronous reads or writes using our anonymous pipe. - /// - /// This is a wrapper around [`ReadFileEx`] or [`WriteFileEx`] that uses - /// [Asynchronous Procedure Call] (APC) to synchronize reads or writes. - /// - /// Note: This should not be used for handles we don't create. - /// - /// # Safety - /// - /// `buf` must be a pointer to a buffer that's valid for reads or writes - /// up to `len` bytes. The `AlertableIoFn` must be either `ReadFileEx` or `WriteFileEx` - /// - /// [`ReadFileEx`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfileex - /// [`WriteFileEx`]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefileex - /// [Asynchronous Procedure Call]: https://docs.microsoft.com/en-us/windows/win32/sync/asynchronous-procedure-calls - unsafe fn alertable_io_internal( - &self, - io: AlertableIoFn, - buf: c::LPVOID, - len: c::DWORD, - ) -> io::Result<usize> { - // Use "alertable I/O" to synchronize the pipe I/O. - // This has four steps. - // - // STEP 1: Start the asynchronous I/O operation. - // This simply calls either `ReadFileEx` or `WriteFileEx`, - // giving it a pointer to the buffer and callback function. - // - // STEP 2: Enter an alertable state. - // The callback set in step 1 will not be called until the thread - // enters an "alertable" state. This can be done using `SleepEx`. - // - // STEP 3: The callback - // Once the I/O is complete and the thread is in an alertable state, - // the callback will be run on the same thread as the call to - // `ReadFileEx` or `WriteFileEx` done in step 1. - // In the callback we simply set the result of the async operation. - // - // STEP 4: Return the result. - // At this point we'll have a result from the callback function - // and can simply return it. Note that we must not return earlier, - // while the I/O is still in progress. - - // The result that will be set from the asynchronous callback. - let mut async_result: Option<AsyncResult> = None; - struct AsyncResult { - error: u32, - transferred: u32, - } - - // STEP 3: The callback. - unsafe extern "system" fn callback( - dwErrorCode: u32, - dwNumberOfBytesTransferred: u32, - lpOverlapped: *mut c::OVERLAPPED, - ) { - // Set `async_result` using a pointer smuggled through `hEvent`. - let result = - AsyncResult { error: dwErrorCode, transferred: dwNumberOfBytesTransferred }; - *(*lpOverlapped).hEvent.cast::<Option<AsyncResult>>() = Some(result); - } - - // STEP 1: Start the I/O operation. - let mut overlapped: c::OVERLAPPED = crate::mem::zeroed(); - // `hEvent` is unused by `ReadFileEx` and `WriteFileEx`. - // Therefore the documentation suggests using it to smuggle a pointer to the callback. - overlapped.hEvent = &mut async_result as *mut _ as *mut _; - - // Asynchronous read of the pipe. - // If successful, `callback` will be called once it completes. - let result = io(self.inner.as_handle(), buf, len, &mut overlapped, Some(callback)); - if result == c::FALSE { - // We can return here because the call failed. - // After this we must not return until the I/O completes. - return Err(io::Error::last_os_error()); - } - - // Wait indefinitely for the result. - let result = loop { - // STEP 2: Enter an alertable state. - // The second parameter of `SleepEx` is used to make this sleep alertable. - c::SleepEx(c::INFINITE, c::TRUE); - if let Some(result) = async_result { - break result; - } - }; - // STEP 4: Return the result. - // `async_result` is always `Some` at this point - match result.error { - c::ERROR_SUCCESS => Ok(result.transferred as usize), - error => Err(io::Error::from_raw_os_error(error as _)), - } - } -} - -pub fn read2(p1: AnonPipe, v1: &mut Vec<u8>, p2: AnonPipe, v2: &mut Vec<u8>) -> io::Result<()> { - let p1 = p1.into_handle(); - let p2 = p2.into_handle(); - - let mut p1 = AsyncPipe::new(p1, v1)?; - let mut p2 = AsyncPipe::new(p2, v2)?; - let objs = [p1.event.as_raw_handle(), p2.event.as_raw_handle()]; - - // In a loop we wait for either pipe's scheduled read operation to complete. - // If the operation completes with 0 bytes, that means EOF was reached, in - // which case we just finish out the other pipe entirely. - // - // Note that overlapped I/O is in general super unsafe because we have to - // be careful to ensure that all pointers in play are valid for the entire - // duration of the I/O operation (where tons of operations can also fail). - // The destructor for `AsyncPipe` ends up taking care of most of this. - loop { - let res = unsafe { c::WaitForMultipleObjects(2, objs.as_ptr(), c::FALSE, c::INFINITE) }; - if res == c::WAIT_OBJECT_0 { - if !p1.result()? || !p1.schedule_read()? { - return p2.finish(); - } - } else if res == c::WAIT_OBJECT_0 + 1 { - if !p2.result()? || !p2.schedule_read()? { - return p1.finish(); - } - } else { - return Err(io::Error::last_os_error()); - } - } -} - -struct AsyncPipe<'a> { - pipe: Handle, - event: Handle, - overlapped: Box<c::OVERLAPPED>, // needs a stable address - dst: &'a mut Vec<u8>, - state: State, -} - -#[derive(PartialEq, Debug)] -enum State { - NotReading, - Reading, - Read(usize), -} - -impl<'a> AsyncPipe<'a> { - fn new(pipe: Handle, dst: &'a mut Vec<u8>) -> io::Result<AsyncPipe<'a>> { - // Create an event which we'll use to coordinate our overlapped - // operations, this event will be used in WaitForMultipleObjects - // and passed as part of the OVERLAPPED handle. - // - // Note that we do a somewhat clever thing here by flagging the - // event as being manually reset and setting it initially to the - // signaled state. This means that we'll naturally fall through the - // WaitForMultipleObjects call above for pipes created initially, - // and the only time an even will go back to "unset" will be once an - // I/O operation is successfully scheduled (what we want). - let event = Handle::new_event(true, true)?; - let mut overlapped: Box<c::OVERLAPPED> = unsafe { Box::new(mem::zeroed()) }; - overlapped.hEvent = event.as_raw_handle(); - Ok(AsyncPipe { pipe, overlapped, event, dst, state: State::NotReading }) - } - - /// Executes an overlapped read operation. - /// - /// Must not currently be reading, and returns whether the pipe is currently - /// at EOF or not. If the pipe is not at EOF then `result()` must be called - /// to complete the read later on (may block), but if the pipe is at EOF - /// then `result()` should not be called as it will just block forever. - fn schedule_read(&mut self) -> io::Result<bool> { - assert_eq!(self.state, State::NotReading); - let amt = unsafe { - let slice = slice_to_end(self.dst); - self.pipe.read_overlapped(slice, &mut *self.overlapped)? - }; - - // If this read finished immediately then our overlapped event will - // remain signaled (it was signaled coming in here) and we'll progress - // down to the method below. - // - // Otherwise the I/O operation is scheduled and the system set our event - // to not signaled, so we flag ourselves into the reading state and move - // on. - self.state = match amt { - Some(0) => return Ok(false), - Some(amt) => State::Read(amt), - None => State::Reading, - }; - Ok(true) - } - - /// Wait for the result of the overlapped operation previously executed. - /// - /// Takes a parameter `wait` which indicates if this pipe is currently being - /// read whether the function should block waiting for the read to complete. - /// - /// Returns values: - /// - /// * `true` - finished any pending read and the pipe is not at EOF (keep - /// going) - /// * `false` - finished any pending read and pipe is at EOF (stop issuing - /// reads) - fn result(&mut self) -> io::Result<bool> { - let amt = match self.state { - State::NotReading => return Ok(true), - State::Reading => self.pipe.overlapped_result(&mut *self.overlapped, true)?, - State::Read(amt) => amt, - }; - self.state = State::NotReading; - unsafe { - let len = self.dst.len(); - self.dst.set_len(len + amt); - } - Ok(amt != 0) - } - - /// Finishes out reading this pipe entirely. - /// - /// Waits for any pending and schedule read, and then calls `read_to_end` - /// if necessary to read all the remaining information. - fn finish(&mut self) -> io::Result<()> { - while self.result()? && self.schedule_read()? { - // ... - } - Ok(()) - } -} - -impl<'a> Drop for AsyncPipe<'a> { - fn drop(&mut self) { - match self.state { - State::Reading => {} - _ => return, - } - - // If we have a pending read operation, then we have to make sure that - // it's *done* before we actually drop this type. The kernel requires - // that the `OVERLAPPED` and buffer pointers are valid for the entire - // I/O operation. - // - // To do that, we call `CancelIo` to cancel any pending operation, and - // if that succeeds we wait for the overlapped result. - // - // If anything here fails, there's not really much we can do, so we leak - // the buffer/OVERLAPPED pointers to ensure we're at least memory safe. - if self.pipe.cancel_io().is_err() || self.result().is_err() { - let buf = mem::take(self.dst); - let overlapped = Box::new(unsafe { mem::zeroed() }); - let overlapped = mem::replace(&mut self.overlapped, overlapped); - mem::forget((buf, overlapped)); - } - } -} - -unsafe fn slice_to_end(v: &mut Vec<u8>) -> &mut [u8] { - if v.capacity() == 0 { - v.reserve(16); - } - if v.capacity() == v.len() { - v.reserve(1); - } - slice::from_raw_parts_mut(v.as_mut_ptr().add(v.len()), v.capacity() - v.len()) -} diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs deleted file mode 100644 index 9ec775959fd..00000000000 --- a/library/std/src/sys/windows/process.rs +++ /dev/null @@ -1,984 +0,0 @@ -#![unstable(feature = "process_internals", issue = "none")] - -#[cfg(test)] -mod tests; - -use crate::cmp; -use crate::collections::BTreeMap; -use crate::env; -use crate::env::consts::{EXE_EXTENSION, EXE_SUFFIX}; -use crate::ffi::{OsStr, OsString}; -use crate::fmt; -use crate::io::{self, Error, ErrorKind}; -use crate::mem; -use crate::mem::MaybeUninit; -use crate::num::NonZeroI32; -use crate::os::windows::ffi::{OsStrExt, OsStringExt}; -use crate::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle}; -use crate::path::{Path, PathBuf}; -use crate::ptr; -use crate::sync::Mutex; -use crate::sys::args::{self, Arg}; -use crate::sys::c::{self, NonZeroDWORD, EXIT_FAILURE, EXIT_SUCCESS}; -use crate::sys::cvt; -use crate::sys::fs::{File, OpenOptions}; -use crate::sys::handle::Handle; -use crate::sys::path; -use crate::sys::pipe::{self, AnonPipe}; -use crate::sys::stdio; -use crate::sys_common::process::{CommandEnv, CommandEnvs}; -use crate::sys_common::IntoInner; - -use core::ffi::c_void; - -//////////////////////////////////////////////////////////////////////////////// -// Command -//////////////////////////////////////////////////////////////////////////////// - -#[derive(Clone, Debug, Eq)] -#[doc(hidden)] -pub struct EnvKey { - os_string: OsString, - // This stores a UTF-16 encoded string to workaround the mismatch between - // Rust's OsString (WTF-8) and the Windows API string type (UTF-16). - // Normally converting on every API call is acceptable but here - // `c::CompareStringOrdinal` will be called for every use of `==`. - utf16: Vec<u16>, -} - -impl EnvKey { - fn new<T: Into<OsString>>(key: T) -> Self { - EnvKey::from(key.into()) - } -} - -// Comparing Windows environment variable keys[1] are behaviourally the -// composition of two operations[2]: -// -// 1. Case-fold both strings. This is done using a language-independent -// uppercase mapping that's unique to Windows (albeit based on data from an -// older Unicode spec). It only operates on individual UTF-16 code units so -// surrogates are left unchanged. This uppercase mapping can potentially change -// between Windows versions. -// -// 2. Perform an ordinal comparison of the strings. A comparison using ordinal -// is just a comparison based on the numerical value of each UTF-16 code unit[3]. -// -// Because the case-folding mapping is unique to Windows and not guaranteed to -// be stable, we ask the OS to compare the strings for us. This is done by -// calling `CompareStringOrdinal`[4] with `bIgnoreCase` set to `TRUE`. -// -// [1] https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#choosing-a-stringcomparison-member-for-your-method-call -// [2] https://docs.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#stringtoupper-and-stringtolower -// [3] https://docs.microsoft.com/en-us/dotnet/api/system.stringcomparison?view=net-5.0#System_StringComparison_Ordinal -// [4] https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal -impl Ord for EnvKey { - fn cmp(&self, other: &Self) -> cmp::Ordering { - unsafe { - let result = c::CompareStringOrdinal( - self.utf16.as_ptr(), - self.utf16.len() as _, - other.utf16.as_ptr(), - other.utf16.len() as _, - c::TRUE, - ); - match result { - c::CSTR_LESS_THAN => cmp::Ordering::Less, - c::CSTR_EQUAL => cmp::Ordering::Equal, - c::CSTR_GREATER_THAN => cmp::Ordering::Greater, - // `CompareStringOrdinal` should never fail so long as the parameters are correct. - _ => panic!("comparing environment keys failed: {}", Error::last_os_error()), - } - } - } -} -impl PartialOrd for EnvKey { - fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> { - Some(self.cmp(other)) - } -} -impl PartialEq for EnvKey { - fn eq(&self, other: &Self) -> bool { - if self.utf16.len() != other.utf16.len() { - false - } else { - self.cmp(other) == cmp::Ordering::Equal - } - } -} -impl PartialOrd<str> for EnvKey { - fn partial_cmp(&self, other: &str) -> Option<cmp::Ordering> { - Some(self.cmp(&EnvKey::new(other))) - } -} -impl PartialEq<str> for EnvKey { - fn eq(&self, other: &str) -> bool { - if self.os_string.len() != other.len() { - false - } else { - self.cmp(&EnvKey::new(other)) == cmp::Ordering::Equal - } - } -} - -// Environment variable keys should preserve their original case even though -// they are compared using a caseless string mapping. -impl From<OsString> for EnvKey { - fn from(k: OsString) -> Self { - EnvKey { utf16: k.encode_wide().collect(), os_string: k } - } -} - -impl From<EnvKey> for OsString { - fn from(k: EnvKey) -> Self { - k.os_string - } -} - -impl From<&OsStr> for EnvKey { - fn from(k: &OsStr) -> Self { - Self::from(k.to_os_string()) - } -} - -impl AsRef<OsStr> for EnvKey { - fn as_ref(&self) -> &OsStr { - &self.os_string - } -} - -pub(crate) fn ensure_no_nuls<T: AsRef<OsStr>>(str: T) -> io::Result<T> { - if str.as_ref().encode_wide().any(|b| b == 0) { - Err(io::const_io_error!(ErrorKind::InvalidInput, "nul byte found in provided data")) - } else { - Ok(str) - } -} - -pub struct Command { - program: OsString, - args: Vec<Arg>, - env: CommandEnv, - cwd: Option<OsString>, - flags: u32, - detach: bool, // not currently exposed in std::process - stdin: Option<Stdio>, - stdout: Option<Stdio>, - stderr: Option<Stdio>, - force_quotes_enabled: bool, - proc_thread_attributes: BTreeMap<usize, ProcThreadAttributeValue>, -} - -pub enum Stdio { - Inherit, - InheritSpecific { from_stdio_id: c::DWORD }, - Null, - MakePipe, - Pipe(AnonPipe), - Handle(Handle), -} - -pub struct StdioPipes { - pub stdin: Option<AnonPipe>, - pub stdout: Option<AnonPipe>, - pub stderr: Option<AnonPipe>, -} - -impl Command { - pub fn new(program: &OsStr) -> Command { - Command { - program: program.to_os_string(), - args: Vec::new(), - env: Default::default(), - cwd: None, - flags: 0, - detach: false, - stdin: None, - stdout: None, - stderr: None, - force_quotes_enabled: false, - proc_thread_attributes: Default::default(), - } - } - - pub fn arg(&mut self, arg: &OsStr) { - self.args.push(Arg::Regular(arg.to_os_string())) - } - pub fn env_mut(&mut self) -> &mut CommandEnv { - &mut self.env - } - pub fn cwd(&mut self, dir: &OsStr) { - self.cwd = Some(dir.to_os_string()) - } - pub fn stdin(&mut self, stdin: Stdio) { - self.stdin = Some(stdin); - } - pub fn stdout(&mut self, stdout: Stdio) { - self.stdout = Some(stdout); - } - pub fn stderr(&mut self, stderr: Stdio) { - self.stderr = Some(stderr); - } - pub fn creation_flags(&mut self, flags: u32) { - self.flags = flags; - } - - pub fn force_quotes(&mut self, enabled: bool) { - self.force_quotes_enabled = enabled; - } - - pub fn raw_arg(&mut self, command_str_to_append: &OsStr) { - self.args.push(Arg::Raw(command_str_to_append.to_os_string())) - } - - pub fn get_program(&self) -> &OsStr { - &self.program - } - - pub fn get_args(&self) -> CommandArgs<'_> { - let iter = self.args.iter(); - CommandArgs { iter } - } - - pub fn get_envs(&self) -> CommandEnvs<'_> { - self.env.iter() - } - - pub fn get_current_dir(&self) -> Option<&Path> { - self.cwd.as_ref().map(Path::new) - } - - pub unsafe fn raw_attribute<T: Copy + Send + Sync + 'static>( - &mut self, - attribute: usize, - value: T, - ) { - self.proc_thread_attributes.insert( - attribute, - ProcThreadAttributeValue { size: mem::size_of::<T>(), data: Box::new(value) }, - ); - } - - pub fn spawn( - &mut self, - default: Stdio, - needs_stdin: bool, - ) -> io::Result<(Process, StdioPipes)> { - let maybe_env = self.env.capture_if_changed(); - - let child_paths = if let Some(env) = maybe_env.as_ref() { - env.get(&EnvKey::new("PATH")).map(|s| s.as_os_str()) - } else { - None - }; - let program = resolve_exe(&self.program, || env::var_os("PATH"), child_paths)?; - // Case insensitive "ends_with" of UTF-16 encoded ".bat" or ".cmd" - let is_batch_file = matches!( - program.len().checked_sub(5).and_then(|i| program.get(i..)), - Some([46, 98 | 66, 97 | 65, 116 | 84, 0] | [46, 99 | 67, 109 | 77, 100 | 68, 0]) - ); - let (program, mut cmd_str) = if is_batch_file { - ( - command_prompt()?, - args::make_bat_command_line(&program, &self.args, self.force_quotes_enabled)?, - ) - } else { - let cmd_str = make_command_line(&self.program, &self.args, self.force_quotes_enabled)?; - (program, cmd_str) - }; - cmd_str.push(0); // add null terminator - - // stolen from the libuv code. - let mut flags = self.flags | c::CREATE_UNICODE_ENVIRONMENT; - if self.detach { - flags |= c::DETACHED_PROCESS | c::CREATE_NEW_PROCESS_GROUP; - } - - let (envp, _data) = make_envp(maybe_env)?; - let (dirp, _data) = make_dirp(self.cwd.as_ref())?; - let mut pi = zeroed_process_information(); - - // Prepare all stdio handles to be inherited by the child. This - // currently involves duplicating any existing ones with the ability to - // be inherited by child processes. Note, however, that once an - // inheritable handle is created, *any* spawned child will inherit that - // handle. We only want our own child to inherit this handle, so we wrap - // the remaining portion of this spawn in a mutex. - // - // For more information, msdn also has an article about this race: - // https://support.microsoft.com/kb/315939 - static CREATE_PROCESS_LOCK: Mutex<()> = Mutex::new(()); - - let _guard = CREATE_PROCESS_LOCK.lock(); - - let mut pipes = StdioPipes { stdin: None, stdout: None, stderr: None }; - let null = Stdio::Null; - let default_stdin = if needs_stdin { &default } else { &null }; - let stdin = self.stdin.as_ref().unwrap_or(default_stdin); - let stdout = self.stdout.as_ref().unwrap_or(&default); - let stderr = self.stderr.as_ref().unwrap_or(&default); - let stdin = stdin.to_handle(c::STD_INPUT_HANDLE, &mut pipes.stdin)?; - let stdout = stdout.to_handle(c::STD_OUTPUT_HANDLE, &mut pipes.stdout)?; - let stderr = stderr.to_handle(c::STD_ERROR_HANDLE, &mut pipes.stderr)?; - - let mut si = zeroed_startupinfo(); - - // If at least one of stdin, stdout or stderr are set (i.e. are non null) - // then set the `hStd` fields in `STARTUPINFO`. - // Otherwise skip this and allow the OS to apply its default behaviour. - // This provides more consistent behaviour between Win7 and Win8+. - let is_set = |stdio: &Handle| !stdio.as_raw_handle().is_null(); - if is_set(&stderr) || is_set(&stdout) || is_set(&stdin) { - si.dwFlags |= c::STARTF_USESTDHANDLES; - si.hStdInput = stdin.as_raw_handle(); - si.hStdOutput = stdout.as_raw_handle(); - si.hStdError = stderr.as_raw_handle(); - } - - let si_ptr: *mut c::STARTUPINFOW; - - let mut proc_thread_attribute_list; - let mut si_ex; - - if !self.proc_thread_attributes.is_empty() { - si.cb = mem::size_of::<c::STARTUPINFOEXW>() as u32; - flags |= c::EXTENDED_STARTUPINFO_PRESENT; - - proc_thread_attribute_list = - make_proc_thread_attribute_list(&self.proc_thread_attributes)?; - si_ex = c::STARTUPINFOEXW { - StartupInfo: si, - lpAttributeList: proc_thread_attribute_list.0.as_mut_ptr() as _, - }; - si_ptr = &mut si_ex as *mut _ as _; - } else { - si.cb = mem::size_of::<c::STARTUPINFOW>() as c::DWORD; - si_ptr = &mut si as *mut _ as _; - } - - unsafe { - cvt(c::CreateProcessW( - program.as_ptr(), - cmd_str.as_mut_ptr(), - ptr::null_mut(), - ptr::null_mut(), - c::TRUE, - flags, - envp, - dirp, - si_ptr, - &mut pi, - )) - }?; - - unsafe { - Ok(( - Process { - handle: Handle::from_raw_handle(pi.hProcess), - main_thread_handle: Handle::from_raw_handle(pi.hThread), - }, - pipes, - )) - } - } - - pub fn output(&mut self) -> io::Result<(ExitStatus, Vec<u8>, Vec<u8>)> { - let (proc, pipes) = self.spawn(Stdio::MakePipe, false)?; - crate::sys_common::process::wait_with_output(proc, pipes) - } -} - -impl fmt::Debug for Command { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.program.fmt(f)?; - for arg in &self.args { - f.write_str(" ")?; - match arg { - Arg::Regular(s) => s.fmt(f), - Arg::Raw(s) => f.write_str(&s.to_string_lossy()), - }?; - } - Ok(()) - } -} - -// Resolve `exe_path` to the executable name. -// -// * If the path is simply a file name then use the paths given by `search_paths` to find the executable. -// * Otherwise use the `exe_path` as given. -// -// This function may also append `.exe` to the name. The rationale for doing so is as follows: -// -// It is a very strong convention that Windows executables have the `exe` extension. -// In Rust, it is common to omit this extension. -// Therefore this functions first assumes `.exe` was intended. -// It falls back to the plain file name if a full path is given and the extension is omitted -// or if only a file name is given and it already contains an extension. -fn resolve_exe<'a>( - exe_path: &'a OsStr, - parent_paths: impl FnOnce() -> Option<OsString>, - child_paths: Option<&OsStr>, -) -> io::Result<Vec<u16>> { - // Early return if there is no filename. - if exe_path.is_empty() || path::has_trailing_slash(exe_path) { - return Err(io::const_io_error!( - io::ErrorKind::InvalidInput, - "program path has no file name", - )); - } - // Test if the file name has the `exe` extension. - // This does a case-insensitive `ends_with`. - let has_exe_suffix = if exe_path.len() >= EXE_SUFFIX.len() { - exe_path.as_encoded_bytes()[exe_path.len() - EXE_SUFFIX.len()..] - .eq_ignore_ascii_case(EXE_SUFFIX.as_bytes()) - } else { - false - }; - - // If `exe_path` is an absolute path or a sub-path then don't search `PATH` for it. - if !path::is_file_name(exe_path) { - if has_exe_suffix { - // The application name is a path to a `.exe` file. - // Let `CreateProcessW` figure out if it exists or not. - return args::to_user_path(Path::new(exe_path)); - } - let mut path = PathBuf::from(exe_path); - - // Append `.exe` if not already there. - path = path::append_suffix(path, EXE_SUFFIX.as_ref()); - if let Some(path) = program_exists(&path) { - return Ok(path); - } else { - // It's ok to use `set_extension` here because the intent is to - // remove the extension that was just added. - path.set_extension(""); - return args::to_user_path(&path); - } - } else { - ensure_no_nuls(exe_path)?; - // From the `CreateProcessW` docs: - // > If the file name does not contain an extension, .exe is appended. - // Note that this rule only applies when searching paths. - let has_extension = exe_path.as_encoded_bytes().contains(&b'.'); - - // Search the directories given by `search_paths`. - let result = search_paths(parent_paths, child_paths, |mut path| { - path.push(exe_path); - if !has_extension { - path.set_extension(EXE_EXTENSION); - } - program_exists(&path) - }); - if let Some(path) = result { - return Ok(path); - } - } - // If we get here then the executable cannot be found. - Err(io::const_io_error!(io::ErrorKind::NotFound, "program not found")) -} - -// Calls `f` for every path that should be used to find an executable. -// Returns once `f` returns the path to an executable or all paths have been searched. -fn search_paths<Paths, Exists>( - parent_paths: Paths, - child_paths: Option<&OsStr>, - mut exists: Exists, -) -> Option<Vec<u16>> -where - Paths: FnOnce() -> Option<OsString>, - Exists: FnMut(PathBuf) -> Option<Vec<u16>>, -{ - // 1. Child paths - // This is for consistency with Rust's historic behaviour. - if let Some(paths) = child_paths { - for path in env::split_paths(paths).filter(|p| !p.as_os_str().is_empty()) { - if let Some(path) = exists(path) { - return Some(path); - } - } - } - - // 2. Application path - if let Ok(mut app_path) = env::current_exe() { - app_path.pop(); - if let Some(path) = exists(app_path) { - return Some(path); - } - } - - // 3 & 4. System paths - // SAFETY: This uses `fill_utf16_buf` to safely call the OS functions. - unsafe { - if let Ok(Some(path)) = super::fill_utf16_buf( - |buf, size| c::GetSystemDirectoryW(buf, size), - |buf| exists(PathBuf::from(OsString::from_wide(buf))), - ) { - return Some(path); - } - #[cfg(not(target_vendor = "uwp"))] - { - if let Ok(Some(path)) = super::fill_utf16_buf( - |buf, size| c::GetWindowsDirectoryW(buf, size), - |buf| exists(PathBuf::from(OsString::from_wide(buf))), - ) { - return Some(path); - } - } - } - - // 5. Parent paths - if let Some(parent_paths) = parent_paths() { - for path in env::split_paths(&parent_paths).filter(|p| !p.as_os_str().is_empty()) { - if let Some(path) = exists(path) { - return Some(path); - } - } - } - None -} - -/// Check if a file exists without following symlinks. -fn program_exists(path: &Path) -> Option<Vec<u16>> { - unsafe { - let path = args::to_user_path(path).ok()?; - // Getting attributes using `GetFileAttributesW` does not follow symlinks - // and it will almost always be successful if the link exists. - // There are some exceptions for special system files (e.g. the pagefile) - // but these are not executable. - if c::GetFileAttributesW(path.as_ptr()) == c::INVALID_FILE_ATTRIBUTES { - None - } else { - Some(path) - } - } -} - -impl Stdio { - fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> { - let use_stdio_id = |stdio_id| match stdio::get_handle(stdio_id) { - Ok(io) => unsafe { - let io = Handle::from_raw_handle(io); - let ret = io.duplicate(0, true, c::DUPLICATE_SAME_ACCESS); - io.into_raw_handle(); - ret - }, - // If no stdio handle is available, then propagate the null value. - Err(..) => unsafe { Ok(Handle::from_raw_handle(ptr::null_mut())) }, - }; - match *self { - Stdio::Inherit => use_stdio_id(stdio_id), - Stdio::InheritSpecific { from_stdio_id } => use_stdio_id(from_stdio_id), - - Stdio::MakePipe => { - let ours_readable = stdio_id != c::STD_INPUT_HANDLE; - let pipes = pipe::anon_pipe(ours_readable, true)?; - *pipe = Some(pipes.ours); - Ok(pipes.theirs.into_handle()) - } - - Stdio::Pipe(ref source) => { - let ours_readable = stdio_id != c::STD_INPUT_HANDLE; - pipe::spawn_pipe_relay(source, ours_readable, true).map(AnonPipe::into_handle) - } - - Stdio::Handle(ref handle) => handle.duplicate(0, true, c::DUPLICATE_SAME_ACCESS), - - // Open up a reference to NUL with appropriate read/write - // permissions as well as the ability to be inherited to child - // processes (as this is about to be inherited). - Stdio::Null => { - let size = mem::size_of::<c::SECURITY_ATTRIBUTES>(); - let mut sa = c::SECURITY_ATTRIBUTES { - nLength: size as c::DWORD, - lpSecurityDescriptor: ptr::null_mut(), - bInheritHandle: 1, - }; - let mut opts = OpenOptions::new(); - opts.read(stdio_id == c::STD_INPUT_HANDLE); - opts.write(stdio_id != c::STD_INPUT_HANDLE); - opts.security_attributes(&mut sa); - File::open(Path::new(r"\\.\NUL"), &opts).map(|file| file.into_inner()) - } - } - } -} - -impl From<AnonPipe> for Stdio { - fn from(pipe: AnonPipe) -> Stdio { - Stdio::Pipe(pipe) - } -} - -impl From<File> for Stdio { - fn from(file: File) -> Stdio { - Stdio::Handle(file.into_inner()) - } -} - -impl From<io::Stdout> for Stdio { - fn from(_: io::Stdout) -> Stdio { - Stdio::InheritSpecific { from_stdio_id: c::STD_OUTPUT_HANDLE } - } -} - -impl From<io::Stderr> for Stdio { - fn from(_: io::Stderr) -> Stdio { - Stdio::InheritSpecific { from_stdio_id: c::STD_ERROR_HANDLE } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Processes -//////////////////////////////////////////////////////////////////////////////// - -/// A value representing a child process. -/// -/// The lifetime of this value is linked to the lifetime of the actual -/// process - the Process destructor calls self.finish() which waits -/// for the process to terminate. -pub struct Process { - handle: Handle, - main_thread_handle: Handle, -} - -impl Process { - pub fn kill(&mut self) -> io::Result<()> { - let result = unsafe { c::TerminateProcess(self.handle.as_raw_handle(), 1) }; - if result == c::FALSE { - let error = unsafe { c::GetLastError() }; - // TerminateProcess returns ERROR_ACCESS_DENIED if the process has already been - // terminated (by us, or for any other reason). So check if the process was actually - // terminated, and if so, do not return an error. - if error != c::ERROR_ACCESS_DENIED || self.try_wait().is_err() { - return Err(crate::io::Error::from_raw_os_error(error as i32)); - } - } - Ok(()) - } - - pub fn id(&self) -> u32 { - unsafe { c::GetProcessId(self.handle.as_raw_handle()) } - } - - pub fn main_thread_handle(&self) -> BorrowedHandle<'_> { - self.main_thread_handle.as_handle() - } - - pub fn wait(&mut self) -> io::Result<ExitStatus> { - unsafe { - let res = c::WaitForSingleObject(self.handle.as_raw_handle(), c::INFINITE); - if res != c::WAIT_OBJECT_0 { - return Err(Error::last_os_error()); - } - let mut status = 0; - cvt(c::GetExitCodeProcess(self.handle.as_raw_handle(), &mut status))?; - Ok(ExitStatus(status)) - } - } - - pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> { - unsafe { - match c::WaitForSingleObject(self.handle.as_raw_handle(), 0) { - c::WAIT_OBJECT_0 => {} - c::WAIT_TIMEOUT => { - return Ok(None); - } - _ => return Err(io::Error::last_os_error()), - } - let mut status = 0; - cvt(c::GetExitCodeProcess(self.handle.as_raw_handle(), &mut status))?; - Ok(Some(ExitStatus(status))) - } - } - - pub fn handle(&self) -> &Handle { - &self.handle - } - - pub fn into_handle(self) -> Handle { - self.handle - } -} - -#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)] -pub struct ExitStatus(c::DWORD); - -impl ExitStatus { - pub fn exit_ok(&self) -> Result<(), ExitStatusError> { - match NonZeroDWORD::try_from(self.0) { - /* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)), - /* was zero, couldn't convert */ Err(_) => Ok(()), - } - } - pub fn code(&self) -> Option<i32> { - Some(self.0 as i32) - } -} - -/// Converts a raw `c::DWORD` to a type-safe `ExitStatus` by wrapping it without copying. -impl From<c::DWORD> for ExitStatus { - fn from(u: c::DWORD) -> ExitStatus { - ExitStatus(u) - } -} - -impl fmt::Display for ExitStatus { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // Windows exit codes with the high bit set typically mean some form of - // unhandled exception or warning. In this scenario printing the exit - // code in decimal doesn't always make sense because it's a very large - // and somewhat gibberish number. The hex code is a bit more - // recognizable and easier to search for, so print that. - if self.0 & 0x80000000 != 0 { - write!(f, "exit code: {:#x}", self.0) - } else { - write!(f, "exit code: {}", self.0) - } - } -} - -#[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub struct ExitStatusError(c::NonZeroDWORD); - -impl Into<ExitStatus> for ExitStatusError { - fn into(self) -> ExitStatus { - ExitStatus(self.0.into()) - } -} - -impl ExitStatusError { - pub fn code(self) -> Option<NonZeroI32> { - Some((u32::from(self.0) as i32).try_into().unwrap()) - } -} - -#[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub struct ExitCode(c::DWORD); - -impl ExitCode { - pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _); - pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _); - - #[inline] - pub fn as_i32(&self) -> i32 { - self.0 as i32 - } -} - -impl From<u8> for ExitCode { - fn from(code: u8) -> Self { - ExitCode(c::DWORD::from(code)) - } -} - -impl From<u32> for ExitCode { - fn from(code: u32) -> Self { - ExitCode(c::DWORD::from(code)) - } -} - -fn zeroed_startupinfo() -> c::STARTUPINFOW { - c::STARTUPINFOW { - cb: 0, - lpReserved: ptr::null_mut(), - lpDesktop: ptr::null_mut(), - lpTitle: ptr::null_mut(), - dwX: 0, - dwY: 0, - dwXSize: 0, - dwYSize: 0, - dwXCountChars: 0, - dwYCountChars: 0, - dwFillAttribute: 0, - dwFlags: 0, - wShowWindow: 0, - cbReserved2: 0, - lpReserved2: ptr::null_mut(), - hStdInput: ptr::null_mut(), - hStdOutput: ptr::null_mut(), - hStdError: ptr::null_mut(), - } -} - -fn zeroed_process_information() -> c::PROCESS_INFORMATION { - c::PROCESS_INFORMATION { - hProcess: ptr::null_mut(), - hThread: ptr::null_mut(), - dwProcessId: 0, - dwThreadId: 0, - } -} - -// Produces a wide string *without terminating null*; returns an error if -// `prog` or any of the `args` contain a nul. -fn make_command_line(argv0: &OsStr, args: &[Arg], force_quotes: bool) -> io::Result<Vec<u16>> { - // Encode the command and arguments in a command line string such - // that the spawned process may recover them using CommandLineToArgvW. - let mut cmd: Vec<u16> = Vec::new(); - - // Always quote the program name so CreateProcess to avoid ambiguity when - // the child process parses its arguments. - // Note that quotes aren't escaped here because they can't be used in arg0. - // But that's ok because file paths can't contain quotes. - cmd.push(b'"' as u16); - cmd.extend(argv0.encode_wide()); - cmd.push(b'"' as u16); - - for arg in args { - cmd.push(' ' as u16); - args::append_arg(&mut cmd, arg, force_quotes)?; - } - Ok(cmd) -} - -// Get `cmd.exe` for use with bat scripts, encoded as a UTF-16 string. -fn command_prompt() -> io::Result<Vec<u16>> { - let mut system: Vec<u16> = super::fill_utf16_buf( - |buf, size| unsafe { c::GetSystemDirectoryW(buf, size) }, - |buf| buf.into(), - )?; - system.extend("\\cmd.exe".encode_utf16().chain([0])); - Ok(system) -} - -fn make_envp(maybe_env: Option<BTreeMap<EnvKey, OsString>>) -> io::Result<(*mut c_void, Vec<u16>)> { - // On Windows we pass an "environment block" which is not a char**, but - // rather a concatenation of null-terminated k=v\0 sequences, with a final - // \0 to terminate. - if let Some(env) = maybe_env { - let mut blk = Vec::new(); - - // If there are no environment variables to set then signal this by - // pushing a null. - if env.is_empty() { - blk.push(0); - } - - for (k, v) in env { - ensure_no_nuls(k.os_string)?; - blk.extend(k.utf16); - blk.push('=' as u16); - blk.extend(ensure_no_nuls(v)?.encode_wide()); - blk.push(0); - } - blk.push(0); - Ok((blk.as_mut_ptr() as *mut c_void, blk)) - } else { - Ok((ptr::null_mut(), Vec::new())) - } -} - -fn make_dirp(d: Option<&OsString>) -> io::Result<(*const u16, Vec<u16>)> { - match d { - Some(dir) => { - let mut dir_str: Vec<u16> = ensure_no_nuls(dir)?.encode_wide().collect(); - dir_str.push(0); - Ok((dir_str.as_ptr(), dir_str)) - } - None => Ok((ptr::null(), Vec::new())), - } -} - -struct ProcThreadAttributeList(Box<[MaybeUninit<u8>]>); - -impl Drop for ProcThreadAttributeList { - fn drop(&mut self) { - let lp_attribute_list = self.0.as_mut_ptr() as _; - unsafe { c::DeleteProcThreadAttributeList(lp_attribute_list) } - } -} - -/// Wrapper around the value data to be used as a Process Thread Attribute. -struct ProcThreadAttributeValue { - data: Box<dyn Send + Sync>, - size: usize, -} - -fn make_proc_thread_attribute_list( - attributes: &BTreeMap<usize, ProcThreadAttributeValue>, -) -> io::Result<ProcThreadAttributeList> { - // To initialize our ProcThreadAttributeList, we need to determine - // how many bytes to allocate for it. The Windows API simplifies this process - // by allowing us to call `InitializeProcThreadAttributeList` with - // a null pointer to retrieve the required size. - let mut required_size = 0; - let Ok(attribute_count) = attributes.len().try_into() else { - return Err(io::const_io_error!( - ErrorKind::InvalidInput, - "maximum number of ProcThreadAttributes exceeded", - )); - }; - unsafe { - c::InitializeProcThreadAttributeList( - ptr::null_mut(), - attribute_count, - 0, - &mut required_size, - ) - }; - - let mut proc_thread_attribute_list = - ProcThreadAttributeList(vec![MaybeUninit::uninit(); required_size].into_boxed_slice()); - - // Once we've allocated the necessary memory, it's safe to invoke - // `InitializeProcThreadAttributeList` to properly initialize the list. - cvt(unsafe { - c::InitializeProcThreadAttributeList( - proc_thread_attribute_list.0.as_mut_ptr() as *mut _, - attribute_count, - 0, - &mut required_size, - ) - })?; - - // # Add our attributes to the buffer. - // It's theoretically possible for the attribute count to exceed a u32 value. - // Therefore, we ensure that we don't add more attributes than the buffer was initialized for. - for (&attribute, value) in attributes.iter().take(attribute_count as usize) { - let value_ptr = &*value.data as *const (dyn Send + Sync) as _; - cvt(unsafe { - c::UpdateProcThreadAttribute( - proc_thread_attribute_list.0.as_mut_ptr() as _, - 0, - attribute, - value_ptr, - value.size, - ptr::null_mut(), - ptr::null_mut(), - ) - })?; - } - - Ok(proc_thread_attribute_list) -} - -pub struct CommandArgs<'a> { - iter: crate::slice::Iter<'a, Arg>, -} - -impl<'a> Iterator for CommandArgs<'a> { - type Item = &'a OsStr; - fn next(&mut self) -> Option<&'a OsStr> { - self.iter.next().map(|arg| match arg { - Arg::Regular(s) | Arg::Raw(s) => s.as_ref(), - }) - } - fn size_hint(&self) -> (usize, Option<usize>) { - self.iter.size_hint() - } -} - -impl<'a> ExactSizeIterator for CommandArgs<'a> { - fn len(&self) -> usize { - self.iter.len() - } - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -impl<'a> fmt::Debug for CommandArgs<'a> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_list().entries(self.iter.clone()).finish() - } -} diff --git a/library/std/src/sys/windows/process/tests.rs b/library/std/src/sys/windows/process/tests.rs deleted file mode 100644 index 3fc0c75240c..00000000000 --- a/library/std/src/sys/windows/process/tests.rs +++ /dev/null @@ -1,222 +0,0 @@ -use super::make_command_line; -use super::Arg; -use crate::env; -use crate::ffi::{OsStr, OsString}; -use crate::process::Command; - -#[test] -fn test_raw_args() { - let command_line = &make_command_line( - OsStr::new("quoted exe"), - &[ - Arg::Regular(OsString::from("quote me")), - Arg::Raw(OsString::from("quote me *not*")), - Arg::Raw(OsString::from("\t\\")), - Arg::Raw(OsString::from("internal \\\"backslash-\"quote")), - Arg::Regular(OsString::from("optional-quotes")), - ], - false, - ) - .unwrap(); - assert_eq!( - String::from_utf16(command_line).unwrap(), - "\"quoted exe\" \"quote me\" quote me *not* \t\\ internal \\\"backslash-\"quote optional-quotes" - ); -} - -#[test] -fn test_thread_handle() { - use crate::os::windows::io::BorrowedHandle; - use crate::os::windows::process::{ChildExt, CommandExt}; - const CREATE_SUSPENDED: u32 = 0x00000004; - - let p = Command::new("cmd").args(&["/C", "exit 0"]).creation_flags(CREATE_SUSPENDED).spawn(); - assert!(p.is_ok()); - let mut p = p.unwrap(); - - extern "system" { - fn ResumeThread(_: BorrowedHandle<'_>) -> u32; - } - unsafe { - ResumeThread(p.main_thread_handle()); - } - - crate::thread::sleep(crate::time::Duration::from_millis(100)); - - let res = p.try_wait(); - assert!(res.is_ok()); - assert!(res.unwrap().is_some()); - assert!(p.try_wait().unwrap().unwrap().success()); -} - -#[test] -fn test_make_command_line() { - fn test_wrapper(prog: &str, args: &[&str], force_quotes: bool) -> String { - let command_line = &make_command_line( - OsStr::new(prog), - &args.iter().map(|a| Arg::Regular(OsString::from(a))).collect::<Vec<_>>(), - force_quotes, - ) - .unwrap(); - String::from_utf16(command_line).unwrap() - } - - assert_eq!(test_wrapper("prog", &["aaa", "bbb", "ccc"], false), "\"prog\" aaa bbb ccc"); - - assert_eq!(test_wrapper("prog", &[r"C:\"], false), r#""prog" C:\"#); - assert_eq!(test_wrapper("prog", &[r"2slashes\\"], false), r#""prog" 2slashes\\"#); - assert_eq!(test_wrapper("prog", &[r" C:\"], false), r#""prog" " C:\\""#); - assert_eq!(test_wrapper("prog", &[r" 2slashes\\"], false), r#""prog" " 2slashes\\\\""#); - - assert_eq!( - test_wrapper("C:\\Program Files\\blah\\blah.exe", &["aaa"], false), - "\"C:\\Program Files\\blah\\blah.exe\" aaa" - ); - assert_eq!( - test_wrapper("C:\\Program Files\\blah\\blah.exe", &["aaa", "v*"], false), - "\"C:\\Program Files\\blah\\blah.exe\" aaa v*" - ); - assert_eq!( - test_wrapper("C:\\Program Files\\blah\\blah.exe", &["aaa", "v*"], true), - "\"C:\\Program Files\\blah\\blah.exe\" \"aaa\" \"v*\"" - ); - assert_eq!( - test_wrapper("C:\\Program Files\\test", &["aa\"bb"], false), - "\"C:\\Program Files\\test\" aa\\\"bb" - ); - assert_eq!(test_wrapper("echo", &["a b c"], false), "\"echo\" \"a b c\""); - assert_eq!( - test_wrapper("echo", &["\" \\\" \\", "\\"], false), - "\"echo\" \"\\\" \\\\\\\" \\\\\" \\" - ); - assert_eq!( - test_wrapper("\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}", &[], false), - "\"\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}\"" - ); -} - -// On Windows, environment args are case preserving but comparisons are case-insensitive. -// See: #85242 -#[test] -fn windows_env_unicode_case() { - let test_cases = [ - ("ä", "Ä"), - ("ß", "SS"), - ("Ä", "Ö"), - ("Ä", "Ö"), - ("I", "İ"), - ("I", "i"), - ("I", "ı"), - ("i", "I"), - ("i", "İ"), - ("i", "ı"), - ("İ", "I"), - ("İ", "i"), - ("İ", "ı"), - ("ı", "I"), - ("ı", "i"), - ("ı", "İ"), - ("ä", "Ä"), - ("ß", "SS"), - ("Ä", "Ö"), - ("Ä", "Ö"), - ("I", "İ"), - ("I", "i"), - ("I", "ı"), - ("i", "I"), - ("i", "İ"), - ("i", "ı"), - ("İ", "I"), - ("İ", "i"), - ("İ", "ı"), - ("ı", "I"), - ("ı", "i"), - ("ı", "İ"), - ]; - // Test that `cmd.env` matches `env::set_var` when setting two strings that - // may (or may not) be case-folded when compared. - for (a, b) in test_cases.iter() { - let mut cmd = Command::new("cmd"); - cmd.env(a, "1"); - cmd.env(b, "2"); - env::set_var(a, "1"); - env::set_var(b, "2"); - - for (key, value) in cmd.get_envs() { - assert_eq!( - env::var(key).ok(), - value.map(|s| s.to_string_lossy().into_owned()), - "command environment mismatch: {a} {b}", - ); - } - } -} - -// UWP applications run in a restricted environment which means this test may not work. -#[cfg(not(target_vendor = "uwp"))] -#[test] -fn windows_exe_resolver() { - use super::resolve_exe; - use crate::io; - use crate::sys::fs::symlink; - use crate::sys_common::io::test::tmpdir; - - let env_paths = || env::var_os("PATH"); - - // Test a full path, with and without the `exe` extension. - let mut current_exe = env::current_exe().unwrap(); - assert!(resolve_exe(current_exe.as_ref(), env_paths, None).is_ok()); - current_exe.set_extension(""); - assert!(resolve_exe(current_exe.as_ref(), env_paths, None).is_ok()); - - // Test lone file names. - assert!(resolve_exe(OsStr::new("cmd"), env_paths, None).is_ok()); - assert!(resolve_exe(OsStr::new("cmd.exe"), env_paths, None).is_ok()); - assert!(resolve_exe(OsStr::new("cmd.EXE"), env_paths, None).is_ok()); - assert!(resolve_exe(OsStr::new("fc"), env_paths, None).is_ok()); - - // Invalid file names should return InvalidInput. - assert_eq!( - resolve_exe(OsStr::new(""), env_paths, None).unwrap_err().kind(), - io::ErrorKind::InvalidInput - ); - assert_eq!( - resolve_exe(OsStr::new("\0"), env_paths, None).unwrap_err().kind(), - io::ErrorKind::InvalidInput - ); - // Trailing slash, therefore there's no file name component. - assert_eq!( - resolve_exe(OsStr::new(r"C:\Path\to\"), env_paths, None).unwrap_err().kind(), - io::ErrorKind::InvalidInput - ); - - /* - Some of the following tests may need to be changed if you are deliberately - changing the behaviour of `resolve_exe`. - */ - - let empty_paths = || None; - - // The resolver looks in system directories even when `PATH` is empty. - assert!(resolve_exe(OsStr::new("cmd.exe"), empty_paths, None).is_ok()); - - // The application's directory is also searched. - let current_exe = env::current_exe().unwrap(); - assert!(resolve_exe(current_exe.file_name().unwrap().as_ref(), empty_paths, None).is_ok()); - - // Create a temporary path and add a broken symlink. - let temp = tmpdir(); - let mut exe_path = temp.path().to_owned(); - exe_path.push("exists.exe"); - - // A broken symlink should still be resolved. - // Skip this check if not in CI and creating symlinks isn't possible. - let is_ci = env::var("CI").is_ok(); - let result = symlink("<DOES NOT EXIST>".as_ref(), &exe_path); - if is_ci || result.is_ok() { - result.unwrap(); - assert!( - resolve_exe(OsStr::new("exists.exe"), empty_paths, Some(temp.path().as_ref())).is_ok() - ); - } -} diff --git a/library/std/src/sys/windows/rand.rs b/library/std/src/sys/windows/rand.rs deleted file mode 100644 index 5d8fd13785a..00000000000 --- a/library/std/src/sys/windows/rand.rs +++ /dev/null @@ -1,42 +0,0 @@ -use crate::mem; -use crate::ptr; -use crate::sys::c; - -pub fn hashmap_random_keys() -> (u64, u64) { - let mut v = (0, 0); - let ret = unsafe { - c::BCryptGenRandom( - ptr::null_mut(), - &mut v as *mut _ as *mut u8, - mem::size_of_val(&v) as c::ULONG, - c::BCRYPT_USE_SYSTEM_PREFERRED_RNG, - ) - }; - if c::nt_success(ret) { v } else { fallback_rng() } -} - -/// Generate random numbers using the fallback RNG function (RtlGenRandom) -/// -/// This is necessary because of a failure to load the SysWOW64 variant of the -/// bcryptprimitives.dll library from code that lives in bcrypt.dll -/// See <https://bugzilla.mozilla.org/show_bug.cgi?id=1788004#c9> -#[cfg(not(target_vendor = "uwp"))] -#[inline(never)] -fn fallback_rng() -> (u64, u64) { - use crate::ffi::c_void; - use crate::io; - - let mut v = (0, 0); - let ret = unsafe { - c::RtlGenRandom(&mut v as *mut _ as *mut c_void, mem::size_of_val(&v) as c::ULONG) - }; - - if ret != 0 { v } else { panic!("fallback RNG broken: {}", io::Error::last_os_error()) } -} - -/// We can't use RtlGenRandom with UWP, so there is no fallback -#[cfg(target_vendor = "uwp")] -#[inline(never)] -fn fallback_rng() -> (u64, u64) { - panic!("fallback RNG broken: RtlGenRandom() not supported on UWP"); -} diff --git a/library/std/src/sys/windows/stack_overflow.rs b/library/std/src/sys/windows/stack_overflow.rs deleted file mode 100644 index 627763da856..00000000000 --- a/library/std/src/sys/windows/stack_overflow.rs +++ /dev/null @@ -1,44 +0,0 @@ -#![cfg_attr(test, allow(dead_code))] - -use crate::sys::c; -use crate::thread; - -use super::api; - -pub struct Handler; - -impl Handler { - pub unsafe fn new() -> Handler { - // This API isn't available on XP, so don't panic in that case and just - // pray it works out ok. - if c::SetThreadStackGuarantee(&mut 0x5000) == 0 - && api::get_last_error().code != c::ERROR_CALL_NOT_IMPLEMENTED - { - panic!("failed to reserve stack space for exception handling"); - } - Handler - } -} - -unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -> c::LONG { - unsafe { - let rec = &(*(*ExceptionInfo).ExceptionRecord); - let code = rec.ExceptionCode; - - if code == c::EXCEPTION_STACK_OVERFLOW { - rtprintpanic!( - "\nthread '{}' has overflowed its stack\n", - thread::current().name().unwrap_or("<unknown>") - ); - } - c::EXCEPTION_CONTINUE_SEARCH - } -} - -pub unsafe fn init() { - if c::AddVectoredExceptionHandler(0, Some(vectored_handler)).is_null() { - panic!("failed to install exception handler"); - } - // Set the thread stack guarantee for the main thread. - let _h = Handler::new(); -} diff --git a/library/std/src/sys/windows/stack_overflow_uwp.rs b/library/std/src/sys/windows/stack_overflow_uwp.rs deleted file mode 100644 index afdf7f566ae..00000000000 --- a/library/std/src/sys/windows/stack_overflow_uwp.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![cfg_attr(test, allow(dead_code))] - -pub struct Handler; - -impl Handler { - pub fn new() -> Handler { - Handler - } -} - -pub unsafe fn init() {} diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/windows/stdio.rs deleted file mode 100644 index 819a48266d9..00000000000 --- a/library/std/src/sys/windows/stdio.rs +++ /dev/null @@ -1,462 +0,0 @@ -#![unstable(issue = "none", feature = "windows_stdio")] - -use crate::cmp; -use crate::io; -use crate::mem::MaybeUninit; -use crate::os::windows::io::{FromRawHandle, IntoRawHandle}; -use crate::ptr; -use crate::str; -use crate::sys::c; -use crate::sys::cvt; -use crate::sys::handle::Handle; -use crate::sys::windows::api; -use core::str::utf8_char_width; - -#[cfg(test)] -mod tests; - -// Don't cache handles but get them fresh for every read/write. This allows us to track changes to -// the value over time (such as if a process calls `SetStdHandle` while it's running). See #40490. -pub struct Stdin { - surrogate: u16, - incomplete_utf8: IncompleteUtf8, -} - -pub struct Stdout { - incomplete_utf8: IncompleteUtf8, -} - -pub struct Stderr { - incomplete_utf8: IncompleteUtf8, -} - -struct IncompleteUtf8 { - bytes: [u8; 4], - len: u8, -} - -impl IncompleteUtf8 { - // Implemented for use in Stdin::read. - fn read(&mut self, buf: &mut [u8]) -> usize { - // Write to buffer until the buffer is full or we run out of bytes. - let to_write = cmp::min(buf.len(), self.len as usize); - buf[..to_write].copy_from_slice(&self.bytes[..to_write]); - - // Rotate the remaining bytes if not enough remaining space in buffer. - if usize::from(self.len) > buf.len() { - self.bytes.copy_within(to_write.., 0); - self.len -= to_write as u8; - } else { - self.len = 0; - } - - to_write - } -} - -// Apparently Windows doesn't handle large reads on stdin or writes to stdout/stderr well (see -// #13304 for details). -// -// From MSDN (2011): "The storage for this buffer is allocated from a shared heap for the -// process that is 64 KB in size. The maximum size of the buffer will depend on heap usage." -// -// We choose the cap at 8 KiB because libuv does the same, and it seems to be acceptable so far. -const MAX_BUFFER_SIZE: usize = 8192; - -// The standard buffer size of BufReader for Stdin should be able to hold 3x more bytes than there -// are `u16`'s in MAX_BUFFER_SIZE. This ensures the read data can always be completely decoded from -// UTF-16 to UTF-8. -pub const STDIN_BUF_SIZE: usize = MAX_BUFFER_SIZE / 2 * 3; - -pub fn get_handle(handle_id: c::DWORD) -> io::Result<c::HANDLE> { - let handle = unsafe { c::GetStdHandle(handle_id) }; - if handle == c::INVALID_HANDLE_VALUE { - Err(io::Error::last_os_error()) - } else if handle.is_null() { - Err(io::Error::from_raw_os_error(c::ERROR_INVALID_HANDLE as i32)) - } else { - Ok(handle) - } -} - -fn is_console(handle: c::HANDLE) -> bool { - // `GetConsoleMode` will return false (0) if this is a pipe (we don't care about the reported - // mode). This will only detect Windows Console, not other terminals connected to a pipe like - // MSYS. Which is exactly what we need, as only Windows Console needs a conversion to UTF-16. - let mut mode = 0; - unsafe { c::GetConsoleMode(handle, &mut mode) != 0 } -} - -fn write( - handle_id: c::DWORD, - data: &[u8], - incomplete_utf8: &mut IncompleteUtf8, -) -> io::Result<usize> { - if data.is_empty() { - return Ok(0); - } - - let handle = get_handle(handle_id)?; - if !is_console(handle) { - unsafe { - let handle = Handle::from_raw_handle(handle); - let ret = handle.write(data); - handle.into_raw_handle(); // Don't close the handle - return ret; - } - } - - if incomplete_utf8.len > 0 { - assert!( - incomplete_utf8.len < 4, - "Unexpected number of bytes for incomplete UTF-8 codepoint." - ); - if data[0] >> 6 != 0b10 { - // not a continuation byte - reject - incomplete_utf8.len = 0; - return Err(io::const_io_error!( - io::ErrorKind::InvalidData, - "Windows stdio in console mode does not support writing non-UTF-8 byte sequences", - )); - } - incomplete_utf8.bytes[incomplete_utf8.len as usize] = data[0]; - incomplete_utf8.len += 1; - let char_width = utf8_char_width(incomplete_utf8.bytes[0]); - if (incomplete_utf8.len as usize) < char_width { - // more bytes needed - return Ok(1); - } - let s = str::from_utf8(&incomplete_utf8.bytes[0..incomplete_utf8.len as usize]); - incomplete_utf8.len = 0; - match s { - Ok(s) => { - assert_eq!(char_width, s.len()); - let written = write_valid_utf8_to_console(handle, s)?; - assert_eq!(written, s.len()); // guaranteed by write_valid_utf8_to_console() for single codepoint writes - return Ok(1); - } - Err(_) => { - return Err(io::const_io_error!( - io::ErrorKind::InvalidData, - "Windows stdio in console mode does not support writing non-UTF-8 byte sequences", - )); - } - } - } - - // As the console is meant for presenting text, we assume bytes of `data` are encoded as UTF-8, - // which needs to be encoded as UTF-16. - // - // If the data is not valid UTF-8 we write out as many bytes as are valid. - // If the first byte is invalid it is either first byte of a multi-byte sequence but the - // provided byte slice is too short or it is the first byte of an invalid multi-byte sequence. - let len = cmp::min(data.len(), MAX_BUFFER_SIZE / 2); - let utf8 = match str::from_utf8(&data[..len]) { - Ok(s) => s, - Err(ref e) if e.valid_up_to() == 0 => { - let first_byte_char_width = utf8_char_width(data[0]); - if first_byte_char_width > 1 && data.len() < first_byte_char_width { - incomplete_utf8.bytes[0] = data[0]; - incomplete_utf8.len = 1; - return Ok(1); - } else { - return Err(io::const_io_error!( - io::ErrorKind::InvalidData, - "Windows stdio in console mode does not support writing non-UTF-8 byte sequences", - )); - } - } - Err(e) => str::from_utf8(&data[..e.valid_up_to()]).unwrap(), - }; - - write_valid_utf8_to_console(handle, utf8) -} - -fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usize> { - debug_assert!(!utf8.is_empty()); - - let mut utf16 = [MaybeUninit::<u16>::uninit(); MAX_BUFFER_SIZE / 2]; - let utf8 = &utf8[..utf8.floor_char_boundary(utf16.len())]; - - let utf16: &[u16] = unsafe { - // Note that this theoretically checks validity twice in the (most common) case - // where the underlying byte sequence is valid utf-8 (given the check in `write()`). - let result = c::MultiByteToWideChar( - c::CP_UTF8, // CodePage - c::MB_ERR_INVALID_CHARS, // dwFlags - utf8.as_ptr(), // lpMultiByteStr - utf8.len() as c::c_int, // cbMultiByte - utf16.as_mut_ptr() as c::LPWSTR, // lpWideCharStr - utf16.len() as c::c_int, // cchWideChar - ); - assert!(result != 0, "Unexpected error in MultiByteToWideChar"); - - // Safety: MultiByteToWideChar initializes `result` values. - MaybeUninit::slice_assume_init_ref(&utf16[..result as usize]) - }; - - let mut written = write_u16s(handle, utf16)?; - - // Figure out how many bytes of as UTF-8 were written away as UTF-16. - if written == utf16.len() { - Ok(utf8.len()) - } else { - // Make sure we didn't end up writing only half of a surrogate pair (even though the chance - // is tiny). Because it is not possible for user code to re-slice `data` in such a way that - // a missing surrogate can be produced (and also because of the UTF-8 validation above), - // write the missing surrogate out now. - // Buffering it would mean we have to lie about the number of bytes written. - let first_code_unit_remaining = utf16[written]; - if matches!(first_code_unit_remaining, 0xDCEE..=0xDFFF) { - // low surrogate - // We just hope this works, and give up otherwise - let _ = write_u16s(handle, &utf16[written..written + 1]); - written += 1; - } - // Calculate the number of bytes of `utf8` that were actually written. - let mut count = 0; - for ch in utf16[..written].iter() { - count += match ch { - 0x0000..=0x007F => 1, - 0x0080..=0x07FF => 2, - 0xDCEE..=0xDFFF => 1, // Low surrogate. We already counted 3 bytes for the other. - _ => 3, - }; - } - debug_assert!(String::from_utf16(&utf16[..written]).unwrap() == utf8[..count]); - Ok(count) - } -} - -fn write_u16s(handle: c::HANDLE, data: &[u16]) -> io::Result<usize> { - debug_assert!(data.len() < u32::MAX as usize); - let mut written = 0; - cvt(unsafe { - c::WriteConsoleW( - handle, - data.as_ptr() as c::LPCVOID, - data.len() as u32, - &mut written, - ptr::null_mut(), - ) - })?; - Ok(written as usize) -} - -impl Stdin { - pub const fn new() -> Stdin { - Stdin { surrogate: 0, incomplete_utf8: IncompleteUtf8::new() } - } -} - -impl io::Read for Stdin { - fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { - let handle = get_handle(c::STD_INPUT_HANDLE)?; - if !is_console(handle) { - unsafe { - let handle = Handle::from_raw_handle(handle); - let ret = handle.read(buf); - handle.into_raw_handle(); // Don't close the handle - return ret; - } - } - - // If there are bytes in the incomplete utf-8, start with those. - // (No-op if there is nothing in the buffer.) - let mut bytes_copied = self.incomplete_utf8.read(buf); - - if bytes_copied == buf.len() { - Ok(bytes_copied) - } else if buf.len() - bytes_copied < 4 { - // Not enough space to get a UTF-8 byte. We will use the incomplete UTF8. - let mut utf16_buf = [MaybeUninit::new(0); 1]; - // Read one u16 character. - let read = read_u16s_fixup_surrogates(handle, &mut utf16_buf, 1, &mut self.surrogate)?; - // Read bytes, using the (now-empty) self.incomplete_utf8 as extra space. - let read_bytes = utf16_to_utf8( - unsafe { MaybeUninit::slice_assume_init_ref(&utf16_buf[..read]) }, - &mut self.incomplete_utf8.bytes, - )?; - - // Read in the bytes from incomplete_utf8 until the buffer is full. - self.incomplete_utf8.len = read_bytes as u8; - // No-op if no bytes. - bytes_copied += self.incomplete_utf8.read(&mut buf[bytes_copied..]); - Ok(bytes_copied) - } else { - let mut utf16_buf = [MaybeUninit::<u16>::uninit(); MAX_BUFFER_SIZE / 2]; - - // In the worst case, a UTF-8 string can take 3 bytes for every `u16` of a UTF-16. So - // we can read at most a third of `buf.len()` chars and uphold the guarantee no data gets - // lost. - let amount = cmp::min(buf.len() / 3, utf16_buf.len()); - let read = - read_u16s_fixup_surrogates(handle, &mut utf16_buf, amount, &mut self.surrogate)?; - // Safety `read_u16s_fixup_surrogates` returns the number of items - // initialized. - let utf16s = unsafe { MaybeUninit::slice_assume_init_ref(&utf16_buf[..read]) }; - match utf16_to_utf8(utf16s, buf) { - Ok(value) => return Ok(bytes_copied + value), - Err(e) => return Err(e), - } - } - } -} - -// We assume that if the last `u16` is an unpaired surrogate they got sliced apart by our -// buffer size, and keep it around for the next read hoping to put them together. -// This is a best effort, and might not work if we are not the only reader on Stdin. -fn read_u16s_fixup_surrogates( - handle: c::HANDLE, - buf: &mut [MaybeUninit<u16>], - mut amount: usize, - surrogate: &mut u16, -) -> io::Result<usize> { - // Insert possibly remaining unpaired surrogate from last read. - let mut start = 0; - if *surrogate != 0 { - buf[0] = MaybeUninit::new(*surrogate); - *surrogate = 0; - start = 1; - if amount == 1 { - // Special case: `Stdin::read` guarantees we can always read at least one new `u16` - // and combine it with an unpaired surrogate, because the UTF-8 buffer is at least - // 4 bytes. - amount = 2; - } - } - let mut amount = read_u16s(handle, &mut buf[start..amount])? + start; - - if amount > 0 { - // Safety: The returned `amount` is the number of values initialized, - // and it is not 0, so we know that `buf[amount - 1]` have been - // initialized. - let last_char = unsafe { buf[amount - 1].assume_init() }; - if matches!(last_char, 0xD800..=0xDBFF) { - // high surrogate - *surrogate = last_char; - amount -= 1; - } - } - Ok(amount) -} - -// Returns `Ok(n)` if it initialized `n` values in `buf`. -fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit<u16>]) -> io::Result<usize> { - // Configure the `pInputControl` parameter to not only return on `\r\n` but also Ctrl-Z, the - // traditional DOS method to indicate end of character stream / user input (SUB). - // See #38274 and https://stackoverflow.com/questions/43836040/win-api-readconsole. - const CTRL_Z: u16 = 0x1A; - const CTRL_Z_MASK: c::ULONG = 1 << CTRL_Z; - let input_control = c::CONSOLE_READCONSOLE_CONTROL { - nLength: crate::mem::size_of::<c::CONSOLE_READCONSOLE_CONTROL>() as c::ULONG, - nInitialChars: 0, - dwCtrlWakeupMask: CTRL_Z_MASK, - dwControlKeyState: 0, - }; - - let mut amount = 0; - loop { - cvt(unsafe { - c::SetLastError(0); - c::ReadConsoleW( - handle, - buf.as_mut_ptr() as c::LPVOID, - buf.len() as u32, - &mut amount, - &input_control, - ) - })?; - - // ReadConsoleW returns success with ERROR_OPERATION_ABORTED for Ctrl-C or Ctrl-Break. - // Explicitly check for that case here and try again. - if amount == 0 && api::get_last_error().code == c::ERROR_OPERATION_ABORTED { - continue; - } - break; - } - // Safety: if `amount > 0`, then that many bytes were written, so - // `buf[amount as usize - 1]` has been initialized. - if amount > 0 && unsafe { buf[amount as usize - 1].assume_init() } == CTRL_Z { - amount -= 1; - } - Ok(amount as usize) -} - -fn utf16_to_utf8(utf16: &[u16], utf8: &mut [u8]) -> io::Result<usize> { - debug_assert!(utf16.len() <= c::c_int::MAX as usize); - debug_assert!(utf8.len() <= c::c_int::MAX as usize); - - if utf16.is_empty() { - return Ok(0); - } - - let result = unsafe { - c::WideCharToMultiByte( - c::CP_UTF8, // CodePage - c::WC_ERR_INVALID_CHARS, // dwFlags - utf16.as_ptr(), // lpWideCharStr - utf16.len() as c::c_int, // cchWideChar - utf8.as_mut_ptr(), // lpMultiByteStr - utf8.len() as c::c_int, // cbMultiByte - ptr::null(), // lpDefaultChar - ptr::null_mut(), // lpUsedDefaultChar - ) - }; - if result == 0 { - // We can't really do any better than forget all data and return an error. - Err(io::const_io_error!( - io::ErrorKind::InvalidData, - "Windows stdin in console mode does not support non-UTF-16 input; \ - encountered unpaired surrogate", - )) - } else { - Ok(result as usize) - } -} - -impl IncompleteUtf8 { - pub const fn new() -> IncompleteUtf8 { - IncompleteUtf8 { bytes: [0; 4], len: 0 } - } -} - -impl Stdout { - pub const fn new() -> Stdout { - Stdout { incomplete_utf8: IncompleteUtf8::new() } - } -} - -impl io::Write for Stdout { - fn write(&mut self, buf: &[u8]) -> io::Result<usize> { - write(c::STD_OUTPUT_HANDLE, buf, &mut self.incomplete_utf8) - } - - fn flush(&mut self) -> io::Result<()> { - Ok(()) - } -} - -impl Stderr { - pub const fn new() -> Stderr { - Stderr { incomplete_utf8: IncompleteUtf8::new() } - } -} - -impl io::Write for Stderr { - fn write(&mut self, buf: &[u8]) -> io::Result<usize> { - write(c::STD_ERROR_HANDLE, buf, &mut self.incomplete_utf8) - } - - fn flush(&mut self) -> io::Result<()> { - Ok(()) - } -} - -pub fn is_ebadf(err: &io::Error) -> bool { - err.raw_os_error() == Some(c::ERROR_INVALID_HANDLE as i32) -} - -pub fn panic_output() -> Option<impl io::Write> { - Some(Stderr::new()) -} diff --git a/library/std/src/sys/windows/stdio/tests.rs b/library/std/src/sys/windows/stdio/tests.rs deleted file mode 100644 index 1e53e0bee63..00000000000 --- a/library/std/src/sys/windows/stdio/tests.rs +++ /dev/null @@ -1,6 +0,0 @@ -use super::utf16_to_utf8; - -#[test] -fn zero_size_read() { - assert_eq!(utf16_to_utf8(&[], &mut []).unwrap(), 0); -} diff --git a/library/std/src/sys/windows/thread.rs b/library/std/src/sys/windows/thread.rs deleted file mode 100644 index 1fe74493519..00000000000 --- a/library/std/src/sys/windows/thread.rs +++ /dev/null @@ -1,137 +0,0 @@ -use crate::ffi::CStr; -use crate::io; -use crate::num::NonZeroUsize; -use crate::os::windows::io::AsRawHandle; -use crate::os::windows::io::HandleOrNull; -use crate::ptr; -use crate::sys::c; -use crate::sys::handle::Handle; -use crate::sys::stack_overflow; -use crate::sys_common::FromInner; -use crate::time::Duration; - -use core::ffi::c_void; - -use super::time::WaitableTimer; -use super::to_u16s; - -pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; - -pub struct Thread { - handle: Handle, -} - -impl Thread { - // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> { - let p = Box::into_raw(Box::new(p)); - - // FIXME On UNIX, we guard against stack sizes that are too small but - // that's because pthreads enforces that stacks are at least - // PTHREAD_STACK_MIN bytes big. Windows has no such lower limit, it's - // just that below a certain threshold you can't do anything useful. - // That threshold is application and architecture-specific, however. - let ret = c::CreateThread( - ptr::null_mut(), - stack, - Some(thread_start), - p as *mut _, - c::STACK_SIZE_PARAM_IS_A_RESERVATION, - ptr::null_mut(), - ); - let ret = HandleOrNull::from_raw_handle(ret); - return if let Ok(handle) = ret.try_into() { - Ok(Thread { handle: Handle::from_inner(handle) }) - } else { - // The thread failed to start and as a result p was not consumed. Therefore, it is - // safe to reconstruct the box so that it gets deallocated. - drop(Box::from_raw(p)); - Err(io::Error::last_os_error()) - }; - - extern "system" fn thread_start(main: *mut c_void) -> c::DWORD { - unsafe { - // Next, set up our stack overflow handler which may get triggered if we run - // out of stack. - let _handler = stack_overflow::Handler::new(); - // Finally, let's run some code. - Box::from_raw(main as *mut Box<dyn FnOnce()>)(); - } - 0 - } - } - - pub fn set_name(name: &CStr) { - if let Ok(utf8) = name.to_str() { - if let Ok(utf16) = to_u16s(utf8) { - unsafe { - c::SetThreadDescription(c::GetCurrentThread(), utf16.as_ptr()); - }; - }; - }; - } - - pub fn join(self) { - let rc = unsafe { c::WaitForSingleObject(self.handle.as_raw_handle(), c::INFINITE) }; - if rc == c::WAIT_FAILED { - panic!("failed to join on thread: {}", io::Error::last_os_error()); - } - } - - pub fn yield_now() { - // This function will return 0 if there are no other threads to execute, - // but this also means that the yield was useless so this isn't really a - // case that needs to be worried about. - unsafe { - c::SwitchToThread(); - } - } - - pub fn sleep(dur: Duration) { - fn high_precision_sleep(dur: Duration) -> Result<(), ()> { - let timer = WaitableTimer::high_resolution()?; - timer.set(dur)?; - timer.wait() - } - // Attempt to use high-precision sleep (Windows 10, version 1803+). - // On error fallback to the standard `Sleep` function. - // Also preserves the zero duration behaviour of `Sleep`. - if dur.is_zero() || high_precision_sleep(dur).is_err() { - unsafe { c::Sleep(super::dur2timeout(dur)) } - } - } - - pub fn handle(&self) -> &Handle { - &self.handle - } - - pub fn into_handle(self) -> Handle { - self.handle - } -} - -pub fn available_parallelism() -> io::Result<NonZeroUsize> { - let res = unsafe { - let mut sysinfo: c::SYSTEM_INFO = crate::mem::zeroed(); - c::GetSystemInfo(&mut sysinfo); - sysinfo.dwNumberOfProcessors as usize - }; - match res { - 0 => Err(io::const_io_error!( - io::ErrorKind::NotFound, - "The number of hardware threads is not known for the target platform", - )), - cpus => Ok(unsafe { NonZeroUsize::new_unchecked(cpus) }), - } -} - -#[cfg_attr(test, allow(dead_code))] -pub mod guard { - pub type Guard = !; - pub unsafe fn current() -> Option<Guard> { - None - } - pub unsafe fn init() -> Option<Guard> { - None - } -} diff --git a/library/std/src/sys/windows/thread_local_dtor.rs b/library/std/src/sys/windows/thread_local_dtor.rs deleted file mode 100644 index cf542d2bfb8..00000000000 --- a/library/std/src/sys/windows/thread_local_dtor.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Implements thread-local destructors that are not associated with any -//! particular data. - -#![unstable(feature = "thread_local_internals", issue = "none")] -#![cfg(target_thread_local)] - -pub use super::thread_local_key::register_keyless_dtor as register_dtor; diff --git a/library/std/src/sys/windows/thread_local_key.rs b/library/std/src/sys/windows/thread_local_key.rs deleted file mode 100644 index 5eee4a9667b..00000000000 --- a/library/std/src/sys/windows/thread_local_key.rs +++ /dev/null @@ -1,341 +0,0 @@ -use crate::cell::UnsafeCell; -use crate::ptr; -use crate::sync::atomic::{ - AtomicBool, AtomicPtr, AtomicU32, - Ordering::{AcqRel, Acquire, Relaxed, Release}, -}; -use crate::sys::c; - -#[cfg(test)] -mod tests; - -/// An optimization hint. The compiler is often smart enough to know if an atomic -/// is never set and can remove dead code based on that fact. -static HAS_DTORS: AtomicBool = AtomicBool::new(false); - -// Using a per-thread list avoids the problems in synchronizing global state. -#[thread_local] -#[cfg(target_thread_local)] -static DESTRUCTORS: crate::cell::RefCell<Vec<(*mut u8, unsafe extern "C" fn(*mut u8))>> = - crate::cell::RefCell::new(Vec::new()); - -// Ensure this can never be inlined because otherwise this may break in dylibs. -// See #44391. -#[inline(never)] -#[cfg(target_thread_local)] -pub unsafe fn register_keyless_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) { - match DESTRUCTORS.try_borrow_mut() { - Ok(mut dtors) => dtors.push((t, dtor)), - Err(_) => rtabort!("global allocator may not use TLS"), - } - - HAS_DTORS.store(true, Relaxed); -} - -#[inline(never)] // See comment above -#[cfg(target_thread_local)] -/// Runs destructors. This should not be called until thread exit. -unsafe fn run_keyless_dtors() { - // Drop all the destructors. - // - // Note: While this is potentially an infinite loop, it *should* be - // the case that this loop always terminates because we provide the - // guarantee that a TLS key cannot be set after it is flagged for - // destruction. - loop { - // Use a let-else binding to ensure the `RefCell` guard is dropped - // immediately. Otherwise, a panic would occur if a TLS destructor - // tries to access the list. - let Some((ptr, dtor)) = DESTRUCTORS.borrow_mut().pop() else { - break; - }; - (dtor)(ptr); - } - // We're done so free the memory. - DESTRUCTORS.replace(Vec::new()); -} - -type Key = c::DWORD; -type Dtor = unsafe extern "C" fn(*mut u8); - -// Turns out, like pretty much everything, Windows is pretty close the -// functionality that Unix provides, but slightly different! In the case of -// TLS, Windows does not provide an API to provide a destructor for a TLS -// variable. This ends up being pretty crucial to this implementation, so we -// need a way around this. -// -// The solution here ended up being a little obscure, but fear not, the -// internet has informed me [1][2] that this solution is not unique (no way -// I could have thought of it as well!). The key idea is to insert some hook -// somewhere to run arbitrary code on thread termination. With this in place -// we'll be able to run anything we like, including all TLS destructors! -// -// To accomplish this feat, we perform a number of threads, all contained -// within this module: -// -// * All TLS destructors are tracked by *us*, not the Windows runtime. This -// means that we have a global list of destructors for each TLS key that -// we know about. -// * When a thread exits, we run over the entire list and run dtors for all -// non-null keys. This attempts to match Unix semantics in this regard. -// -// For more details and nitty-gritty, see the code sections below! -// -// [1]: https://www.codeproject.com/Articles/8113/Thread-Local-Storage-The-C-Way -// [2]: https://github.com/ChromiumWebApps/chromium/blob/master/base/threading/thread_local_storage_win.cc#L42 - -pub struct StaticKey { - /// The key value shifted up by one. Since TLS_OUT_OF_INDEXES == DWORD::MAX - /// is not a valid key value, this allows us to use zero as sentinel value - /// without risking overflow. - key: AtomicU32, - dtor: Option<Dtor>, - next: AtomicPtr<StaticKey>, - /// Currently, destructors cannot be unregistered, so we cannot use racy - /// initialization for keys. Instead, we need synchronize initialization. - /// Use the Windows-provided `Once` since it does not require TLS. - once: UnsafeCell<c::INIT_ONCE>, -} - -impl StaticKey { - #[inline] - pub const fn new(dtor: Option<Dtor>) -> StaticKey { - StaticKey { - key: AtomicU32::new(0), - dtor, - next: AtomicPtr::new(ptr::null_mut()), - once: UnsafeCell::new(c::INIT_ONCE_STATIC_INIT), - } - } - - #[inline] - pub unsafe fn set(&'static self, val: *mut u8) { - let r = c::TlsSetValue(self.key(), val.cast()); - debug_assert_eq!(r, c::TRUE); - } - - #[inline] - pub unsafe fn get(&'static self) -> *mut u8 { - c::TlsGetValue(self.key()).cast() - } - - #[inline] - unsafe fn key(&'static self) -> Key { - match self.key.load(Acquire) { - 0 => self.init(), - key => key - 1, - } - } - - #[cold] - unsafe fn init(&'static self) -> Key { - if self.dtor.is_some() { - let mut pending = c::FALSE; - let r = c::InitOnceBeginInitialize(self.once.get(), 0, &mut pending, ptr::null_mut()); - assert_eq!(r, c::TRUE); - - if pending == c::FALSE { - // Some other thread initialized the key, load it. - self.key.load(Relaxed) - 1 - } else { - let key = c::TlsAlloc(); - if key == c::TLS_OUT_OF_INDEXES { - // Wakeup the waiting threads before panicking to avoid deadlock. - c::InitOnceComplete(self.once.get(), c::INIT_ONCE_INIT_FAILED, ptr::null_mut()); - panic!("out of TLS indexes"); - } - - self.key.store(key + 1, Release); - register_dtor(self); - - let r = c::InitOnceComplete(self.once.get(), 0, ptr::null_mut()); - debug_assert_eq!(r, c::TRUE); - - key - } - } else { - // If there is no destructor to clean up, we can use racy initialization. - - let key = c::TlsAlloc(); - assert_ne!(key, c::TLS_OUT_OF_INDEXES, "out of TLS indexes"); - - match self.key.compare_exchange(0, key + 1, AcqRel, Acquire) { - Ok(_) => key, - Err(new) => { - // Some other thread completed initialization first, so destroy - // our key and use theirs. - let r = c::TlsFree(key); - debug_assert_eq!(r, c::TRUE); - new - 1 - } - } - } - } -} - -unsafe impl Send for StaticKey {} -unsafe impl Sync for StaticKey {} - -// ------------------------------------------------------------------------- -// Dtor registration -// -// Windows has no native support for running destructors so we manage our own -// list of destructors to keep track of how to destroy keys. We then install a -// callback later to get invoked whenever a thread exits, running all -// appropriate destructors. -// -// Currently unregistration from this list is not supported. A destructor can be -// registered but cannot be unregistered. There's various simplifying reasons -// for doing this, the big ones being: -// -// 1. Currently we don't even support deallocating TLS keys, so normal operation -// doesn't need to deallocate a destructor. -// 2. There is no point in time where we know we can unregister a destructor -// because it could always be getting run by some remote thread. -// -// Typically processes have a statically known set of TLS keys which is pretty -// small, and we'd want to keep this memory alive for the whole process anyway -// really. - -static DTORS: AtomicPtr<StaticKey> = AtomicPtr::new(ptr::null_mut()); - -/// Should only be called once per key, otherwise loops or breaks may occur in -/// the linked list. -unsafe fn register_dtor(key: &'static StaticKey) { - // Ensure this is never run when native thread locals are available. - assert_eq!(false, cfg!(target_thread_local)); - let this = <*const StaticKey>::cast_mut(key); - // Use acquire ordering to pass along the changes done by the previously - // registered keys when we store the new head with release ordering. - let mut head = DTORS.load(Acquire); - loop { - key.next.store(head, Relaxed); - match DTORS.compare_exchange_weak(head, this, Release, Acquire) { - Ok(_) => break, - Err(new) => head = new, - } - } - HAS_DTORS.store(true, Release); -} - -// ------------------------------------------------------------------------- -// Where the Magic (TM) Happens -// -// If you're looking at this code, and wondering "what is this doing?", -// you're not alone! I'll try to break this down step by step: -// -// # What's up with CRT$XLB? -// -// For anything about TLS destructors to work on Windows, we have to be able -// to run *something* when a thread exits. To do so, we place a very special -// static in a very special location. If this is encoded in just the right -// way, the kernel's loader is apparently nice enough to run some function -// of ours whenever a thread exits! How nice of the kernel! -// -// Lots of detailed information can be found in source [1] above, but the -// gist of it is that this is leveraging a feature of Microsoft's PE format -// (executable format) which is not actually used by any compilers today. -// This apparently translates to any callbacks in the ".CRT$XLB" section -// being run on certain events. -// -// So after all that, we use the compiler's #[link_section] feature to place -// a callback pointer into the magic section so it ends up being called. -// -// # What's up with this callback? -// -// The callback specified receives a number of parameters from... someone! -// (the kernel? the runtime? I'm not quite sure!) There are a few events that -// this gets invoked for, but we're currently only interested on when a -// thread or a process "detaches" (exits). The process part happens for the -// last thread and the thread part happens for any normal thread. -// -// # Ok, what's up with running all these destructors? -// -// This will likely need to be improved over time, but this function -// attempts a "poor man's" destructor callback system. Once we've got a list -// of what to run, we iterate over all keys, check their values, and then run -// destructors if the values turn out to be non null (setting them to null just -// beforehand). We do this a few times in a loop to basically match Unix -// semantics. If we don't reach a fixed point after a short while then we just -// inevitably leak something most likely. -// -// # The article mentions weird stuff about "/INCLUDE"? -// -// It sure does! Specifically we're talking about this quote: -// -// The Microsoft run-time library facilitates this process by defining a -// memory image of the TLS Directory and giving it the special name -// “__tls_used” (Intel x86 platforms) or “_tls_used” (other platforms). The -// linker looks for this memory image and uses the data there to create the -// TLS Directory. Other compilers that support TLS and work with the -// Microsoft linker must use this same technique. -// -// Basically what this means is that if we want support for our TLS -// destructors/our hook being called then we need to make sure the linker does -// not omit this symbol. Otherwise it will omit it and our callback won't be -// wired up. -// -// We don't actually use the `/INCLUDE` linker flag here like the article -// mentions because the Rust compiler doesn't propagate linker flags, but -// instead we use a shim function which performs a volatile 1-byte load from -// the address of the symbol to ensure it sticks around. - -#[link_section = ".CRT$XLB"] -#[allow(dead_code, unused_variables)] -#[used] // we don't want LLVM eliminating this symbol for any reason, and -// when the symbol makes it to the linker the linker will take over -pub static p_thread_callback: unsafe extern "system" fn(c::LPVOID, c::DWORD, c::LPVOID) = - on_tls_callback; - -#[allow(dead_code, unused_variables)] -unsafe extern "system" fn on_tls_callback(h: c::LPVOID, dwReason: c::DWORD, pv: c::LPVOID) { - if !HAS_DTORS.load(Acquire) { - return; - } - if dwReason == c::DLL_THREAD_DETACH || dwReason == c::DLL_PROCESS_DETACH { - #[cfg(not(target_thread_local))] - run_dtors(); - #[cfg(target_thread_local)] - run_keyless_dtors(); - } - - // See comments above for what this is doing. Note that we don't need this - // trickery on GNU windows, just on MSVC. - reference_tls_used(); - #[cfg(target_env = "msvc")] - unsafe fn reference_tls_used() { - extern "C" { - static _tls_used: u8; - } - crate::intrinsics::volatile_load(&_tls_used); - } - #[cfg(not(target_env = "msvc"))] - unsafe fn reference_tls_used() {} -} - -#[allow(dead_code)] // actually called below -unsafe fn run_dtors() { - for _ in 0..5 { - let mut any_run = false; - - // Use acquire ordering to observe key initialization. - let mut cur = DTORS.load(Acquire); - while !cur.is_null() { - let key = (*cur).key.load(Relaxed) - 1; - let dtor = (*cur).dtor.unwrap(); - - let ptr = c::TlsGetValue(key); - if !ptr.is_null() { - c::TlsSetValue(key, ptr::null_mut()); - dtor(ptr as *mut _); - any_run = true; - } - - cur = (*cur).next.load(Relaxed); - } - - if !any_run { - break; - } - } -} diff --git a/library/std/src/sys/windows/thread_local_key/tests.rs b/library/std/src/sys/windows/thread_local_key/tests.rs deleted file mode 100644 index c739f0caf3e..00000000000 --- a/library/std/src/sys/windows/thread_local_key/tests.rs +++ /dev/null @@ -1,57 +0,0 @@ -// This file only tests the thread local key fallback. -// Windows targets with native thread local support do not use this. -#![cfg(not(target_thread_local))] - -use super::StaticKey; -use crate::ptr; - -#[test] -fn smoke() { - static K1: StaticKey = StaticKey::new(None); - static K2: StaticKey = StaticKey::new(None); - - unsafe { - assert!(K1.get().is_null()); - assert!(K2.get().is_null()); - K1.set(ptr::invalid_mut(1)); - K2.set(ptr::invalid_mut(2)); - assert_eq!(K1.get() as usize, 1); - assert_eq!(K2.get() as usize, 2); - } -} - -#[test] -fn destructors() { - use crate::mem::ManuallyDrop; - use crate::sync::Arc; - use crate::thread; - - unsafe extern "C" fn destruct(ptr: *mut u8) { - drop(Arc::from_raw(ptr as *const ())); - } - - static KEY: StaticKey = StaticKey::new(Some(destruct)); - - let shared1 = Arc::new(()); - let shared2 = Arc::clone(&shared1); - - unsafe { - assert!(KEY.get().is_null()); - KEY.set(Arc::into_raw(shared1) as *mut u8); - } - - thread::spawn(move || unsafe { - assert!(KEY.get().is_null()); - KEY.set(Arc::into_raw(shared2) as *mut u8); - }) - .join() - .unwrap(); - - // Leak the Arc, let the TLS destructor clean it up. - let shared1 = unsafe { ManuallyDrop::new(Arc::from_raw(KEY.get() as *const ())) }; - assert_eq!( - Arc::strong_count(&shared1), - 1, - "destructor should have dropped the other reference on thread exit" - ); -} diff --git a/library/std/src/sys/windows/thread_parking.rs b/library/std/src/sys/windows/thread_parking.rs deleted file mode 100644 index eb9167cd855..00000000000 --- a/library/std/src/sys/windows/thread_parking.rs +++ /dev/null @@ -1,253 +0,0 @@ -// Thread parker implementation for Windows. -// -// This uses WaitOnAddress and WakeByAddressSingle if available (Windows 8+). -// This modern API is exactly the same as the futex syscalls the Linux thread -// parker uses. When These APIs are available, the implementation of this -// thread parker matches the Linux thread parker exactly. -// -// However, when the modern API is not available, this implementation falls -// back to NT Keyed Events, which are similar, but have some important -// differences. These are available since Windows XP. -// -// WaitOnAddress first checks the state of the thread parker to make sure it no -// WakeByAddressSingle calls can be missed between updating the parker state -// and calling the function. -// -// NtWaitForKeyedEvent does not have this option, and unconditionally blocks -// without checking the parker state first. Instead, NtReleaseKeyedEvent -// (unlike WakeByAddressSingle) *blocks* until it woke up a thread waiting for -// it by NtWaitForKeyedEvent. This way, we can be sure no events are missed, -// but we need to be careful not to block unpark() if park_timeout() was woken -// up by a timeout instead of unpark(). -// -// Unlike WaitOnAddress, NtWaitForKeyedEvent/NtReleaseKeyedEvent operate on a -// HANDLE (created with NtCreateKeyedEvent). This means that we can be sure -// a successfully awoken park() was awoken by unpark() and not a -// NtReleaseKeyedEvent call from some other code, as these events are not only -// matched by the key (address of the parker (state)), but also by this HANDLE. -// We lazily allocate this handle the first time it is needed. -// -// The fast path (calling park() after unpark() was already called) and the -// possible states are the same for both implementations. This is used here to -// make sure the fast path does not even check which API to use, but can return -// right away, independent of the used API. Only the slow paths (which will -// actually block/wake a thread) check which API is available and have -// different implementations. -// -// Unfortunately, NT Keyed Events are an undocumented Windows API. However: -// - This API is relatively simple with obvious behaviour, and there are -// several (unofficial) articles documenting the details. [1] -// - `parking_lot` has been using this API for years (on Windows versions -// before Windows 8). [2] Many big projects extensively use parking_lot, -// such as servo and the Rust compiler itself. -// - It is the underlying API used by Windows SRW locks and Windows critical -// sections. [3] [4] -// - The source code of the implementations of Wine, ReactOs, and Windows XP -// are available and match the expected behaviour. -// - The main risk with an undocumented API is that it might change in the -// future. But since we only use it for older versions of Windows, that's not -// a problem. -// - Even if these functions do not block or wake as we expect (which is -// unlikely, see all previous points), this implementation would still be -// memory safe. The NT Keyed Events API is only used to sleep/block in the -// right place. -// -// [1]: http://www.locklessinc.com/articles/keyed_events/ -// [2]: https://github.com/Amanieu/parking_lot/commit/43abbc964e -// [3]: https://docs.microsoft.com/en-us/archive/msdn-magazine/2012/november/windows-with-c-the-evolution-of-synchronization-in-windows-and-c -// [4]: Windows Internals, Part 1, ISBN 9780735671300 - -use crate::pin::Pin; -use crate::ptr; -use crate::sync::atomic::{ - AtomicI8, AtomicPtr, - Ordering::{Acquire, Relaxed, Release}, -}; -use crate::sys::{c, dur2timeout}; -use crate::time::Duration; - -pub struct Parker { - state: AtomicI8, -} - -const PARKED: i8 = -1; -const EMPTY: i8 = 0; -const NOTIFIED: i8 = 1; - -// Notes about memory ordering: -// -// Memory ordering is only relevant for the relative ordering of operations -// between different variables. Even Ordering::Relaxed guarantees a -// monotonic/consistent order when looking at just a single atomic variable. -// -// So, since this parker is just a single atomic variable, we only need to look -// at the ordering guarantees we need to provide to the 'outside world'. -// -// The only memory ordering guarantee that parking and unparking provide, is -// that things which happened before unpark() are visible on the thread -// returning from park() afterwards. Otherwise, it was effectively unparked -// before unpark() was called while still consuming the 'token'. -// -// In other words, unpark() needs to synchronize with the part of park() that -// consumes the token and returns. -// -// This is done with a release-acquire synchronization, by using -// Ordering::Release when writing NOTIFIED (the 'token') in unpark(), and using -// Ordering::Acquire when reading this state in park() after waking up. -impl Parker { - /// Construct the Windows parker. The UNIX parker implementation - /// requires this to happen in-place. - pub unsafe fn new_in_place(parker: *mut Parker) { - parker.write(Self { state: AtomicI8::new(EMPTY) }); - } - - // Assumes this is only called by the thread that owns the Parker, - // which means that `self.state != PARKED`. This implementation doesn't require `Pin`, - // but other implementations do. - pub unsafe fn park(self: Pin<&Self>) { - // Change NOTIFIED=>EMPTY or EMPTY=>PARKED, and directly return in the - // first case. - if self.state.fetch_sub(1, Acquire) == NOTIFIED { - return; - } - - if let Some(wait_on_address) = c::WaitOnAddress::option() { - loop { - // Wait for something to happen, assuming it's still set to PARKED. - wait_on_address(self.ptr(), &PARKED as *const _ as c::LPVOID, 1, c::INFINITE); - // Change NOTIFIED=>EMPTY but leave PARKED alone. - if self.state.compare_exchange(NOTIFIED, EMPTY, Acquire, Acquire).is_ok() { - // Actually woken up by unpark(). - return; - } else { - // Spurious wake up. We loop to try again. - } - } - } else { - // Wait for unpark() to produce this event. - c::NtWaitForKeyedEvent(keyed_event_handle(), self.ptr(), 0, ptr::null_mut()); - // Set the state back to EMPTY (from either PARKED or NOTIFIED). - // Note that we don't just write EMPTY, but use swap() to also - // include an acquire-ordered read to synchronize with unpark()'s - // release-ordered write. - self.state.swap(EMPTY, Acquire); - } - } - - // Assumes this is only called by the thread that owns the Parker, - // which means that `self.state != PARKED`. This implementation doesn't require `Pin`, - // but other implementations do. - pub unsafe fn park_timeout(self: Pin<&Self>, timeout: Duration) { - // Change NOTIFIED=>EMPTY or EMPTY=>PARKED, and directly return in the - // first case. - if self.state.fetch_sub(1, Acquire) == NOTIFIED { - return; - } - - if let Some(wait_on_address) = c::WaitOnAddress::option() { - // Wait for something to happen, assuming it's still set to PARKED. - wait_on_address(self.ptr(), &PARKED as *const _ as c::LPVOID, 1, dur2timeout(timeout)); - // Set the state back to EMPTY (from either PARKED or NOTIFIED). - // Note that we don't just write EMPTY, but use swap() to also - // include an acquire-ordered read to synchronize with unpark()'s - // release-ordered write. - if self.state.swap(EMPTY, Acquire) == NOTIFIED { - // Actually woken up by unpark(). - } else { - // Timeout or spurious wake up. - // We return either way, because we can't easily tell if it was the - // timeout or not. - } - } else { - // Need to wait for unpark() using NtWaitForKeyedEvent. - let handle = keyed_event_handle(); - - // NtWaitForKeyedEvent uses a unit of 100ns, and uses negative - // values to indicate a relative time on the monotonic clock. - // This is documented here for the underlying KeWaitForSingleObject function: - // https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kewaitforsingleobject - let mut timeout = match i64::try_from((timeout.as_nanos() + 99) / 100) { - Ok(t) => -t, - Err(_) => i64::MIN, - }; - - // Wait for unpark() to produce this event. - let unparked = - c::NtWaitForKeyedEvent(handle, self.ptr(), 0, &mut timeout) == c::STATUS_SUCCESS; - - // Set the state back to EMPTY (from either PARKED or NOTIFIED). - let prev_state = self.state.swap(EMPTY, Acquire); - - if !unparked && prev_state == NOTIFIED { - // We were awoken by a timeout, not by unpark(), but the state - // was set to NOTIFIED, which means we *just* missed an - // unpark(), which is now blocked on us to wait for it. - // Wait for it to consume the event and unblock that thread. - c::NtWaitForKeyedEvent(handle, self.ptr(), 0, ptr::null_mut()); - } - } - } - - // This implementation doesn't require `Pin`, but other implementations do. - pub fn unpark(self: Pin<&Self>) { - // Change PARKED=>NOTIFIED, EMPTY=>NOTIFIED, or NOTIFIED=>NOTIFIED, and - // wake the thread in the first case. - // - // Note that even NOTIFIED=>NOTIFIED results in a write. This is on - // purpose, to make sure every unpark() has a release-acquire ordering - // with park(). - if self.state.swap(NOTIFIED, Release) == PARKED { - unsafe { - if let Some(wake_by_address_single) = c::WakeByAddressSingle::option() { - wake_by_address_single(self.ptr()); - } else { - // If we run NtReleaseKeyedEvent before the waiting thread runs - // NtWaitForKeyedEvent, this (shortly) blocks until we can wake it up. - // If the waiting thread wakes up before we run NtReleaseKeyedEvent - // (e.g. due to a timeout), this blocks until we do wake up a thread. - // To prevent this thread from blocking indefinitely in that case, - // park_impl() will, after seeing the state set to NOTIFIED after - // waking up, call NtWaitForKeyedEvent again to unblock us. - c::NtReleaseKeyedEvent(keyed_event_handle(), self.ptr(), 0, ptr::null_mut()); - } - } - } - } - - fn ptr(&self) -> c::LPVOID { - &self.state as *const _ as c::LPVOID - } -} - -fn keyed_event_handle() -> c::HANDLE { - const INVALID: c::HANDLE = ptr::invalid_mut(!0); - static HANDLE: AtomicPtr<crate::ffi::c_void> = AtomicPtr::new(INVALID); - match HANDLE.load(Relaxed) { - INVALID => { - let mut handle = c::INVALID_HANDLE_VALUE; - unsafe { - match c::NtCreateKeyedEvent( - &mut handle, - c::GENERIC_READ | c::GENERIC_WRITE, - ptr::null_mut(), - 0, - ) { - c::STATUS_SUCCESS => {} - r => panic!("Unable to create keyed event handle: error {r}"), - } - } - match HANDLE.compare_exchange(INVALID, handle, Relaxed, Relaxed) { - Ok(_) => handle, - Err(h) => { - // Lost the race to another thread initializing HANDLE before we did. - // Closing our handle and using theirs instead. - unsafe { - c::CloseHandle(handle); - } - h - } - } - } - handle => handle, - } -} diff --git a/library/std/src/sys/windows/time.rs b/library/std/src/sys/windows/time.rs deleted file mode 100644 index 09e78a29304..00000000000 --- a/library/std/src/sys/windows/time.rs +++ /dev/null @@ -1,262 +0,0 @@ -use crate::cmp::Ordering; -use crate::fmt; -use crate::mem; -use crate::ptr::null; -use crate::sys::c; -use crate::sys_common::IntoInner; -use crate::time::Duration; - -use core::hash::{Hash, Hasher}; -use core::ops::Neg; - -const NANOS_PER_SEC: u64 = 1_000_000_000; -const INTERVALS_PER_SEC: u64 = NANOS_PER_SEC / 100; - -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)] -pub struct Instant { - // This duration is relative to an arbitrary microsecond epoch - // from the winapi QueryPerformanceCounter function. - t: Duration, -} - -#[derive(Copy, Clone)] -pub struct SystemTime { - t: c::FILETIME, -} - -const INTERVALS_TO_UNIX_EPOCH: u64 = 11_644_473_600 * INTERVALS_PER_SEC; - -pub const UNIX_EPOCH: SystemTime = SystemTime { - t: c::FILETIME { - dwLowDateTime: INTERVALS_TO_UNIX_EPOCH as u32, - dwHighDateTime: (INTERVALS_TO_UNIX_EPOCH >> 32) as u32, - }, -}; - -impl Instant { - pub fn now() -> Instant { - // High precision timing on windows operates in "Performance Counter" - // units, as returned by the WINAPI QueryPerformanceCounter function. - // These relate to seconds by a factor of QueryPerformanceFrequency. - // In order to keep unit conversions out of normal interval math, we - // measure in QPC units and immediately convert to nanoseconds. - perf_counter::PerformanceCounterInstant::now().into() - } - - pub fn checked_sub_instant(&self, other: &Instant) -> Option<Duration> { - // On windows there's a threshold below which we consider two timestamps - // equivalent due to measurement error. For more details + doc link, - // check the docs on epsilon. - let epsilon = perf_counter::PerformanceCounterInstant::epsilon(); - if other.t > self.t && other.t - self.t <= epsilon { - Some(Duration::new(0, 0)) - } else { - self.t.checked_sub(other.t) - } - } - - pub fn checked_add_duration(&self, other: &Duration) -> Option<Instant> { - Some(Instant { t: self.t.checked_add(*other)? }) - } - - pub fn checked_sub_duration(&self, other: &Duration) -> Option<Instant> { - Some(Instant { t: self.t.checked_sub(*other)? }) - } -} - -impl SystemTime { - pub fn now() -> SystemTime { - unsafe { - let mut t: SystemTime = mem::zeroed(); - c::GetSystemTimePreciseAsFileTime(&mut t.t); - t - } - } - - fn from_intervals(intervals: i64) -> SystemTime { - SystemTime { - t: c::FILETIME { - dwLowDateTime: intervals as c::DWORD, - dwHighDateTime: (intervals >> 32) as c::DWORD, - }, - } - } - - fn intervals(&self) -> i64 { - (self.t.dwLowDateTime as i64) | ((self.t.dwHighDateTime as i64) << 32) - } - - pub fn sub_time(&self, other: &SystemTime) -> Result<Duration, Duration> { - let me = self.intervals(); - let other = other.intervals(); - if me >= other { - Ok(intervals2dur((me - other) as u64)) - } else { - Err(intervals2dur((other - me) as u64)) - } - } - - pub fn checked_add_duration(&self, other: &Duration) -> Option<SystemTime> { - let intervals = self.intervals().checked_add(checked_dur2intervals(other)?)?; - Some(SystemTime::from_intervals(intervals)) - } - - pub fn checked_sub_duration(&self, other: &Duration) -> Option<SystemTime> { - let intervals = self.intervals().checked_sub(checked_dur2intervals(other)?)?; - Some(SystemTime::from_intervals(intervals)) - } -} - -impl PartialEq for SystemTime { - fn eq(&self, other: &SystemTime) -> bool { - self.intervals() == other.intervals() - } -} - -impl Eq for SystemTime {} - -impl PartialOrd for SystemTime { - fn partial_cmp(&self, other: &SystemTime) -> Option<Ordering> { - Some(self.cmp(other)) - } -} - -impl Ord for SystemTime { - fn cmp(&self, other: &SystemTime) -> Ordering { - self.intervals().cmp(&other.intervals()) - } -} - -impl fmt::Debug for SystemTime { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("SystemTime").field("intervals", &self.intervals()).finish() - } -} - -impl From<c::FILETIME> for SystemTime { - fn from(t: c::FILETIME) -> SystemTime { - SystemTime { t } - } -} - -impl IntoInner<c::FILETIME> for SystemTime { - fn into_inner(self) -> c::FILETIME { - self.t - } -} - -impl Hash for SystemTime { - fn hash<H: Hasher>(&self, state: &mut H) { - self.intervals().hash(state) - } -} - -fn checked_dur2intervals(dur: &Duration) -> Option<i64> { - dur.as_secs() - .checked_mul(INTERVALS_PER_SEC)? - .checked_add(dur.subsec_nanos() as u64 / 100)? - .try_into() - .ok() -} - -fn intervals2dur(intervals: u64) -> Duration { - Duration::new(intervals / INTERVALS_PER_SEC, ((intervals % INTERVALS_PER_SEC) * 100) as u32) -} - -mod perf_counter { - use super::NANOS_PER_SEC; - use crate::sync::atomic::{AtomicU64, Ordering}; - use crate::sys::c; - use crate::sys::cvt; - use crate::sys_common::mul_div_u64; - use crate::time::Duration; - - pub struct PerformanceCounterInstant { - ts: c::LARGE_INTEGER, - } - impl PerformanceCounterInstant { - pub fn now() -> Self { - Self { ts: query() } - } - - // Per microsoft docs, the margin of error for cross-thread time comparisons - // using QueryPerformanceCounter is 1 "tick" -- defined as 1/frequency(). - // Reference: https://docs.microsoft.com/en-us/windows/desktop/SysInfo - // /acquiring-high-resolution-time-stamps - pub fn epsilon() -> Duration { - let epsilon = NANOS_PER_SEC / (frequency() as u64); - Duration::from_nanos(epsilon) - } - } - impl From<PerformanceCounterInstant> for super::Instant { - fn from(other: PerformanceCounterInstant) -> Self { - let freq = frequency() as u64; - let instant_nsec = mul_div_u64(other.ts as u64, NANOS_PER_SEC, freq); - Self { t: Duration::from_nanos(instant_nsec) } - } - } - - fn frequency() -> c::LARGE_INTEGER { - // Either the cached result of `QueryPerformanceFrequency` or `0` for - // uninitialized. Storing this as a single `AtomicU64` allows us to use - // `Relaxed` operations, as we are only interested in the effects on a - // single memory location. - static FREQUENCY: AtomicU64 = AtomicU64::new(0); - - let cached = FREQUENCY.load(Ordering::Relaxed); - // If a previous thread has filled in this global state, use that. - if cached != 0 { - return cached as c::LARGE_INTEGER; - } - // ... otherwise learn for ourselves ... - let mut frequency = 0; - unsafe { - cvt(c::QueryPerformanceFrequency(&mut frequency)).unwrap(); - } - - FREQUENCY.store(frequency as u64, Ordering::Relaxed); - frequency - } - - fn query() -> c::LARGE_INTEGER { - let mut qpc_value: c::LARGE_INTEGER = 0; - cvt(unsafe { c::QueryPerformanceCounter(&mut qpc_value) }).unwrap(); - qpc_value - } -} - -/// A timer you can wait on. -pub(super) struct WaitableTimer { - handle: c::HANDLE, -} -impl WaitableTimer { - /// Create a high-resolution timer. Will fail before Windows 10, version 1803. - pub fn high_resolution() -> Result<Self, ()> { - let handle = unsafe { - c::CreateWaitableTimerExW( - null(), - null(), - c::CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, - c::TIMER_ALL_ACCESS, - ) - }; - if !handle.is_null() { Ok(Self { handle }) } else { Err(()) } - } - pub fn set(&self, duration: Duration) -> Result<(), ()> { - // Convert the Duration to a format similar to FILETIME. - // Negative values are relative times whereas positive values are absolute. - // Therefore we negate the relative duration. - let time = checked_dur2intervals(&duration).ok_or(())?.neg(); - let result = unsafe { c::SetWaitableTimer(self.handle, &time, 0, None, null(), c::FALSE) }; - if result != 0 { Ok(()) } else { Err(()) } - } - pub fn wait(&self) -> Result<(), ()> { - let result = unsafe { c::WaitForSingleObject(self.handle, c::INFINITE) }; - if result != c::WAIT_FAILED { Ok(()) } else { Err(()) } - } -} -impl Drop for WaitableTimer { - fn drop(&mut self) { - unsafe { c::CloseHandle(self.handle) }; - } -} |
