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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! # WinWrap
//! Rust-friendly Windows API wrappers
//!
//! # Features
//!
//! - Safe Windows API bindings
//! - Unsafe raw APIs
//! - Unsafe raw APIs wrap only the error handling.
//! - TCHAR and TString support.
//! - By default, TCHAR is WCHAR. If you want to use ANSI, ansi feature on.
//!
//! ```toml
//! [dependencies.winwrap]
//! version = "0.1.0"
//! features = ["ansi"]
//! ```
//!
//! # Examples
//!
//! ```rust
//! use winwrap::um::fileapi::*;
//! use winwrap::winapi::shared::winerror::ERROR_NO_MORE_FILES;
//!
//! fn enumerate_files_w() {
//!     use winwrap::string::WString;
//!     let path = WString::from(r".\*.*");
//!     let (handle, mut data) = find_first_file_w(&path).unwrap();
//!     loop {
//!         println!("name: {:?}", data.get_file_name().to_string_lossy());
//!         println!("\tflags: {:?}", data.file_attributes);
//!         println!("\talternate file name: {}", data.get_alternate_file_name().to_string_lossy());
//!         println!("----------------------------");
//!         data = match find_next_file_w(&handle) {
//!             Ok(x) => x,
//!             Err(ERROR_NO_MORE_FILES) => {
//!                 println!("All files enumerated!");
//!                 break;
//!             }
//!             Err(x) => panic!("Unknown Error: {}", x),
//!         };
//!     }
//! }
//!
//! fn main(){
//!     enumerate_files_w();
//! }
//! ```
//!
//! # License
//! This software is released under the MIT License, see LICENSE.

#![cfg(windows)]

pub use winapi;

pub mod handle;
pub mod raw;
pub mod shared;
pub mod string;
pub mod um;
pub mod vc;

#[macro_use]
pub mod macros;

pub use macros::*;

use winapi::shared::minwindef::{DWORD, WORD};

pub type OsResult<T> = Result<T, u32>;

#[inline]
#[allow(non_snake_case)]
pub const fn MAKE_QWORD(ms: DWORD, ls: DWORD) -> u64 {
    (ms as u64) << 32 | ls as u64
}