[][src]Crate winwrap

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.
[dependencies.winwrap]
version = "0.1.0"
features = ["ansi"]

Examples

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.

Re-exports

pub use winapi;
pub use macros::*;

Modules

handle
macros
raw
shared
string
um
vc

Macros

bfi
e_handle2_internal

Returns Ok(()).

e_handle_internal

Returns Result<ret,()>.

e_make_func

Returns Result<$ret,()>.

e_make_func2

Returns Result<(),()>.

handle

Returns Ok(ret).

handle2

Returns Ok(()).

make_func

Returns OsResult<$ret>.

make_func2

Returns OsResult<()>.

make_func_hresult
make_handle
make_struct
tp_func

Returns the returned value as they are.

Functions

MAKE_QWORD

Type Definitions

OsResult