std: add CTL_CODE function for windows

This commit is contained in:
daurnimator 2019-11-13 15:37:21 +11:00
parent 4830415071
commit be86e41d97
No known key found for this signature in database
GPG Key ID: 45B429A8F9D9D22A

View File

@ -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));