winapi\shared/
minwindef.rs

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