mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.os.windows: reorg to avoid usingnamespace
Down to 19 uses of `usingnamespace`.
This commit is contained in:
parent
b781ef464d
commit
7884d84315
@ -236,21 +236,23 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
|
||||
mem.copy(T, self.items[old_len..], items);
|
||||
}
|
||||
|
||||
pub usingnamespace if (T != u8) struct {} else struct {
|
||||
pub const Writer = std.io.Writer(*Self, error{OutOfMemory}, appendWrite);
|
||||
pub const Writer = if (T != u8)
|
||||
@compileError("The Writer interface is only defined for ArrayList(u8) " ++
|
||||
"but the given type is ArrayList(" ++ @typeName(T) ++ ")")
|
||||
else
|
||||
std.io.Writer(*Self, error{OutOfMemory}, appendWrite);
|
||||
|
||||
/// Initializes a Writer which will append to the list.
|
||||
pub fn writer(self: *Self) Writer {
|
||||
return .{ .context = self };
|
||||
}
|
||||
/// Initializes a Writer which will append to the list.
|
||||
pub fn writer(self: *Self) Writer {
|
||||
return .{ .context = self };
|
||||
}
|
||||
|
||||
/// Same as `append` except it returns the number of bytes written, which is always the same
|
||||
/// as `m.len`. The purpose of this function existing is to match `std.io.Writer` API.
|
||||
fn appendWrite(self: *Self, m: []const u8) !usize {
|
||||
try self.appendSlice(m);
|
||||
return m.len;
|
||||
}
|
||||
};
|
||||
/// Same as `append` except it returns the number of bytes written, which is always the same
|
||||
/// as `m.len`. The purpose of this function existing is to match `std.io.Writer` API.
|
||||
fn appendWrite(self: *Self, m: []const u8) !usize {
|
||||
try self.appendSlice(m);
|
||||
return m.len;
|
||||
}
|
||||
|
||||
/// Append a value to the list `n` times.
|
||||
/// Allocates more memory as necessary.
|
||||
|
||||
@ -969,7 +969,7 @@ pub const sigset_t = extern struct {
|
||||
|
||||
pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** _SIG_WORDS };
|
||||
|
||||
pub usingnamespace switch (builtin.cpu.arch) {
|
||||
const arch_bits = switch (builtin.cpu.arch) {
|
||||
.x86_64 => struct {
|
||||
pub const ucontext_t = extern struct {
|
||||
sigmask: sigset_t,
|
||||
@ -1015,6 +1015,8 @@ pub usingnamespace switch (builtin.cpu.arch) {
|
||||
},
|
||||
else => struct {},
|
||||
};
|
||||
pub const ucontext_t = arch_bits.ucontext_t;
|
||||
pub const mcontext_t = arch_bits.mcontext_t;
|
||||
|
||||
pub const E = enum(u16) {
|
||||
/// No error occurred.
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
const std = @import("../std.zig");
|
||||
const maxInt = std.math.maxInt;
|
||||
|
||||
usingnamespace std.c;
|
||||
|
||||
extern "c" fn _errnop() *c_int;
|
||||
|
||||
pub const _errno = _errnop;
|
||||
|
||||
@ -2,8 +2,6 @@ const std = @import("../std.zig");
|
||||
const builtin = @import("builtin");
|
||||
const maxInt = std.math.maxInt;
|
||||
|
||||
usingnamespace std.c;
|
||||
|
||||
extern "c" fn __errno() *c_int;
|
||||
pub const _errno = __errno;
|
||||
|
||||
|
||||
@ -810,7 +810,7 @@ comptime {
|
||||
std.debug.assert(@sizeOf(siginfo_t) == 136);
|
||||
}
|
||||
|
||||
pub usingnamespace switch (builtin.cpu.arch) {
|
||||
const arch_bits = switch (builtin.cpu.arch) {
|
||||
.x86_64 => struct {
|
||||
pub const ucontext_t = extern struct {
|
||||
sc_rdi: c_long,
|
||||
@ -863,6 +863,8 @@ pub usingnamespace switch (builtin.cpu.arch) {
|
||||
},
|
||||
else => struct {},
|
||||
};
|
||||
pub const ucontext_t = arch_bits.ucontext_t;
|
||||
pub const fxsave64 = arch_bits.fxsave64;
|
||||
|
||||
pub const sigset_t = c_uint;
|
||||
pub const empty_sigset: sigset_t = 0;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
//! The reference for these types and values is Microsoft Windows's ucrt (Universal C RunTime).
|
||||
const std = @import("../std.zig");
|
||||
const ws2_32 = std.os.windows.ws2_32;
|
||||
|
||||
const ws2_32 = @import("../os/windows/ws2_32.zig");
|
||||
const windows = std.os.windows;
|
||||
|
||||
pub extern "c" fn _errno() *c_int;
|
||||
|
||||
@ -22,9 +24,9 @@ pub extern "c" fn sigfillset(set: ?*sigset_t) void;
|
||||
pub extern "c" fn alarm(seconds: c_uint) c_uint;
|
||||
pub extern "c" fn sigwait(set: ?*sigset_t, sig: ?*c_int) c_int;
|
||||
|
||||
pub const fd_t = HANDLE;
|
||||
pub const ino_t = LARGE_INTEGER;
|
||||
pub const pid_t = HANDLE;
|
||||
pub const fd_t = windows.HANDLE;
|
||||
pub const ino_t = windows.LARGE_INTEGER;
|
||||
pub const pid_t = windows.HANDLE;
|
||||
pub const mode_t = u0;
|
||||
|
||||
pub const PATH_MAX = 260;
|
||||
@ -191,7 +193,9 @@ pub const STRUNCATE = 80;
|
||||
pub const F_OK = 0;
|
||||
|
||||
/// Remove directory instead of unlinking file
|
||||
pub const AT_REMOVEDIR = 0x200;
|
||||
pub const AT = struct {
|
||||
pub const REMOVEDIR = 0x200;
|
||||
};
|
||||
|
||||
pub const in_port_t = u16;
|
||||
pub const sa_family_t = ws2_32.ADDRESS_FAMILY;
|
||||
@ -205,7 +209,7 @@ pub const in_addr = u32;
|
||||
pub const addrinfo = ws2_32.addrinfo;
|
||||
pub const AF = ws2_32.AF;
|
||||
pub const SOCK = ws2_32.SOCK;
|
||||
pub const IPPROTO = ws2_32.IPPROTOP;
|
||||
pub const IPPROTO = ws2_32.IPPROTO;
|
||||
pub const BTHPROTO_RFCOMM = ws2_32.BTHPROTO_RFCOMM;
|
||||
|
||||
pub const nfds_t = c_ulong;
|
||||
@ -216,29 +220,31 @@ pub const SO = ws2_32.SO;
|
||||
pub const PVD_CONFIG = ws2_32.PVD_CONFIG;
|
||||
pub const TCP_NODELAY = ws2_32.TCP_NODELAY;
|
||||
|
||||
pub const O_RDONLY = 0o0;
|
||||
pub const O_WRONLY = 0o1;
|
||||
pub const O_RDWR = 0o2;
|
||||
pub const O = struct {
|
||||
pub const RDONLY = 0o0;
|
||||
pub const WRONLY = 0o1;
|
||||
pub const RDWR = 0o2;
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
pub const O_NOCTTY = 0o400;
|
||||
pub const O_TRUNC = 0o1000;
|
||||
pub const O_APPEND = 0o2000;
|
||||
pub const O_NONBLOCK = 0o4000;
|
||||
pub const O_DSYNC = 0o10000;
|
||||
pub const O_SYNC = 0o4010000;
|
||||
pub const O_RSYNC = 0o4010000;
|
||||
pub const O_DIRECTORY = 0o200000;
|
||||
pub const O_NOFOLLOW = 0o400000;
|
||||
pub const O_CLOEXEC = 0o2000000;
|
||||
pub const CREAT = 0o100;
|
||||
pub const EXCL = 0o200;
|
||||
pub const NOCTTY = 0o400;
|
||||
pub const TRUNC = 0o1000;
|
||||
pub const APPEND = 0o2000;
|
||||
pub const NONBLOCK = 0o4000;
|
||||
pub const DSYNC = 0o10000;
|
||||
pub const SYNC = 0o4010000;
|
||||
pub const RSYNC = 0o4010000;
|
||||
pub const DIRECTORY = 0o200000;
|
||||
pub const NOFOLLOW = 0o400000;
|
||||
pub const CLOEXEC = 0o2000000;
|
||||
|
||||
pub const O_ASYNC = 0o20000;
|
||||
pub const O_DIRECT = 0o40000;
|
||||
pub const O_LARGEFILE = 0;
|
||||
pub const O_NOATIME = 0o1000000;
|
||||
pub const O_PATH = 0o10000000;
|
||||
pub const O_TMPFILE = 0o20200000;
|
||||
pub const O_NDELAY = O_NONBLOCK;
|
||||
pub const ASYNC = 0o20000;
|
||||
pub const DIRECT = 0o40000;
|
||||
pub const LARGEFILE = 0;
|
||||
pub const NOATIME = 0o1000000;
|
||||
pub const PATH = 0o10000000;
|
||||
pub const TMPFILE = 0o20200000;
|
||||
pub const NDELAY = NONBLOCK;
|
||||
};
|
||||
|
||||
pub const IFNAMESIZE = 30;
|
||||
|
||||
@ -12,20 +12,23 @@ const is_windows = std.Target.current.os.tag == .windows;
|
||||
|
||||
pub const File = struct {
|
||||
/// The OS-specific file descriptor or file handle.
|
||||
handle: os.fd_t,
|
||||
handle: Handle,
|
||||
|
||||
/// On some systems, such as Linux, file system file descriptors are incapable of non-blocking I/O.
|
||||
/// This forces us to perform asynchronous I/O on a dedicated thread, to achieve non-blocking
|
||||
/// file-system I/O. To do this, `File` must be aware of whether it is a file system file descriptor,
|
||||
/// or, more specifically, whether the I/O is always blocking.
|
||||
/// On some systems, such as Linux, file system file descriptors are incapable
|
||||
/// of non-blocking I/O. This forces us to perform asynchronous I/O on a dedicated thread,
|
||||
/// to achieve non-blocking file-system I/O. To do this, `File` must be aware of whether
|
||||
/// it is a file system file descriptor, or, more specifically, whether the I/O is always
|
||||
/// blocking.
|
||||
capable_io_mode: io.ModeOverride = io.default_mode,
|
||||
|
||||
/// Furthermore, even when `std.io.mode` is async, it is still sometimes desirable to perform blocking I/O,
|
||||
/// although not by default. For example, when printing a stack trace to stderr.
|
||||
/// This field tracks both by acting as an overriding I/O mode. When not building in async I/O mode,
|
||||
/// the type only has the `.blocking` tag, making it a zero-bit type.
|
||||
/// Furthermore, even when `std.io.mode` is async, it is still sometimes desirable
|
||||
/// to perform blocking I/O, although not by default. For example, when printing a
|
||||
/// stack trace to stderr. This field tracks both by acting as an overriding I/O mode.
|
||||
/// When not building in async I/O mode, the type only has the `.blocking` tag, making
|
||||
/// it a zero-bit type.
|
||||
intended_io_mode: io.ModeOverride = io.default_mode,
|
||||
|
||||
pub const Handle = os.fd_t;
|
||||
pub const Mode = os.mode_t;
|
||||
pub const INode = os.ino_t;
|
||||
|
||||
|
||||
@ -3,8 +3,7 @@ const os = std.os;
|
||||
const mem = std.mem;
|
||||
const math = std.math;
|
||||
const Allocator = mem.Allocator;
|
||||
|
||||
usingnamespace std.os.wasi;
|
||||
const wasi = std.os.wasi;
|
||||
|
||||
/// Type-tag of WASI preopen.
|
||||
///
|
||||
|
||||
@ -23,6 +23,7 @@ const mem = std.mem;
|
||||
const elf = std.elf;
|
||||
const dl = @import("dynamic_library.zig");
|
||||
const MAX_PATH_BYTES = std.fs.MAX_PATH_BYTES;
|
||||
const is_windows = builtin.os.tag == .windows;
|
||||
|
||||
pub const darwin = std.c;
|
||||
pub const dragonfly = std.c;
|
||||
@ -53,12 +54,11 @@ test {
|
||||
/// When not linking libc, it is the OS-specific system interface.
|
||||
pub const system = if (@hasDecl(root, "os") and root.os != @This())
|
||||
root.os.system
|
||||
else if (builtin.link_libc)
|
||||
else if (builtin.link_libc or is_windows)
|
||||
std.c
|
||||
else switch (builtin.os.tag) {
|
||||
.linux => linux,
|
||||
.wasi => wasi,
|
||||
.windows => windows,
|
||||
.uefi => uefi,
|
||||
else => struct {},
|
||||
};
|
||||
@ -1949,7 +1949,7 @@ pub fn unlinkW(file_path_w: []const u16) UnlinkError!void {
|
||||
}
|
||||
|
||||
pub const UnlinkatError = UnlinkError || error{
|
||||
/// When passing `AT_REMOVEDIR`, this error occurs when the named directory is not empty.
|
||||
/// When passing `AT.REMOVEDIR`, this error occurs when the named directory is not empty.
|
||||
DirNotEmpty,
|
||||
};
|
||||
|
||||
@ -1972,7 +1972,7 @@ pub const unlinkatC = @compileError("deprecated: renamed to unlinkatZ");
|
||||
/// WASI-only. Same as `unlinkat` but targeting WASI.
|
||||
/// See also `unlinkat`.
|
||||
pub fn unlinkatWasi(dirfd: fd_t, file_path: []const u8, flags: u32) UnlinkatError!void {
|
||||
const remove_dir = (flags & AT_REMOVEDIR) != 0;
|
||||
const remove_dir = (flags & AT.REMOVEDIR) != 0;
|
||||
const res = if (remove_dir)
|
||||
wasi.path_remove_directory(dirfd, file_path.ptr, file_path.len)
|
||||
else
|
||||
@ -2032,7 +2032,7 @@ pub fn unlinkatZ(dirfd: fd_t, file_path_c: [*:0]const u8, flags: u32) UnlinkatEr
|
||||
|
||||
/// Same as `unlinkat` but `sub_path_w` is UTF16LE, NT prefixed. Windows only.
|
||||
pub fn unlinkatW(dirfd: fd_t, sub_path_w: []const u16, flags: u32) UnlinkatError!void {
|
||||
const remove_dir = (flags & AT_REMOVEDIR) != 0;
|
||||
const remove_dir = (flags & AT.REMOVEDIR) != 0;
|
||||
return windows.DeleteFile(sub_path_w, .{ .dir = dirfd, .remove_dir = remove_dir });
|
||||
}
|
||||
|
||||
|
||||
@ -676,7 +676,7 @@ test "fsync" {
|
||||
}
|
||||
|
||||
test "getrlimit and setrlimit" {
|
||||
if (!@hasDecl(os, "rlimit")) {
|
||||
if (native_os == .windows) {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,14 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
const BOOL = windows.BOOL;
|
||||
const DWORD = windows.DWORD;
|
||||
const HKEY = windows.HKEY;
|
||||
const BYTE = windows.BYTE;
|
||||
const LPCWSTR = windows.LPCWSTR;
|
||||
const LSTATUS = windows.LSTATUS;
|
||||
const REGSAM = windows.REGSAM;
|
||||
const ULONG = windows.ULONG;
|
||||
const WINAPI = windows.WINAPI;
|
||||
|
||||
pub extern "advapi32" fn RegOpenKeyExW(
|
||||
hKey: HKEY,
|
||||
@ -11,10 +21,10 @@ pub extern "advapi32" fn RegOpenKeyExW(
|
||||
pub extern "advapi32" fn RegQueryValueExW(
|
||||
hKey: HKEY,
|
||||
lpValueName: LPCWSTR,
|
||||
lpReserved: LPDWORD,
|
||||
lpType: LPDWORD,
|
||||
lpData: LPBYTE,
|
||||
lpcbData: LPDWORD,
|
||||
lpReserved: *DWORD,
|
||||
lpType: *DWORD,
|
||||
lpData: *BYTE,
|
||||
lpcbData: *DWORD,
|
||||
) callconv(WINAPI) LSTATUS;
|
||||
|
||||
// RtlGenRandom is known as SystemFunction036 under advapi32
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,10 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
const BOOL = windows.BOOL;
|
||||
const DWORD = windows.DWORD;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const HDC = windows.HDC;
|
||||
const HGLRC = windows.HGLRC;
|
||||
|
||||
pub const PIXELFORMATDESCRIPTOR = extern struct {
|
||||
nSize: WORD = @sizeOf(PIXELFORMATDESCRIPTOR),
|
||||
|
||||
@ -1,10 +1,47 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
|
||||
const BOOL = windows.BOOL;
|
||||
const BOOLEAN = windows.BOOLEAN;
|
||||
const CONDITION_VARIABLE = windows.CONDITION_VARIABLE;
|
||||
const CONSOLE_SCREEN_BUFFER_INFO = windows.CONSOLE_SCREEN_BUFFER_INFO;
|
||||
const COORD = windows.COORD;
|
||||
const DWORD = windows.DWORD;
|
||||
const FILE_INFO_BY_HANDLE_CLASS = windows.FILE_INFO_BY_HANDLE_CLASS;
|
||||
const HANDLE = windows.HANDLE;
|
||||
const HMODULE = windows.HMODULE;
|
||||
const HRESULT = windows.HRESULT;
|
||||
const LARGE_INTEGER = windows.LARGE_INTEGER;
|
||||
const LPCWSTR = windows.LPCWSTR;
|
||||
const LPTHREAD_START_ROUTINE = windows.LPTHREAD_START_ROUTINE;
|
||||
const LPVOID = windows.LPVOID;
|
||||
const LPWSTR = windows.LPWSTR;
|
||||
const MODULEINFO = windows.MODULEINFO;
|
||||
const OVERLAPPED = windows.OVERLAPPED;
|
||||
const PERFORMANCE_INFORMATION = windows.PERFORMANCE_INFORMATION;
|
||||
const PROCESS_MEMORY_COUNTERS = windows.PROCESS_MEMORY_COUNTERS;
|
||||
const PSAPI_WS_WATCH_INFORMATION = windows.PSAPI_WS_WATCH_INFORMATION;
|
||||
const PSAPI_WS_WATCH_INFORMATION_EX = windows.PSAPI_WS_WATCH_INFORMATION_EX;
|
||||
const SECURITY_ATTRIBUTES = windows.SECURITY_ATTRIBUTES;
|
||||
const SIZE_T = windows.SIZE_T;
|
||||
const SRWLOCK = windows.SRWLOCK;
|
||||
const UINT = windows.UINT;
|
||||
const VECTORED_EXCEPTION_HANDLER = windows.VECTORED_EXCEPTION_HANDLER;
|
||||
const WCHAR = windows.WCHAR;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const WORD = windows.WORD;
|
||||
const Win32Error = windows.Win32Error;
|
||||
const va_list = windows.va_list;
|
||||
const HLOCAL = windows.HLOCAL;
|
||||
const FILETIME = windows.FILETIME;
|
||||
const STARTUPINFOW = windows.STARTUPINFOW;
|
||||
const PROCESS_INFORMATION = windows.PROCESS_INFORMATION;
|
||||
|
||||
pub extern "kernel32" fn AddVectoredExceptionHandler(First: c_ulong, Handler: ?VECTORED_EXCEPTION_HANDLER) callconv(WINAPI) ?*c_void;
|
||||
pub extern "kernel32" fn RemoveVectoredExceptionHandler(Handle: HANDLE) callconv(WINAPI) c_ulong;
|
||||
|
||||
pub extern "kernel32" fn CancelIo(hFile: HANDLE) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn CancelIoEx(hFile: HANDLE, lpOverlapped: ?LPOVERLAPPED) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn CancelIoEx(hFile: HANDLE, lpOverlapped: ?*OVERLAPPED) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn CloseHandle(hObject: HANDLE) callconv(WINAPI) BOOL;
|
||||
|
||||
@ -22,7 +59,7 @@ pub extern "kernel32" fn CreateFileW(
|
||||
lpFileName: [*:0]const u16,
|
||||
dwDesiredAccess: DWORD,
|
||||
dwShareMode: DWORD,
|
||||
lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES,
|
||||
lpSecurityAttributes: ?*SECURITY_ATTRIBUTES,
|
||||
dwCreationDisposition: DWORD,
|
||||
dwFlagsAndAttributes: DWORD,
|
||||
hTemplateFile: ?HANDLE,
|
||||
@ -63,7 +100,7 @@ pub extern "kernel32" fn CreateSymbolicLinkW(lpSymlinkFileName: [*:0]const u16,
|
||||
|
||||
pub extern "kernel32" fn CreateIoCompletionPort(FileHandle: HANDLE, ExistingCompletionPort: ?HANDLE, CompletionKey: ULONG_PTR, NumberOfConcurrentThreads: DWORD) callconv(WINAPI) ?HANDLE;
|
||||
|
||||
pub extern "kernel32" fn CreateThread(lpThreadAttributes: ?LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?LPDWORD) callconv(WINAPI) ?HANDLE;
|
||||
pub extern "kernel32" fn CreateThread(lpThreadAttributes: ?*SECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?*DWORD) callconv(WINAPI) ?HANDLE;
|
||||
|
||||
pub extern "kernel32" fn DeviceIoControl(
|
||||
h: HANDLE,
|
||||
@ -96,9 +133,9 @@ pub extern "kernel32" fn GetCommandLineW() callconv(WINAPI) LPWSTR;
|
||||
pub extern "kernel32" fn GetConsoleMode(in_hConsoleHandle: HANDLE, out_lpMode: *DWORD) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: *CONSOLE_SCREEN_BUFFER_INFO) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn FillConsoleOutputCharacterA(hConsoleOutput: HANDLE, cCharacter: CHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn FillConsoleOutputCharacterW(hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn FillConsoleOutputAttribute(hConsoleOutput: HANDLE, wAttribute: WORD, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfAttrsWritten: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn FillConsoleOutputCharacterA(hConsoleOutput: HANDLE, cCharacter: CHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn FillConsoleOutputCharacterW(hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn FillConsoleOutputAttribute(hConsoleOutput: HANDLE, wAttribute: WORD, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfAttrsWritten: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: ?[*]WCHAR) callconv(WINAPI) DWORD;
|
||||
@ -156,7 +193,7 @@ pub extern "kernel32" fn GetFullPathNameW(
|
||||
pub extern "kernel32" fn GetOverlappedResult(hFile: HANDLE, lpOverlapped: *OVERLAPPED, lpNumberOfBytesTransferred: *DWORD, bWait: BOOL) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn GetProcessHeap() callconv(WINAPI) ?HANDLE;
|
||||
pub extern "kernel32" fn GetQueuedCompletionStatus(CompletionPort: HANDLE, lpNumberOfBytesTransferred: LPDWORD, lpCompletionKey: *ULONG_PTR, lpOverlapped: *?*OVERLAPPED, dwMilliseconds: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn GetQueuedCompletionStatus(CompletionPort: HANDLE, lpNumberOfBytesTransferred: *DWORD, lpCompletionKey: *ULONG_PTR, lpOverlapped: *?*OVERLAPPED, dwMilliseconds: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn GetQueuedCompletionStatusEx(
|
||||
CompletionPort: HANDLE,
|
||||
lpCompletionPortEntries: [*]OVERLAPPED_ENTRY,
|
||||
@ -282,7 +319,7 @@ pub extern "kernel32" fn WriteFile(
|
||||
in_out_lpOverlapped: ?*OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: *OVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn LoadLibraryW(lpLibFileName: [*:0]const u16) callconv(WINAPI) ?HMODULE;
|
||||
|
||||
@ -298,12 +335,12 @@ pub extern "kernel32" fn DeleteCriticalSection(lpCriticalSection: *CRITICAL_SECT
|
||||
pub extern "kernel32" fn InitOnceExecuteOnce(InitOnce: *INIT_ONCE, InitFn: INIT_ONCE_FN, Parameter: ?*c_void, Context: ?*c_void) callconv(WINAPI) BOOL;
|
||||
|
||||
pub extern "kernel32" fn K32EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
@ -314,13 +351,13 @@ pub extern "kernel32" fn K32GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODU
|
||||
pub extern "kernel32" fn K32GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: *MODULEINFO, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetPerformanceInfo(pPerformanceInformation: *PERFORMANCE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn K32GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetWsChanges(hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: *PROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetWsChanges(hProcess: HANDLE, lpWatchInfo: *PSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: *PSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32InitializeProcessForWsWatch(hProcess: HANDLE) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
|
||||
@ -1,7 +1,29 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
|
||||
const BOOL = windows.BOOL;
|
||||
const DWORD = windows.DWORD;
|
||||
const ULONG = windows.ULONG;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const NTSTATUS = windows.NTSTATUS;
|
||||
const WORD = windows.WORD;
|
||||
const HANDLE = windows.HANDLE;
|
||||
const ACCESS_MASK = windows.ACCESS_MASK;
|
||||
const IO_APC_ROUTINE = windows.IO_APC_ROUTINE;
|
||||
const BOOLEAN = windows.BOOLEAN;
|
||||
const OBJECT_ATTRIBUTES = windows.OBJECT_ATTRIBUTES;
|
||||
const PVOID = windows.PVOID;
|
||||
const IO_STATUS_BLOCK = windows.IO_STATUS_BLOCK;
|
||||
const LARGE_INTEGER = windows.LARGE_INTEGER;
|
||||
const OBJECT_INFORMATION_CLASS = windows.OBJECT_INFORMATION_CLASS;
|
||||
const FILE_INFORMATION_CLASS = windows.FILE_INFORMATION_CLASS;
|
||||
const UNICODE_STRING = windows.UNICODE_STRING;
|
||||
const RTL_OSVERSIONINFOW = windows.RTL_OSVERSIONINFOW;
|
||||
const FILE_BASIC_INFORMATION = windows.FILE_BASIC_INFORMATION;
|
||||
const SIZE_T = windows.SIZE_T;
|
||||
|
||||
pub extern "NtDll" fn RtlGetVersion(
|
||||
lpVersionInformation: PRTL_OSVERSIONINFOW,
|
||||
lpVersionInformation: *RTL_OSVERSIONINFOW,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
pub extern "NtDll" fn RtlCaptureStackBackTrace(
|
||||
FramesToSkip: DWORD,
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const LPVOID = windows.LPVOID;
|
||||
const DWORD = windows.DWORD;
|
||||
const HRESULT = windows.HRESULT;
|
||||
|
||||
pub extern "ole32" fn CoTaskMemFree(pv: LPVOID) callconv(WINAPI) void;
|
||||
pub extern "ole32" fn CoUninitialize() callconv(WINAPI) void;
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const DWORD = windows.DWORD;
|
||||
|
||||
pub extern "psapi" fn EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: LPDWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: LPDWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: *DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
@ -17,13 +20,13 @@ pub extern "psapi" fn GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODULE, lp
|
||||
pub extern "psapi" fn GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetPerformanceInfo(pPerformanceInformation: PPERFORMACE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: *MODULEINFO, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetPerformanceInfo(pPerformanceInformation: *PERFORMANCE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
|
||||
pub extern "psapi" fn GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetWsChanges(hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: PPSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: *PROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetWsChanges(hProcess: HANDLE, lpWatchInfo: *PSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: *PSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn InitializeProcessForWsWatch(hProcess: HANDLE) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
pub extern "psapi" fn QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const KNOWNFOLDERID = windows.KNOWNFOLDERID;
|
||||
const DWORD = windows.DWORD;
|
||||
const HANDLE = windows.HANDLE;
|
||||
const WCHAR = windows.WCHAR;
|
||||
const HRESULT = windows.HRESULT;
|
||||
|
||||
pub extern "shell32" fn SHGetKnownFolderPath(rfid: *const KNOWNFOLDERID, dwFlags: DWORD, hToken: ?HANDLE, ppszPath: *[*:0]WCHAR) callconv(WINAPI) HRESULT;
|
||||
pub extern "shell32" fn SHGetKnownFolderPath(
|
||||
rfid: *const KNOWNFOLDERID,
|
||||
dwFlags: DWORD,
|
||||
hToken: ?HANDLE,
|
||||
ppszPath: *[*:0]WCHAR,
|
||||
) callconv(WINAPI) HRESULT;
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("std");
|
||||
const builtin = std.builtin;
|
||||
const std = @import("../../std.zig");
|
||||
const assert = std.debug.assert;
|
||||
const windows = @import("../windows.zig");
|
||||
const windows = std.os.windows;
|
||||
const unexpectedError = windows.unexpectedError;
|
||||
const GetLastError = windows.kernel32.GetLastError;
|
||||
const SetLastError = windows.kernel32.SetLastError;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,9 @@
|
||||
usingnamespace @import("bits.zig");
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const UINT = windows.UINT;
|
||||
const BYTE = windows.BYTE;
|
||||
const DWORD = windows.DWORD;
|
||||
|
||||
pub const MMRESULT = UINT;
|
||||
pub const MMSYSERR_BASE = 0;
|
||||
|
||||
@ -1,4 +1,13 @@
|
||||
const std = @import("../../std.zig");
|
||||
const windows = std.os.windows;
|
||||
|
||||
const WINAPI = windows.WINAPI;
|
||||
const OVERLAPPED = windows.OVERLAPPED;
|
||||
const WORD = windows.WORD;
|
||||
const DWORD = windows.DWORD;
|
||||
const GUID = windows.GUID;
|
||||
const USHORT = windows.USHORT;
|
||||
const WCHAR = windows.WCHAR;
|
||||
|
||||
pub const SOCKET = *opaque {};
|
||||
pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user