1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) Mike Grier.
//! The numbers Windows reports failure in, as types.
//!
//! Windows reports a failure as a number, and which number space it is in is not in the number.
//! A `DWORD` from `GetLastError` is one; a `LONG` from a registry call is the same space in a
//! signed carrier; an `HRESULT` is another, signed and carrying severity and facility bits; and an
//! `NTSTATUS` is a third, signed, with a two-bit severity and a facility of its own.
//! Crates here each kept a bare `u32` or wrote a `Win32Error` of their own, and the two that did
//! disagreed about what to do with a code of 2^31 or more -- which exist: the virtdisk errors are
//! `WIN32_ERROR`s such as `ERROR_VIRTDISK_NOT_VIRTUAL_DISK`, 3225026581.
//!
//! This crate gives each number space its own type, so a code is never a bare integer whose space
//! the reader has to guess, and so the conversion to and from [`std::io::Error`] is written once
//! and is exact for every code.
//!
//! The decisions behind it are in the crate's `DESIGN-NOTES.md`. The types carry what Windows
//! said and nothing else: no code is mapped onto a friendlier taxonomy, and no named constants
//! are defined here, because `windows-sys` has them.
//!
//! The numbers and their conversions build on every target. The bridge to [`std::io::Error`] is
//! `cfg(windows)`, because off Windows a raw OS error is an `errno` and reading one as a Win32
//! code would be a wrong answer and not a missing feature.
pub use HResult;
pub use LStatus;
pub use ;
pub use Win32Error;
// The README carries runnable examples, so they are compiled and a change to the API that breaks
// one breaks the build.
;