zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit be86e41d975325d30145e30369912a409012b76b (tree)
parent 4830415071c3d62e4e2c19e5f5342151632e72bb
Author: daurnimator <quae@daurnimator.com>
Date:   Wed, 13 Nov 2019 15:37:21 +1100

std: add CTL_CODE function for windows

Diffstat:
Mlib/std/os/windows/bits.zig | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/lib/std/os/windows/bits.zig b/lib/std/os/windows/bits.zig @@ -166,6 +166,14 @@ pub const FILE_ANY_ACCESS = 0; pub const FILE_READ_ACCESS = 1; pub const FILE_WRITE_ACCESS = 2; +/// https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/defining-i-o-control-codes +pub fn CTL_CODE(deviceType: u16, function: u12, method: TransferType, access: u2) DWORD { + return (@as(DWORD, deviceType) << 16) | + (@as(DWORD, access) << 14) | + (@as(DWORD, function) << 2) | + @enumToInt(method); +} + pub const INVALID_HANDLE_VALUE = @intToPtr(HANDLE, maxInt(usize)); pub const INVALID_FILE_ATTRIBUTES = @as(DWORD, maxInt(DWORD));