mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 22:09:49 +00:00
std: add CreateEvent for windows
This commit is contained in:
parent
78c0d33eb7
commit
b05a5a3e52
@ -97,6 +97,22 @@ pub fn CreatePipe(rd: *HANDLE, wr: *HANDLE, sattr: *const SECURITY_ATTRIBUTES) C
|
||||
}
|
||||
}
|
||||
|
||||
pub fn CreateEventEx(attributes: ?*SECURITY_ATTRIBUTES, name: []const u8, flags: DWORD, desired_access: DWORD) !HANDLE {
|
||||
const nameW = try sliceToPrefixedFileW(name);
|
||||
return CreateEventExW(attributes, &nameW, flags, desired_access);
|
||||
}
|
||||
|
||||
pub fn CreateEventExW(attributes: ?*SECURITY_ATTRIBUTES, nameW: [*:0]const u16, flags: DWORD, desired_access: DWORD) !HANDLE {
|
||||
const handle = kernel32.CreateEventExW(attributes, nameW, flags, desired_access);
|
||||
if (handle) |h| {
|
||||
return h;
|
||||
} else {
|
||||
switch (kernel32.GetLastError()) {
|
||||
else => |err| return unexpectedError(err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn DeviceIoControl(
|
||||
h: HANDLE,
|
||||
ioControlCode: DWORD,
|
||||
|
||||
@ -489,6 +489,13 @@ pub const FILE_ATTRIBUTE_SYSTEM = 0x4;
|
||||
pub const FILE_ATTRIBUTE_TEMPORARY = 0x100;
|
||||
pub const FILE_ATTRIBUTE_VIRTUAL = 0x10000;
|
||||
|
||||
// flags for CreateEvent
|
||||
pub const CREATE_EVENT_INITIAL_SET = 0x00000002;
|
||||
pub const CREATE_EVENT_MANUAL_RESET = 0x00000001;
|
||||
|
||||
pub const EVENT_ALL_ACCESS = 0x1F0003;
|
||||
pub const EVENT_MODIFY_STATE = 0x0002;
|
||||
|
||||
pub const PROCESS_INFORMATION = extern struct {
|
||||
hProcess: HANDLE,
|
||||
hThread: HANDLE,
|
||||
|
||||
@ -9,6 +9,13 @@ pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn CreateDirectoryW(lpPathName: [*]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) BOOL;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn CreateEventExW(
|
||||
lpEventAttributes: ?*SECURITY_ATTRIBUTES,
|
||||
lpName: [*:0]const u16,
|
||||
dwFlags: DWORD,
|
||||
dwDesiredAccess: DWORD,
|
||||
) ?HANDLE;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn CreateFileW(
|
||||
lpFileName: [*]const u16, // TODO null terminated pointer type
|
||||
dwDesiredAccess: DWORD,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user