| 1 |
// Licensed under the Apache License, Version 2.0 |
| 2 |
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. |
| 4 |
// All files in the project carrying such notice may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
//! Basic Windows Type Definitions for minwin partition |
| 7 |
use ctypes::{c_char, c_float, c_int, c_long, c_uchar, c_uint, c_ulong, c_ushort, c_void}; |
| 8 |
use shared::basetsd::{LONG_PTR, UINT_PTR}; |
| 9 |
use shared::ntdef::{HANDLE, LONG}; |
| 10 |
pub type ULONG = c_ulong; |
| 11 |
pub type PULONG = *mut ULONG; |
| 12 |
pub type USHORT = c_ushort; |
| 13 |
pub type PUSHORT = *mut USHORT; |
| 14 |
pub type UCHAR = c_uchar; |
| 15 |
pub type PUCHAR = *mut UCHAR; |
| 16 |
pub type PSZ = *mut c_char; |
| 17 |
pub const MAX_PATH: usize = 260; |
| 18 |
pub const FALSE: BOOL = 0; |
| 19 |
pub const TRUE: BOOL = 1; |
| 20 |
pub type DWORD = c_ulong; |
| 21 |
pub type BOOL = c_int; |
| 22 |
pub type BYTE = c_uchar; |
| 23 |
pub type WORD = c_ushort; |
| 24 |
pub type FLOAT = c_float; |
| 25 |
pub type PFLOAT = *mut FLOAT; |
| 26 |
pub type PBOOL = *mut BOOL; |
| 27 |
pub type LPBOOL = *mut BOOL; |
| 28 |
pub type PBYTE = *mut BYTE; |
| 29 |
pub type LPBYTE = *mut BYTE; |
| 30 |
pub type PINT = *mut c_int; |
| 31 |
pub type LPINT = *mut c_int; |
| 32 |
pub type PWORD = *mut WORD; |
| 33 |
pub type LPWORD = *mut WORD; |
| 34 |
pub type LPLONG = *mut c_long; |
| 35 |
pub type PDWORD = *mut DWORD; |
| 36 |
pub type LPDWORD = *mut DWORD; |
| 37 |
pub type LPVOID = *mut c_void; |
| 38 |
pub type LPCVOID = *const c_void; |
| 39 |
pub type INT = c_int; |
| 40 |
pub type UINT = c_uint; |
| 41 |
pub type PUINT = *mut c_uint; |
| 42 |
pub type WPARAM = UINT_PTR; |
| 43 |
pub type LPARAM = LONG_PTR; |
| 44 |
pub type LRESULT = LONG_PTR; |
| 45 |
#[inline] |
| 46 |
pub fn MAKEWORD(a: BYTE, b: BYTE) -> WORD { |
| 47 |
(a as WORD) | ((b as WORD) << 8) |
| 48 |
} |
| 49 |
#[inline] |
| 50 |
pub fn MAKELONG(a: WORD, b: WORD) -> LONG { |
| 51 |
((a as DWORD) | ((b as DWORD) << 16)) as LONG |
| 52 |
} |
| 53 |
#[inline] |
| 54 |
pub fn LOWORD(l: DWORD) -> WORD { |
| 55 |
(l & 0xffff) as WORD |
| 56 |
} |
| 57 |
#[inline] |
| 58 |
pub fn HIWORD(l: DWORD) -> WORD { |
| 59 |
((l >> 16) & 0xffff) as WORD |
| 60 |
} |
| 61 |
#[inline] |
| 62 |
pub fn LOBYTE(l: WORD) -> BYTE { |
| 63 |
(l & 0xff) as BYTE |
| 64 |
} |
| 65 |
#[inline] |
| 66 |
pub fn HIBYTE(l: WORD) -> BYTE { |
| 67 |
((l >> 8) & 0xff) as BYTE |
| 68 |
} |
| 69 |
pub type SPHANDLE = *mut HANDLE; |
| 70 |
pub type LPHANDLE = *mut HANDLE; |
| 71 |
pub type HGLOBAL = HANDLE; |
| 72 |
pub type HLOCAL = HANDLE; |
| 73 |
pub type GLOBALHANDLE = HANDLE; |
| 74 |
pub type LOCALHANDLE = HANDLE; |
| 75 |
pub enum __some_function {} |
| 76 |
/// Pointer to a function with unknown type signature. |
| 77 |
pub type FARPROC = *mut __some_function; |
| 78 |
/// Pointer to a function with unknown type signature. |
| 79 |
pub type NEARPROC = *mut __some_function; |
| 80 |
/// Pointer to a function with unknown type signature. |
| 81 |
pub type PROC = *mut __some_function; |
| 82 |
pub type ATOM = WORD; |
| 83 |
DECLARE_HANDLE!{HKEY, HKEY__} |
| 84 |
pub type PHKEY = *mut HKEY; |
| 85 |
DECLARE_HANDLE!{HMETAFILE, HMETAFILE__} |
| 86 |
DECLARE_HANDLE!{HINSTANCE, HINSTANCE__} |
| 87 |
pub type HMODULE = HINSTANCE; |
| 88 |
DECLARE_HANDLE!{HRGN, HRGN__} |
| 89 |
DECLARE_HANDLE!{HRSRC, HRSRC__} |
| 90 |
DECLARE_HANDLE!{HSPRITE, HSPRITE__} |
| 91 |
DECLARE_HANDLE!{HLSURF, HLSURF__} |
| 92 |
DECLARE_HANDLE!{HSTR, HSTR__} |
| 93 |
DECLARE_HANDLE!{HTASK, HTASK__} |
| 94 |
DECLARE_HANDLE!{HWINSTA, HWINSTA__} |
| 95 |
DECLARE_HANDLE!{HKL, HKL__} |
| 96 |
pub type HFILE = c_int; |
| 97 |
STRUCT!{#[debug] struct FILETIME { |
| 98 |
dwLowDateTime: DWORD, |
| 99 |
dwHighDateTime: DWORD, |
| 100 |
}} |
| 101 |
pub type PFILETIME = *mut FILETIME; |
| 102 |
pub type LPFILETIME = *mut FILETIME; |