mirror of
https://github.com/ziglang/zig.git
synced 2024-11-12 23:27:21 +00:00
Merge pull request #21843 from alexrp/callconv-followup
Some follow-up work for #21697
This commit is contained in:
commit
3054486d1d
@ -376,7 +376,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
lib/std/Target.zig
|
||||
lib/std/Target/Query.zig
|
||||
lib/std/Target/aarch64.zig
|
||||
lib/std/Target/amdgpu.zig
|
||||
lib/std/Target/amdgcn.zig
|
||||
lib/std/Target/arm.zig
|
||||
lib/std/Target/avr.zig
|
||||
lib/std/Target/bpf.zig
|
||||
|
@ -42,7 +42,7 @@ const largest_atomic_size = switch (arch) {
|
||||
// Objects smaller than this threshold are implemented in terms of compare-exchange
|
||||
// of a larger value.
|
||||
const smallest_atomic_fetch_exch_size = switch (arch) {
|
||||
// On AMDGPU, there are no instructions for atomic operations other than load and store
|
||||
// On AMDGCN, there are no instructions for atomic operations other than load and store
|
||||
// (as of LLVM 15), and so these need to be implemented in terms of atomic CAS.
|
||||
.amdgcn => @sizeOf(u32),
|
||||
else => @sizeOf(u8),
|
||||
|
@ -719,7 +719,7 @@ pub const Os = struct {
|
||||
|
||||
pub const aarch64 = @import("Target/aarch64.zig");
|
||||
pub const arc = @import("Target/arc.zig");
|
||||
pub const amdgpu = @import("Target/amdgpu.zig");
|
||||
pub const amdgcn = @import("Target/amdgcn.zig");
|
||||
pub const arm = @import("Target/arm.zig");
|
||||
pub const avr = @import("Target/avr.zig");
|
||||
pub const bpf = @import("Target/bpf.zig");
|
||||
@ -1592,7 +1592,6 @@ pub const Cpu = struct {
|
||||
.loongarch32, .loongarch64 => "loongarch",
|
||||
.mips, .mipsel, .mips64, .mips64el => "mips",
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc",
|
||||
.amdgcn => "amdgpu",
|
||||
.riscv32, .riscv64 => "riscv",
|
||||
.sparc, .sparc64 => "sparc",
|
||||
.s390x => "s390x",
|
||||
@ -1621,7 +1620,7 @@ pub const Cpu = struct {
|
||||
.mips, .mipsel, .mips64, .mips64el => &mips.all_features,
|
||||
.msp430 => &msp430.all_features,
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => &powerpc.all_features,
|
||||
.amdgcn => &amdgpu.all_features,
|
||||
.amdgcn => &amdgcn.all_features,
|
||||
.riscv32, .riscv64 => &riscv.all_features,
|
||||
.sparc, .sparc64 => &sparc.all_features,
|
||||
.spirv, .spirv32, .spirv64 => &spirv.all_features,
|
||||
@ -1653,7 +1652,7 @@ pub const Cpu = struct {
|
||||
.mips, .mipsel, .mips64, .mips64el => comptime allCpusFromDecls(mips.cpu),
|
||||
.msp430 => comptime allCpusFromDecls(msp430.cpu),
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => comptime allCpusFromDecls(powerpc.cpu),
|
||||
.amdgcn => comptime allCpusFromDecls(amdgpu.cpu),
|
||||
.amdgcn => comptime allCpusFromDecls(amdgcn.cpu),
|
||||
.riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),
|
||||
.sparc, .sparc64 => comptime allCpusFromDecls(sparc.cpu),
|
||||
.spirv, .spirv32, .spirv64 => comptime allCpusFromDecls(spirv.cpu),
|
||||
@ -1891,7 +1890,7 @@ pub const Cpu = struct {
|
||||
};
|
||||
};
|
||||
return switch (arch) {
|
||||
.amdgcn => &amdgpu.cpu.gfx600,
|
||||
.amdgcn => &amdgcn.cpu.gfx600,
|
||||
.arc => &arc.cpu.generic,
|
||||
.arm, .armeb, .thumb, .thumbeb => &arm.cpu.generic,
|
||||
.aarch64, .aarch64_be => &aarch64.cpu.generic,
|
||||
@ -1940,7 +1939,7 @@ pub const Cpu = struct {
|
||||
/// `Os.Tag.freestanding`.
|
||||
pub fn baseline(arch: Arch, os: Os) *const Model {
|
||||
return switch (arch) {
|
||||
.amdgcn => &amdgpu.cpu.gfx906,
|
||||
.amdgcn => &amdgcn.cpu.gfx906,
|
||||
.arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
|
||||
.aarch64 => switch (os.tag) {
|
||||
.bridgeos, .driverkit, .macos => &aarch64.cpu.apple_m1,
|
||||
@ -3308,6 +3307,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention {
|
||||
},
|
||||
.arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
|
||||
.netbsd => .{ .arm_apcs = .{} },
|
||||
.watchos => .{ .arm_aapcs16_vfp = .{} },
|
||||
else => switch (target.abi.floatAbi()) {
|
||||
.soft => .{ .arm_aapcs = .{} },
|
||||
.hard => .{ .arm_aapcs_vfp = .{} },
|
||||
|
@ -589,7 +589,7 @@ const WindowsThreadImpl = struct {
|
||||
fn_args: Args,
|
||||
thread: ThreadCompletion,
|
||||
|
||||
fn entryFn(raw_ptr: windows.PVOID) callconv(.C) windows.DWORD {
|
||||
fn entryFn(raw_ptr: windows.PVOID) callconv(.winapi) windows.DWORD {
|
||||
const self: *@This() = @ptrCast(@alignCast(raw_ptr));
|
||||
defer switch (self.thread.completion.swap(.completed, .seq_cst)) {
|
||||
.running => {},
|
||||
@ -749,7 +749,7 @@ const PosixThreadImpl = struct {
|
||||
const allocator = std.heap.c_allocator;
|
||||
|
||||
const Instance = struct {
|
||||
fn entryFn(raw_arg: ?*anyopaque) callconv(.C) ?*anyopaque {
|
||||
fn entryFn(raw_arg: ?*anyopaque) callconv(.c) ?*anyopaque {
|
||||
const args_ptr: *Args = @ptrCast(@alignCast(raw_arg));
|
||||
defer allocator.destroy(args_ptr);
|
||||
return callFn(f, args_ptr.*);
|
||||
@ -1363,7 +1363,7 @@ const LinuxThreadImpl = struct {
|
||||
fn_args: Args,
|
||||
thread: ThreadCompletion,
|
||||
|
||||
fn entryFn(raw_arg: usize) callconv(.C) u8 {
|
||||
fn entryFn(raw_arg: usize) callconv(.c) u8 {
|
||||
const self = @as(*@This(), @ptrFromInt(raw_arg));
|
||||
defer switch (self.thread.completion.swap(.completed, .seq_cst)) {
|
||||
.running => {},
|
||||
|
@ -293,12 +293,12 @@ pub const CallingConvention = union(enum(u8)) {
|
||||
arm_aapcs16_vfp: CommonOptions,
|
||||
arm_interrupt: ArmInterruptOptions,
|
||||
|
||||
// Calling conventions for the `mips64` architecture.
|
||||
// Calling conventions for the `mips64` and `mips64el` architectures.
|
||||
mips64_n64: CommonOptions,
|
||||
mips64_n32: CommonOptions,
|
||||
mips64_interrupt: MipsInterruptOptions,
|
||||
|
||||
// Calling conventions for the `mips` architecture.
|
||||
// Calling conventions for the `mips` and `mipsel` architectures.
|
||||
mips_o32: CommonOptions,
|
||||
mips_interrupt: MipsInterruptOptions,
|
||||
|
||||
@ -329,7 +329,7 @@ pub const CallingConvention = union(enum(u8)) {
|
||||
powerpc_aix: CommonOptions,
|
||||
powerpc_aix_altivec: CommonOptions,
|
||||
|
||||
/// The standard `wasm32`/`wasm64` calling convention, as specified in the WebAssembly Tool Conventions.
|
||||
/// The standard `wasm32` and `wasm64` calling convention, as specified in the WebAssembly Tool Conventions.
|
||||
wasm_watc: CommonOptions,
|
||||
|
||||
/// The standard `arc` calling convention.
|
||||
@ -396,7 +396,7 @@ pub const CallingConvention = union(enum(u8)) {
|
||||
amdgcn_kernel,
|
||||
amdgcn_cs: CommonOptions,
|
||||
|
||||
// Calling conventions for the `nvptx` architecture.
|
||||
// Calling conventions for the `nvptx` and `nvptx64` architectures.
|
||||
nvptx_device,
|
||||
nvptx_kernel,
|
||||
|
||||
|
@ -1344,7 +1344,7 @@ fn dumpSegfaultInfoPosix(sig: i32, code: i32, addr: usize, ctx_ptr: ?*anyopaque)
|
||||
}
|
||||
}
|
||||
|
||||
fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(windows.WINAPI) c_long {
|
||||
fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(.winapi) c_long {
|
||||
switch (info.ExceptionRecord.ExceptionCode) {
|
||||
windows.EXCEPTION_DATATYPE_MISALIGNMENT => handleSegfaultWindowsExtra(info, 0, "Unaligned Memory Access"),
|
||||
windows.EXCEPTION_ACCESS_VIOLATION => handleSegfaultWindowsExtra(info, 1, null),
|
||||
|
@ -2101,8 +2101,8 @@ pub fn UnlockFile(
|
||||
|
||||
/// This is a workaround for the C backend until zig has the ability to put
|
||||
/// C code in inline assembly.
|
||||
extern fn zig_x86_windows_teb() callconv(.C) *anyopaque;
|
||||
extern fn zig_x86_64_windows_teb() callconv(.C) *anyopaque;
|
||||
extern fn zig_x86_windows_teb() callconv(.c) *anyopaque;
|
||||
extern fn zig_x86_64_windows_teb() callconv(.c) *anyopaque;
|
||||
|
||||
pub fn teb() *TEB {
|
||||
return switch (native_arch) {
|
||||
@ -2824,6 +2824,7 @@ pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1;
|
||||
/// The standard error device. Initially, this is the active console screen buffer, CONOUT$.
|
||||
pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1;
|
||||
|
||||
/// Deprecated; use `std.builtin.CallingConvention.winapi` instead.
|
||||
pub const WINAPI: std.builtin.CallingConvention = .winapi;
|
||||
|
||||
pub const BOOL = c_int;
|
||||
@ -3567,7 +3568,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2;
|
||||
pub const MEM_DECOMMIT = 0x4000;
|
||||
pub const MEM_RELEASE = 0x8000;
|
||||
|
||||
pub const PTHREAD_START_ROUTINE = *const fn (LPVOID) callconv(.C) DWORD;
|
||||
pub const PTHREAD_START_ROUTINE = *const fn (LPVOID) callconv(.winapi) DWORD;
|
||||
pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
|
||||
|
||||
pub const WIN32_FIND_DATAW = extern struct {
|
||||
@ -3745,7 +3746,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct {
|
||||
pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;
|
||||
pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;
|
||||
|
||||
pub const PIMAGE_TLS_CALLBACK = ?*const fn (PVOID, DWORD, PVOID) callconv(.C) void;
|
||||
pub const PIMAGE_TLS_CALLBACK = ?*const fn (PVOID, DWORD, PVOID) callconv(.winapi) void;
|
||||
|
||||
pub const PROV_RSA_FULL = 1;
|
||||
|
||||
@ -3843,7 +3844,7 @@ pub const RTL_QUERY_REGISTRY_ROUTINE = ?*const fn (
|
||||
ULONG,
|
||||
?*anyopaque,
|
||||
?*anyopaque,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
/// Path is a full path
|
||||
pub const RTL_REGISTRY_ABSOLUTE = 0;
|
||||
@ -3940,7 +3941,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;
|
||||
pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
|
||||
pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;
|
||||
|
||||
pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?*const fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void;
|
||||
pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?*const fn (DWORD, DWORD, *OVERLAPPED) callconv(.winapi) void;
|
||||
|
||||
pub const FileNotifyChangeFilter = packed struct(DWORD) {
|
||||
file_name: bool = false,
|
||||
@ -4003,7 +4004,7 @@ pub const RTL_CRITICAL_SECTION = extern struct {
|
||||
pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
|
||||
pub const INIT_ONCE = RTL_RUN_ONCE;
|
||||
pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
|
||||
pub const INIT_ONCE_FN = *const fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL;
|
||||
pub const INIT_ONCE_FN = *const fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.winapi) BOOL;
|
||||
|
||||
pub const RTL_RUN_ONCE = extern struct {
|
||||
Ptr: ?*anyopaque,
|
||||
@ -4467,7 +4468,7 @@ pub const EXCEPTION_POINTERS = extern struct {
|
||||
ContextRecord: *CONTEXT,
|
||||
};
|
||||
|
||||
pub const VECTORED_EXCEPTION_HANDLER = *const fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long;
|
||||
pub const VECTORED_EXCEPTION_HANDLER = *const fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(.winapi) c_long;
|
||||
|
||||
pub const EXCEPTION_DISPOSITION = i32;
|
||||
pub const EXCEPTION_ROUTINE = *const fn (
|
||||
@ -4475,7 +4476,7 @@ pub const EXCEPTION_ROUTINE = *const fn (
|
||||
EstablisherFrame: PVOID,
|
||||
ContextRecord: *(Self.CONTEXT),
|
||||
DispatcherContext: PVOID,
|
||||
) callconv(WINAPI) EXCEPTION_DISPOSITION;
|
||||
) callconv(.winapi) EXCEPTION_DISPOSITION;
|
||||
|
||||
pub const UNWIND_HISTORY_TABLE_SIZE = 12;
|
||||
pub const UNWIND_HISTORY_TABLE_ENTRY = extern struct {
|
||||
@ -4851,7 +4852,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct {
|
||||
DosPath: UNICODE_STRING,
|
||||
};
|
||||
|
||||
pub const PPS_POST_PROCESS_INIT_ROUTINE = ?*const fn () callconv(.C) void;
|
||||
pub const PPS_POST_PROCESS_INIT_ROUTINE = ?*const fn () callconv(.winapi) void;
|
||||
|
||||
pub const FILE_DIRECTORY_INFORMATION = extern struct {
|
||||
NextEntryOffset: ULONG,
|
||||
@ -4905,7 +4906,7 @@ pub fn FileInformationIterator(comptime FileInformationType: type) type {
|
||||
};
|
||||
}
|
||||
|
||||
pub const IO_APC_ROUTINE = *const fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void;
|
||||
pub const IO_APC_ROUTINE = *const fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.winapi) void;
|
||||
|
||||
pub const CURDIR = extern struct {
|
||||
DosPath: UNICODE_STRING,
|
||||
@ -5009,8 +5010,8 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct {
|
||||
PeakUsage: SIZE_T,
|
||||
};
|
||||
|
||||
pub const PENUM_PAGE_FILE_CALLBACKW = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL;
|
||||
pub const PENUM_PAGE_FILE_CALLBACKA = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL;
|
||||
pub const PENUM_PAGE_FILE_CALLBACKW = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.winapi) BOOL;
|
||||
pub const PENUM_PAGE_FILE_CALLBACKA = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.winapi) BOOL;
|
||||
|
||||
pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct {
|
||||
BasicInfo: PSAPI_WS_WATCH_INFORMATION,
|
||||
@ -5122,7 +5123,7 @@ pub const CTRL_CLOSE_EVENT: DWORD = 2;
|
||||
pub const CTRL_LOGOFF_EVENT: DWORD = 5;
|
||||
pub const CTRL_SHUTDOWN_EVENT: DWORD = 6;
|
||||
|
||||
pub const HANDLER_ROUTINE = *const fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL;
|
||||
pub const HANDLER_ROUTINE = *const fn (dwCtrlType: DWORD) callconv(.winapi) BOOL;
|
||||
|
||||
/// Processor feature enumeration.
|
||||
pub const PF = enum(DWORD) {
|
||||
|
@ -8,7 +8,6 @@ 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,
|
||||
@ -16,7 +15,7 @@ pub extern "advapi32" fn RegOpenKeyExW(
|
||||
ulOptions: DWORD,
|
||||
samDesired: REGSAM,
|
||||
phkResult: *HKEY,
|
||||
) callconv(WINAPI) LSTATUS;
|
||||
) callconv(.winapi) LSTATUS;
|
||||
|
||||
pub extern "advapi32" fn RegQueryValueExW(
|
||||
hKey: HKEY,
|
||||
@ -25,13 +24,13 @@ pub extern "advapi32" fn RegQueryValueExW(
|
||||
lpType: ?*DWORD,
|
||||
lpData: ?*BYTE,
|
||||
lpcbData: ?*DWORD,
|
||||
) callconv(WINAPI) LSTATUS;
|
||||
) callconv(.winapi) LSTATUS;
|
||||
|
||||
pub extern "advapi32" fn RegCloseKey(hKey: HKEY) callconv(WINAPI) LSTATUS;
|
||||
pub extern "advapi32" fn RegCloseKey(hKey: HKEY) callconv(.winapi) LSTATUS;
|
||||
|
||||
// RtlGenRandom is known as SystemFunction036 under advapi32
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx */
|
||||
pub extern "advapi32" fn SystemFunction036(output: [*]u8, length: ULONG) callconv(WINAPI) BOOL;
|
||||
pub extern "advapi32" fn SystemFunction036(output: [*]u8, length: ULONG) callconv(.winapi) BOOL;
|
||||
pub const RtlGenRandom = SystemFunction036;
|
||||
|
||||
pub const RRF = struct {
|
||||
@ -62,7 +61,7 @@ pub extern "advapi32" fn RegGetValueW(
|
||||
pdwType: ?*DWORD,
|
||||
pvData: ?*anyopaque,
|
||||
pcbData: ?*DWORD,
|
||||
) callconv(WINAPI) LSTATUS;
|
||||
) callconv(.winapi) LSTATUS;
|
||||
|
||||
pub extern "advapi32" fn RegLoadAppKeyW(
|
||||
lpFile: LPCWSTR,
|
||||
@ -70,4 +69,4 @@ pub extern "advapi32" fn RegLoadAppKeyW(
|
||||
samDesired: REGSAM,
|
||||
dwOptions: DWORD,
|
||||
reserved: DWORD,
|
||||
) callconv(WINAPI) LSTATUS;
|
||||
) callconv(.winapi) LSTATUS;
|
||||
|
@ -4,7 +4,6 @@ const BOOL = windows.BOOL;
|
||||
const DWORD = windows.DWORD;
|
||||
const BYTE = windows.BYTE;
|
||||
const LPCWSTR = windows.LPCWSTR;
|
||||
const WINAPI = windows.WINAPI;
|
||||
|
||||
pub const CERT_INFO = *opaque {};
|
||||
pub const HCERTSTORE = *opaque {};
|
||||
@ -19,14 +18,14 @@ pub const CERT_CONTEXT = extern struct {
|
||||
pub extern "crypt32" fn CertOpenSystemStoreW(
|
||||
_: ?*const anyopaque,
|
||||
szSubsystemProtocol: LPCWSTR,
|
||||
) callconv(WINAPI) ?HCERTSTORE;
|
||||
) callconv(.winapi) ?HCERTSTORE;
|
||||
|
||||
pub extern "crypt32" fn CertCloseStore(
|
||||
hCertStore: HCERTSTORE,
|
||||
dwFlags: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "crypt32" fn CertEnumCertificatesInStore(
|
||||
hCertStore: HCERTSTORE,
|
||||
pPrevCertContext: ?*CERT_CONTEXT,
|
||||
) callconv(WINAPI) ?*CERT_CONTEXT;
|
||||
) callconv(.winapi) ?*CERT_CONTEXT;
|
||||
|
@ -41,7 +41,6 @@ const VECTORED_EXCEPTION_HANDLER = windows.VECTORED_EXCEPTION_HANDLER;
|
||||
const WCHAR = windows.WCHAR;
|
||||
const WIN32_FIND_DATAW = windows.WIN32_FIND_DATAW;
|
||||
const Win32Error = windows.Win32Error;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const WORD = windows.WORD;
|
||||
|
||||
// I/O - Filesystem
|
||||
@ -55,18 +54,18 @@ pub extern "kernel32" fn ReadDirectoryChangesW(
|
||||
lpBytesReturned: ?*windows.DWORD,
|
||||
lpOverlapped: ?*windows.OVERLAPPED,
|
||||
lpCompletionRoutine: windows.LPOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(windows.WINAPI) windows.BOOL;
|
||||
) callconv(.winapi) windows.BOOL;
|
||||
|
||||
// TODO: Wrapper around NtCancelIoFile.
|
||||
pub extern "kernel32" fn CancelIo(
|
||||
hFile: HANDLE,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtCancelIoFileEx.
|
||||
pub extern "kernel32" fn CancelIoEx(
|
||||
hFile: HANDLE,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn CreateFileW(
|
||||
lpFileName: LPCWSTR,
|
||||
@ -76,7 +75,7 @@ pub extern "kernel32" fn CreateFileW(
|
||||
dwCreationDisposition: DWORD,
|
||||
dwFlagsAndAttributes: DWORD,
|
||||
hTemplateFile: ?HANDLE,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
// TODO A bunch of logic around NtCreateNamedPipe
|
||||
pub extern "kernel32" fn CreateNamedPipeW(
|
||||
@ -88,16 +87,16 @@ pub extern "kernel32" fn CreateNamedPipeW(
|
||||
nInBufferSize: DWORD,
|
||||
nDefaultTimeOut: DWORD,
|
||||
lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "kernel32" fn FindFirstFileW(
|
||||
lpFileName: LPCWSTR,
|
||||
lpFindFileData: *WIN32_FIND_DATAW,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "kernel32" fn FindClose(
|
||||
hFindFile: HANDLE,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around RtlGetFullPathName_UEx
|
||||
pub extern "kernel32" fn GetFullPathNameW(
|
||||
@ -105,18 +104,18 @@ pub extern "kernel32" fn GetFullPathNameW(
|
||||
nBufferLength: DWORD,
|
||||
lpBuffer: LPWSTR,
|
||||
lpFilePart: ?*?LPWSTR,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: Matches `STD_*_HANDLE` to peb().ProcessParameters.Standard*
|
||||
pub extern "kernel32" fn GetStdHandle(
|
||||
nStdHandle: DWORD,
|
||||
) callconv(WINAPI) ?HANDLE;
|
||||
) callconv(.winapi) ?HANDLE;
|
||||
|
||||
pub extern "kernel32" fn MoveFileExW(
|
||||
lpExistingFileName: LPCWSTR,
|
||||
lpNewFileName: LPCWSTR,
|
||||
dwFlags: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtSetInformationFile + `FILE_POSITION_INFORMATION`.
|
||||
// `FILE_STANDARD_INFORMATION` is also used if dwMoveMethod is `FILE_END`
|
||||
@ -125,7 +124,7 @@ pub extern "kernel32" fn SetFilePointerEx(
|
||||
liDistanceToMove: LARGE_INTEGER,
|
||||
lpNewFilePointer: ?*LARGE_INTEGER,
|
||||
dwMoveMethod: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtSetInformationFile + `FILE_BASIC_INFORMATION`
|
||||
pub extern "kernel32" fn SetFileTime(
|
||||
@ -133,7 +132,7 @@ pub extern "kernel32" fn SetFileTime(
|
||||
lpCreationTime: ?*const FILETIME,
|
||||
lpLastAccessTime: ?*const FILETIME,
|
||||
lpLastWriteTime: ?*const FILETIME,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn WriteFile(
|
||||
in_hFile: HANDLE,
|
||||
@ -141,35 +140,35 @@ pub extern "kernel32" fn WriteFile(
|
||||
in_nNumberOfBytesToWrite: DWORD,
|
||||
out_lpNumberOfBytesWritten: ?*DWORD,
|
||||
in_out_lpOverlapped: ?*OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: wrapper for NtQueryInformationFile + `FILE_STANDARD_INFORMATION`
|
||||
pub extern "kernel32" fn GetFileSizeEx(
|
||||
hFile: HANDLE,
|
||||
lpFileSize: *LARGE_INTEGER,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around GetStdHandle + NtFlushBuffersFile.
|
||||
pub extern "kernel32" fn FlushFileBuffers(
|
||||
hFile: HANDLE,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtSetInformationFile + `FILE_IO_COMPLETION_NOTIFICATION_INFORMATION`.
|
||||
pub extern "kernel32" fn SetFileCompletionNotificationModes(
|
||||
FileHandle: HANDLE,
|
||||
Flags: UCHAR,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: `RtlGetCurrentDirectory_U(nBufferLength * 2, lpBuffer)`
|
||||
pub extern "kernel32" fn GetCurrentDirectoryW(
|
||||
nBufferLength: DWORD,
|
||||
lpBuffer: ?[*]WCHAR,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: RtlDosPathNameToNtPathNameU_WithStatus + NtQueryAttributesFile.
|
||||
pub extern "kernel32" fn GetFileAttributesW(
|
||||
lpFileName: LPCWSTR,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
pub extern "kernel32" fn ReadFile(
|
||||
hFile: HANDLE,
|
||||
@ -177,12 +176,12 @@ pub extern "kernel32" fn ReadFile(
|
||||
nNumberOfBytesToRead: DWORD,
|
||||
lpNumberOfBytesRead: ?*DWORD,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn GetSystemDirectoryW(
|
||||
lpBuffer: LPWSTR,
|
||||
uSize: UINT,
|
||||
) callconv(WINAPI) UINT;
|
||||
) callconv(.winapi) UINT;
|
||||
|
||||
// I/O - Kernel Objects
|
||||
|
||||
@ -192,7 +191,7 @@ pub extern "kernel32" fn CreateEventExW(
|
||||
lpName: ?LPCWSTR,
|
||||
dwFlags: DWORD,
|
||||
dwDesiredAccess: DWORD,
|
||||
) callconv(WINAPI) ?HANDLE;
|
||||
) callconv(.winapi) ?HANDLE;
|
||||
|
||||
// TODO: Wrapper around GetStdHandle + NtDuplicateObject.
|
||||
pub extern "kernel32" fn DuplicateHandle(
|
||||
@ -203,14 +202,14 @@ pub extern "kernel32" fn DuplicateHandle(
|
||||
dwDesiredAccess: DWORD,
|
||||
bInheritHandle: BOOL,
|
||||
dwOptions: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around GetStdHandle + NtQueryObject + NtSetInformationObject with .ObjectHandleFlagInformation.
|
||||
pub extern "kernel32" fn SetHandleInformation(
|
||||
hObject: HANDLE,
|
||||
dwMask: DWORD,
|
||||
dwFlags: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtRemoveIoCompletion.
|
||||
pub extern "kernel32" fn GetQueuedCompletionStatus(
|
||||
@ -219,7 +218,7 @@ pub extern "kernel32" fn GetQueuedCompletionStatus(
|
||||
lpCompletionKey: *ULONG_PTR,
|
||||
lpOverlapped: *?*OVERLAPPED,
|
||||
dwMilliseconds: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtRemoveIoCompletionEx.
|
||||
pub extern "kernel32" fn GetQueuedCompletionStatusEx(
|
||||
@ -229,7 +228,7 @@ pub extern "kernel32" fn GetQueuedCompletionStatusEx(
|
||||
ulNumEntriesRemoved: *ULONG,
|
||||
dwMilliseconds: DWORD,
|
||||
fAlertable: BOOL,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtSetIoCompletion with `IoStatus = .SUCCESS`.
|
||||
pub extern "kernel32" fn PostQueuedCompletionStatus(
|
||||
@ -237,7 +236,7 @@ pub extern "kernel32" fn PostQueuedCompletionStatus(
|
||||
dwNumberOfBytesTransferred: DWORD,
|
||||
dwCompletionKey: ULONG_PTR,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO:
|
||||
// GetOverlappedResultEx with bAlertable=false, which calls: GetStdHandle + WaitForSingleObjectEx.
|
||||
@ -247,7 +246,7 @@ pub extern "kernel32" fn GetOverlappedResult(
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
lpNumberOfBytesTransferred: *DWORD,
|
||||
bWait: BOOL,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtCreateIoCompletion + NtSetInformationFile with FILE_COMPLETION_INFORMATION.
|
||||
// This would be better splitting into two functions.
|
||||
@ -256,30 +255,30 @@ pub extern "kernel32" fn CreateIoCompletionPort(
|
||||
ExistingCompletionPort: ?HANDLE,
|
||||
CompletionKey: ULONG_PTR,
|
||||
NumberOfConcurrentThreads: DWORD,
|
||||
) callconv(WINAPI) ?HANDLE;
|
||||
) callconv(.winapi) ?HANDLE;
|
||||
|
||||
// TODO: Forwarder to NtAddVectoredExceptionHandler.
|
||||
pub extern "kernel32" fn AddVectoredExceptionHandler(
|
||||
First: ULONG,
|
||||
Handler: ?VECTORED_EXCEPTION_HANDLER,
|
||||
) callconv(WINAPI) ?LPVOID;
|
||||
) callconv(.winapi) ?LPVOID;
|
||||
|
||||
// TODO: Forwarder to NtRemoveVectoredExceptionHandler.
|
||||
pub extern "kernel32" fn RemoveVectoredExceptionHandler(
|
||||
Handle: HANDLE,
|
||||
) callconv(WINAPI) ULONG;
|
||||
) callconv(.winapi) ULONG;
|
||||
|
||||
// TODO: Wrapper around RtlReportSilentProcessExit + NtTerminateProcess.
|
||||
pub extern "kernel32" fn TerminateProcess(
|
||||
hProcess: HANDLE,
|
||||
uExitCode: UINT,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: WaitForSingleObjectEx with bAlertable=false.
|
||||
pub extern "kernel32" fn WaitForSingleObject(
|
||||
hHandle: HANDLE,
|
||||
dwMilliseconds: DWORD,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: Wrapper for GetStdHandle + NtWaitForSingleObject.
|
||||
// Sets up an activation context before calling NtWaitForSingleObject.
|
||||
@ -287,7 +286,7 @@ pub extern "kernel32" fn WaitForSingleObjectEx(
|
||||
hHandle: HANDLE,
|
||||
dwMilliseconds: DWORD,
|
||||
bAlertable: BOOL,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: WaitForMultipleObjectsEx with alertable=false
|
||||
pub extern "kernel32" fn WaitForMultipleObjects(
|
||||
@ -295,7 +294,7 @@ pub extern "kernel32" fn WaitForMultipleObjects(
|
||||
lpHandle: [*]const HANDLE,
|
||||
bWaitAll: BOOL,
|
||||
dwMilliseconds: DWORD,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: Wrapper around NtWaitForMultipleObjects.
|
||||
pub extern "kernel32" fn WaitForMultipleObjectsEx(
|
||||
@ -304,7 +303,7 @@ pub extern "kernel32" fn WaitForMultipleObjectsEx(
|
||||
bWaitAll: BOOL,
|
||||
dwMilliseconds: DWORD,
|
||||
bAlertable: BOOL,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// Process Management
|
||||
|
||||
@ -319,57 +318,57 @@ pub extern "kernel32" fn CreateProcessW(
|
||||
lpCurrentDirectory: ?LPCWSTR,
|
||||
lpStartupInfo: *STARTUPINFOW,
|
||||
lpProcessInformation: *PROCESS_INFORMATION,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Fowarder to RtlExitUserProcess.
|
||||
pub extern "kernel32" fn ExitProcess(
|
||||
exit_code: UINT,
|
||||
) callconv(WINAPI) noreturn;
|
||||
) callconv(.winapi) noreturn;
|
||||
|
||||
// TODO: SleepEx with bAlertable=false.
|
||||
pub extern "kernel32" fn Sleep(
|
||||
dwMilliseconds: DWORD,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Wrapper around NtQueryInformationProcess with `PROCESS_BASIC_INFORMATION`.
|
||||
pub extern "kernel32" fn GetExitCodeProcess(
|
||||
hProcess: HANDLE,
|
||||
lpExitCode: *DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Already a wrapper for this, see `windows.GetCurrentProcess`.
|
||||
pub extern "kernel32" fn GetCurrentProcess() callconv(WINAPI) HANDLE;
|
||||
pub extern "kernel32" fn GetCurrentProcess() callconv(.winapi) HANDLE;
|
||||
|
||||
// TODO: memcpy peb().ProcessParameters.Environment, mem.span(0). Requires locking the PEB.
|
||||
pub extern "kernel32" fn GetEnvironmentStringsW() callconv(WINAPI) ?LPWSTR;
|
||||
pub extern "kernel32" fn GetEnvironmentStringsW() callconv(.winapi) ?LPWSTR;
|
||||
|
||||
// TODO: RtlFreeHeap on the output of GetEnvironmentStringsW.
|
||||
pub extern "kernel32" fn FreeEnvironmentStringsW(
|
||||
penv: LPWSTR,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around RtlQueryEnvironmentVariable.
|
||||
pub extern "kernel32" fn GetEnvironmentVariableW(
|
||||
lpName: ?LPCWSTR,
|
||||
lpBuffer: ?[*]WCHAR,
|
||||
nSize: DWORD,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: Wrapper around RtlSetEnvironmentVar.
|
||||
pub extern "kernel32" fn SetEnvironmentVariableW(
|
||||
lpName: LPCWSTR,
|
||||
lpValue: ?LPCWSTR,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn CreateToolhelp32Snapshot(
|
||||
dwFlags: DWORD,
|
||||
th32ProcessID: DWORD,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
// Threading
|
||||
|
||||
// TODO: Already a wrapper for this, see `windows.GetCurrentThreadId`.
|
||||
pub extern "kernel32" fn GetCurrentThreadId() callconv(WINAPI) DWORD;
|
||||
pub extern "kernel32" fn GetCurrentThreadId() callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: CreateRemoteThread with hProcess=NtCurrentProcess().
|
||||
pub extern "kernel32" fn CreateThread(
|
||||
@ -379,64 +378,64 @@ pub extern "kernel32" fn CreateThread(
|
||||
lpParameter: ?LPVOID,
|
||||
dwCreationFlags: DWORD,
|
||||
lpThreadId: ?*DWORD,
|
||||
) callconv(WINAPI) ?HANDLE;
|
||||
) callconv(.winapi) ?HANDLE;
|
||||
|
||||
// TODO: Wrapper around RtlDelayExecution.
|
||||
pub extern "kernel32" fn SwitchToThread() callconv(WINAPI) BOOL;
|
||||
pub extern "kernel32" fn SwitchToThread() callconv(.winapi) BOOL;
|
||||
|
||||
// Locks, critical sections, initializers
|
||||
|
||||
// TODO: Forwarder to RtlInitializeCriticalSection
|
||||
pub extern "kernel32" fn InitializeCriticalSection(
|
||||
lpCriticalSection: *CRITICAL_SECTION,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Forwarder to RtlEnterCriticalSection
|
||||
pub extern "kernel32" fn EnterCriticalSection(
|
||||
lpCriticalSection: *CRITICAL_SECTION,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Forwarder to RtlLeaveCriticalSection
|
||||
pub extern "kernel32" fn LeaveCriticalSection(
|
||||
lpCriticalSection: *CRITICAL_SECTION,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Forwarder to RtlDeleteCriticalSection
|
||||
pub extern "kernel32" fn DeleteCriticalSection(
|
||||
lpCriticalSection: *CRITICAL_SECTION,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Forwarder to RtlTryAcquireSRWLockExclusive
|
||||
pub extern "kernel32" fn TryAcquireSRWLockExclusive(
|
||||
SRWLock: *SRWLOCK,
|
||||
) callconv(WINAPI) BOOLEAN;
|
||||
) callconv(.winapi) BOOLEAN;
|
||||
|
||||
// TODO: Forwarder to RtlAcquireSRWLockExclusive
|
||||
pub extern "kernel32" fn AcquireSRWLockExclusive(
|
||||
SRWLock: *SRWLOCK,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Forwarder to RtlReleaseSRWLockExclusive
|
||||
pub extern "kernel32" fn ReleaseSRWLockExclusive(
|
||||
SRWLock: *SRWLOCK,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub extern "kernel32" fn InitOnceExecuteOnce(
|
||||
InitOnce: *INIT_ONCE,
|
||||
InitFn: INIT_ONCE_FN,
|
||||
Parameter: ?*anyopaque,
|
||||
Context: ?*anyopaque,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Forwarder to RtlWakeConditionVariable
|
||||
pub extern "kernel32" fn WakeConditionVariable(
|
||||
ConditionVariable: *CONDITION_VARIABLE,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO: Forwarder to RtlWakeAllConditionVariable
|
||||
pub extern "kernel32" fn WakeAllConditionVariable(
|
||||
ConditionVariable: *CONDITION_VARIABLE,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// TODO:
|
||||
// - dwMilliseconds -> LARGE_INTEGER.
|
||||
@ -447,40 +446,40 @@ pub extern "kernel32" fn SleepConditionVariableSRW(
|
||||
SRWLock: *SRWLOCK,
|
||||
dwMilliseconds: DWORD,
|
||||
Flags: ULONG,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// Console management
|
||||
|
||||
pub extern "kernel32" fn GetConsoleMode(
|
||||
hConsoleHandle: HANDLE,
|
||||
lpMode: *DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn SetConsoleMode(
|
||||
hConsoleHandle: HANDLE,
|
||||
dwMode: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn GetConsoleScreenBufferInfo(
|
||||
hConsoleOutput: HANDLE,
|
||||
lpConsoleScreenBufferInfo: *CONSOLE_SCREEN_BUFFER_INFO,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn SetConsoleTextAttribute(
|
||||
hConsoleOutput: HANDLE,
|
||||
wAttributes: WORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn SetConsoleCtrlHandler(
|
||||
HandlerRoutine: ?HANDLER_ROUTINE,
|
||||
Add: BOOL,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn SetConsoleOutputCP(
|
||||
wCodePageID: UINT,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn GetConsoleOutputCP() callconv(WINAPI) UINT;
|
||||
pub extern "kernel32" fn GetConsoleOutputCP() callconv(.winapi) UINT;
|
||||
|
||||
pub extern "kernel32" fn FillConsoleOutputAttribute(
|
||||
hConsoleOutput: HANDLE,
|
||||
@ -488,7 +487,7 @@ pub extern "kernel32" fn FillConsoleOutputAttribute(
|
||||
nLength: DWORD,
|
||||
dwWriteCoord: COORD,
|
||||
lpNumberOfAttrsWritten: *DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn FillConsoleOutputCharacterW(
|
||||
hConsoleOutput: HANDLE,
|
||||
@ -496,12 +495,12 @@ pub extern "kernel32" fn FillConsoleOutputCharacterW(
|
||||
nLength: DWORD,
|
||||
dwWriteCoord: COORD,
|
||||
lpNumberOfCharsWritten: *DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn SetConsoleCursorPosition(
|
||||
hConsoleOutput: HANDLE,
|
||||
dwCursorPosition: COORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn WriteConsoleW(
|
||||
hConsoleOutput: HANDLE,
|
||||
@ -509,7 +508,7 @@ pub extern "kernel32" fn WriteConsoleW(
|
||||
nNumberOfCharsToWrite: DWORD,
|
||||
lpNumberOfCharsWritten: ?*DWORD,
|
||||
lpReserved: ?LPVOID,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn ReadConsoleOutputCharacterW(
|
||||
hConsoleOutput: HANDLE,
|
||||
@ -517,7 +516,7 @@ pub extern "kernel32" fn ReadConsoleOutputCharacterW(
|
||||
nLength: DWORD,
|
||||
dwReadCoord: COORD,
|
||||
lpNumberOfCharsRead: *DWORD,
|
||||
) callconv(windows.WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// Memory Mapping/Allocation
|
||||
|
||||
@ -526,12 +525,12 @@ pub extern "kernel32" fn HeapCreate(
|
||||
flOptions: DWORD,
|
||||
dwInitialSize: SIZE_T,
|
||||
dwMaximumSize: SIZE_T,
|
||||
) callconv(WINAPI) ?HANDLE;
|
||||
) callconv(.winapi) ?HANDLE;
|
||||
|
||||
// TODO: Wrapper around RtlDestroyHeap (BOOLEAN -> BOOL).
|
||||
pub extern "kernel32" fn HeapDestroy(
|
||||
hHeap: HANDLE,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Forwarder to RtlReAllocateHeap.
|
||||
pub extern "kernel32" fn HeapReAlloc(
|
||||
@ -539,28 +538,28 @@ pub extern "kernel32" fn HeapReAlloc(
|
||||
dwFlags: DWORD,
|
||||
lpMem: *anyopaque,
|
||||
dwBytes: SIZE_T,
|
||||
) callconv(WINAPI) ?*anyopaque;
|
||||
) callconv(.winapi) ?*anyopaque;
|
||||
|
||||
// TODO: Fowrarder to RtlAllocateHeap.
|
||||
pub extern "kernel32" fn HeapAlloc(
|
||||
hHeap: HANDLE,
|
||||
dwFlags: DWORD,
|
||||
dwBytes: SIZE_T,
|
||||
) callconv(WINAPI) ?*anyopaque;
|
||||
) callconv(.winapi) ?*anyopaque;
|
||||
|
||||
// TODO: Fowrarder to RtlFreeHeap.
|
||||
pub extern "kernel32" fn HeapFree(
|
||||
hHeap: HANDLE,
|
||||
dwFlags: DWORD,
|
||||
lpMem: LPVOID,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around RtlValidateHeap (BOOLEAN -> BOOL)
|
||||
pub extern "kernel32" fn HeapValidate(
|
||||
hHeap: HANDLE,
|
||||
dwFlags: DWORD,
|
||||
lpMem: ?*const anyopaque,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtAllocateVirtualMemory.
|
||||
pub extern "kernel32" fn VirtualAlloc(
|
||||
@ -568,7 +567,7 @@ pub extern "kernel32" fn VirtualAlloc(
|
||||
dwSize: SIZE_T,
|
||||
flAllocationType: DWORD,
|
||||
flProtect: DWORD,
|
||||
) callconv(WINAPI) ?LPVOID;
|
||||
) callconv(.winapi) ?LPVOID;
|
||||
|
||||
// TODO: Wrapper around NtFreeVirtualMemory.
|
||||
// If the return value is .INVALID_PAGE_PROTECTION, calls RtlFlushSecureMemoryCache and try again.
|
||||
@ -576,21 +575,21 @@ pub extern "kernel32" fn VirtualFree(
|
||||
lpAddress: ?LPVOID,
|
||||
dwSize: SIZE_T,
|
||||
dwFreeType: DWORD,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// TODO: Wrapper around NtQueryVirtualMemory.
|
||||
pub extern "kernel32" fn VirtualQuery(
|
||||
lpAddress: ?LPVOID,
|
||||
lpBuffer: PMEMORY_BASIC_INFORMATION,
|
||||
dwLength: SIZE_T,
|
||||
) callconv(WINAPI) SIZE_T;
|
||||
) callconv(.winapi) SIZE_T;
|
||||
|
||||
pub extern "kernel32" fn LocalFree(
|
||||
hMem: HLOCAL,
|
||||
) callconv(WINAPI) ?HLOCAL;
|
||||
) callconv(.winapi) ?HLOCAL;
|
||||
|
||||
// TODO: Getter for peb.ProcessHeap
|
||||
pub extern "kernel32" fn GetProcessHeap() callconv(WINAPI) ?HANDLE;
|
||||
pub extern "kernel32" fn GetProcessHeap() callconv(.winapi) ?HANDLE;
|
||||
|
||||
// Code Libraries/Modules
|
||||
|
||||
@ -599,49 +598,49 @@ pub extern "kernel32" fn GetModuleFileNameW(
|
||||
hModule: ?HMODULE,
|
||||
lpFilename: [*]WCHAR,
|
||||
nSize: DWORD,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
extern "kernel32" fn K32GetModuleFileNameExW(
|
||||
hProcess: HANDLE,
|
||||
hModule: ?HMODULE,
|
||||
lpFilename: LPWSTR,
|
||||
nSize: DWORD,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
pub const GetModuleFileNameExW = K32GetModuleFileNameExW;
|
||||
|
||||
// TODO: Wrapper around ntdll.LdrGetDllHandle, which is a wrapper around LdrGetDllHandleEx
|
||||
pub extern "kernel32" fn GetModuleHandleW(
|
||||
lpModuleName: ?LPCWSTR,
|
||||
) callconv(WINAPI) ?HMODULE;
|
||||
) callconv(.winapi) ?HMODULE;
|
||||
|
||||
pub extern "kernel32" fn Module32First(
|
||||
hSnapshot: HANDLE,
|
||||
lpme: *MODULEENTRY32,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn Module32Next(
|
||||
hSnapshot: HANDLE,
|
||||
lpme: *MODULEENTRY32,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "kernel32" fn LoadLibraryW(
|
||||
lpLibFileName: LPCWSTR,
|
||||
) callconv(WINAPI) ?HMODULE;
|
||||
) callconv(.winapi) ?HMODULE;
|
||||
|
||||
pub extern "kernel32" fn LoadLibraryExW(
|
||||
lpLibFileName: LPCWSTR,
|
||||
hFile: ?HANDLE,
|
||||
dwFlags: DWORD,
|
||||
) callconv(WINAPI) ?HMODULE;
|
||||
) callconv(.winapi) ?HMODULE;
|
||||
|
||||
pub extern "kernel32" fn GetProcAddress(
|
||||
hModule: HMODULE,
|
||||
lpProcName: LPCSTR,
|
||||
) callconv(WINAPI) ?FARPROC;
|
||||
) callconv(.winapi) ?FARPROC;
|
||||
|
||||
pub extern "kernel32" fn FreeLibrary(
|
||||
hModule: HMODULE,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
// Error Management
|
||||
|
||||
@ -653,15 +652,15 @@ pub extern "kernel32" fn FormatMessageW(
|
||||
lpBuffer: LPWSTR,
|
||||
nSize: DWORD,
|
||||
Arguments: ?*va_list,
|
||||
) callconv(WINAPI) DWORD;
|
||||
) callconv(.winapi) DWORD;
|
||||
|
||||
// TODO: Getter for teb().LastErrorValue.
|
||||
pub extern "kernel32" fn GetLastError() callconv(WINAPI) Win32Error;
|
||||
pub extern "kernel32" fn GetLastError() callconv(.winapi) Win32Error;
|
||||
|
||||
// TODO: Wrapper around RtlSetLastWin32Error.
|
||||
pub extern "kernel32" fn SetLastError(
|
||||
dwErrCode: Win32Error,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
// Everything Else
|
||||
|
||||
@ -670,4 +669,4 @@ pub extern "kernel32" fn SetLastError(
|
||||
// Much better to use NtQuerySystemTime or NtQuerySystemTimePrecise for guaranteed 0.1ns precision.
|
||||
pub extern "kernel32" fn GetSystemTimeAsFileTime(
|
||||
lpSystemTimeAsFileTime: *FILETIME,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
@ -5,7 +5,6 @@ const BOOL = windows.BOOL;
|
||||
const DWORD = windows.DWORD;
|
||||
const DWORD64 = windows.DWORD64;
|
||||
const ULONG = windows.ULONG;
|
||||
const WINAPI = windows.WINAPI;
|
||||
const NTSTATUS = windows.NTSTATUS;
|
||||
const WORD = windows.WORD;
|
||||
const HANDLE = windows.HANDLE;
|
||||
@ -44,7 +43,7 @@ pub extern "ntdll" fn NtQueryInformationProcess(
|
||||
ProcessInformation: *anyopaque,
|
||||
ProcessInformationLength: ULONG,
|
||||
ReturnLength: ?*ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtQueryInformationThread(
|
||||
ThreadHandle: HANDLE,
|
||||
@ -52,37 +51,37 @@ pub extern "ntdll" fn NtQueryInformationThread(
|
||||
ThreadInformation: *anyopaque,
|
||||
ThreadInformationLength: ULONG,
|
||||
ReturnLength: ?*ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtQuerySystemInformation(
|
||||
SystemInformationClass: SYSTEM_INFORMATION_CLASS,
|
||||
SystemInformation: PVOID,
|
||||
SystemInformationLength: ULONG,
|
||||
ReturnLength: ?*ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtSetInformationThread(
|
||||
ThreadHandle: HANDLE,
|
||||
ThreadInformationClass: THREADINFOCLASS,
|
||||
ThreadInformation: *const anyopaque,
|
||||
ThreadInformationLength: ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlGetVersion(
|
||||
lpVersionInformation: *RTL_OSVERSIONINFOW,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn RtlCaptureStackBackTrace(
|
||||
FramesToSkip: DWORD,
|
||||
FramesToCapture: DWORD,
|
||||
BackTrace: **anyopaque,
|
||||
BackTraceHash: ?*DWORD,
|
||||
) callconv(WINAPI) WORD;
|
||||
pub extern "ntdll" fn RtlCaptureContext(ContextRecord: *CONTEXT) callconv(WINAPI) void;
|
||||
) callconv(.winapi) WORD;
|
||||
pub extern "ntdll" fn RtlCaptureContext(ContextRecord: *CONTEXT) callconv(.winapi) void;
|
||||
pub extern "ntdll" fn RtlLookupFunctionEntry(
|
||||
ControlPc: DWORD64,
|
||||
ImageBase: *DWORD64,
|
||||
HistoryTable: *UNWIND_HISTORY_TABLE,
|
||||
) callconv(WINAPI) ?*RUNTIME_FUNCTION;
|
||||
) callconv(.winapi) ?*RUNTIME_FUNCTION;
|
||||
pub extern "ntdll" fn RtlVirtualUnwind(
|
||||
HandlerType: DWORD,
|
||||
ImageBase: DWORD64,
|
||||
@ -92,33 +91,33 @@ pub extern "ntdll" fn RtlVirtualUnwind(
|
||||
HandlerData: *?PVOID,
|
||||
EstablisherFrame: *DWORD64,
|
||||
ContextPointers: ?*KNONVOLATILE_CONTEXT_POINTERS,
|
||||
) callconv(WINAPI) *EXCEPTION_ROUTINE;
|
||||
) callconv(.winapi) *EXCEPTION_ROUTINE;
|
||||
pub extern "ntdll" fn NtQueryInformationFile(
|
||||
FileHandle: HANDLE,
|
||||
IoStatusBlock: *IO_STATUS_BLOCK,
|
||||
FileInformation: *anyopaque,
|
||||
Length: ULONG,
|
||||
FileInformationClass: FILE_INFORMATION_CLASS,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtSetInformationFile(
|
||||
FileHandle: HANDLE,
|
||||
IoStatusBlock: *IO_STATUS_BLOCK,
|
||||
FileInformation: PVOID,
|
||||
Length: ULONG,
|
||||
FileInformationClass: FILE_INFORMATION_CLASS,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtQueryAttributesFile(
|
||||
ObjectAttributes: *OBJECT_ATTRIBUTES,
|
||||
FileAttributes: *FILE_BASIC_INFORMATION,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlQueryPerformanceCounter(PerformanceCounter: *LARGE_INTEGER) callconv(WINAPI) BOOL;
|
||||
pub extern "ntdll" fn RtlQueryPerformanceFrequency(PerformanceFrequency: *LARGE_INTEGER) callconv(WINAPI) BOOL;
|
||||
pub extern "ntdll" fn RtlQueryPerformanceCounter(PerformanceCounter: *LARGE_INTEGER) callconv(.winapi) BOOL;
|
||||
pub extern "ntdll" fn RtlQueryPerformanceFrequency(PerformanceFrequency: *LARGE_INTEGER) callconv(.winapi) BOOL;
|
||||
pub extern "ntdll" fn NtQueryPerformanceCounter(
|
||||
PerformanceCounter: *LARGE_INTEGER,
|
||||
PerformanceFrequency: ?*LARGE_INTEGER,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtCreateFile(
|
||||
FileHandle: *HANDLE,
|
||||
@ -132,7 +131,7 @@ pub extern "ntdll" fn NtCreateFile(
|
||||
CreateOptions: ULONG,
|
||||
EaBuffer: ?*anyopaque,
|
||||
EaLength: ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtCreateSection(
|
||||
SectionHandle: *HANDLE,
|
||||
DesiredAccess: ACCESS_MASK,
|
||||
@ -141,7 +140,7 @@ pub extern "ntdll" fn NtCreateSection(
|
||||
SectionPageProtection: ULONG,
|
||||
AllocationAttributes: ULONG,
|
||||
FileHandle: ?HANDLE,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtMapViewOfSection(
|
||||
SectionHandle: HANDLE,
|
||||
ProcessHandle: HANDLE,
|
||||
@ -153,11 +152,11 @@ pub extern "ntdll" fn NtMapViewOfSection(
|
||||
InheritDispostion: SECTION_INHERIT,
|
||||
AllocationType: ULONG,
|
||||
Win32Protect: ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtUnmapViewOfSection(
|
||||
ProcessHandle: HANDLE,
|
||||
BaseAddress: PVOID,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtDeviceIoControlFile(
|
||||
FileHandle: HANDLE,
|
||||
Event: ?HANDLE,
|
||||
@ -169,7 +168,7 @@ pub extern "ntdll" fn NtDeviceIoControlFile(
|
||||
InputBufferLength: ULONG,
|
||||
OutputBuffer: ?PVOID,
|
||||
OutputBufferLength: ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtFsControlFile(
|
||||
FileHandle: HANDLE,
|
||||
Event: ?HANDLE,
|
||||
@ -181,15 +180,15 @@ pub extern "ntdll" fn NtFsControlFile(
|
||||
InputBufferLength: ULONG,
|
||||
OutputBuffer: ?PVOID,
|
||||
OutputBufferLength: ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
pub extern "ntdll" fn NtClose(Handle: HANDLE) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn NtClose(Handle: HANDLE) callconv(.winapi) NTSTATUS;
|
||||
pub extern "ntdll" fn RtlDosPathNameToNtPathName_U(
|
||||
DosPathName: [*:0]const u16,
|
||||
NtPathName: *UNICODE_STRING,
|
||||
NtFileNamePart: ?*?[*:0]const u16,
|
||||
DirectoryInfo: ?*CURDIR,
|
||||
) callconv(WINAPI) BOOL;
|
||||
pub extern "ntdll" fn RtlFreeUnicodeString(UnicodeString: *UNICODE_STRING) callconv(WINAPI) void;
|
||||
) callconv(.winapi) BOOL;
|
||||
pub extern "ntdll" fn RtlFreeUnicodeString(UnicodeString: *UNICODE_STRING) callconv(.winapi) void;
|
||||
|
||||
/// Returns the number of bytes written to `Buffer`.
|
||||
/// If the returned count is larger than `BufferByteLength`, the buffer was too small.
|
||||
@ -199,7 +198,7 @@ pub extern "ntdll" fn RtlGetFullPathName_U(
|
||||
BufferByteLength: ULONG,
|
||||
Buffer: [*]u16,
|
||||
ShortName: ?*[*:0]const u16,
|
||||
) callconv(windows.WINAPI) windows.ULONG;
|
||||
) callconv(.winapi) windows.ULONG;
|
||||
|
||||
pub extern "ntdll" fn NtQueryDirectoryFile(
|
||||
FileHandle: HANDLE,
|
||||
@ -213,30 +212,30 @@ pub extern "ntdll" fn NtQueryDirectoryFile(
|
||||
ReturnSingleEntry: BOOLEAN,
|
||||
FileName: ?*UNICODE_STRING,
|
||||
RestartScan: BOOLEAN,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtCreateKeyedEvent(
|
||||
KeyedEventHandle: *HANDLE,
|
||||
DesiredAccess: ACCESS_MASK,
|
||||
ObjectAttributes: ?PVOID,
|
||||
Flags: ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtReleaseKeyedEvent(
|
||||
EventHandle: ?HANDLE,
|
||||
Key: ?*const anyopaque,
|
||||
Alertable: BOOLEAN,
|
||||
Timeout: ?*const LARGE_INTEGER,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtWaitForKeyedEvent(
|
||||
EventHandle: ?HANDLE,
|
||||
Key: ?*const anyopaque,
|
||||
Alertable: BOOLEAN,
|
||||
Timeout: ?*const LARGE_INTEGER,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlSetCurrentDirectory_U(PathName: *UNICODE_STRING) callconv(WINAPI) NTSTATUS;
|
||||
pub extern "ntdll" fn RtlSetCurrentDirectory_U(PathName: *UNICODE_STRING) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtQueryObject(
|
||||
Handle: HANDLE,
|
||||
@ -244,7 +243,7 @@ pub extern "ntdll" fn NtQueryObject(
|
||||
ObjectInformation: PVOID,
|
||||
ObjectInformationLength: ULONG,
|
||||
ReturnLength: ?*ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtQueryVolumeInformationFile(
|
||||
FileHandle: HANDLE,
|
||||
@ -252,32 +251,32 @@ pub extern "ntdll" fn NtQueryVolumeInformationFile(
|
||||
FsInformation: *anyopaque,
|
||||
Length: ULONG,
|
||||
FsInformationClass: FS_INFORMATION_CLASS,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlWakeAddressAll(
|
||||
Address: ?*const anyopaque,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub extern "ntdll" fn RtlWakeAddressSingle(
|
||||
Address: ?*const anyopaque,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub extern "ntdll" fn RtlWaitOnAddress(
|
||||
Address: ?*const anyopaque,
|
||||
CompareAddress: ?*const anyopaque,
|
||||
AddressSize: SIZE_T,
|
||||
Timeout: ?*const LARGE_INTEGER,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlEqualUnicodeString(
|
||||
String1: *const UNICODE_STRING,
|
||||
String2: *const UNICODE_STRING,
|
||||
CaseInSensitive: BOOLEAN,
|
||||
) callconv(WINAPI) BOOLEAN;
|
||||
) callconv(.winapi) BOOLEAN;
|
||||
|
||||
pub extern "ntdll" fn RtlUpcaseUnicodeChar(
|
||||
SourceCharacter: u16,
|
||||
) callconv(WINAPI) u16;
|
||||
) callconv(.winapi) u16;
|
||||
|
||||
pub extern "ntdll" fn NtLockFile(
|
||||
FileHandle: HANDLE,
|
||||
@ -290,7 +289,7 @@ pub extern "ntdll" fn NtLockFile(
|
||||
Key: ?*ULONG,
|
||||
FailImmediately: BOOLEAN,
|
||||
ExclusiveLock: BOOLEAN,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtUnlockFile(
|
||||
FileHandle: HANDLE,
|
||||
@ -298,13 +297,13 @@ pub extern "ntdll" fn NtUnlockFile(
|
||||
ByteOffset: *const LARGE_INTEGER,
|
||||
Length: *const LARGE_INTEGER,
|
||||
Key: ?*ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtOpenKey(
|
||||
KeyHandle: *HANDLE,
|
||||
DesiredAccess: ACCESS_MASK,
|
||||
ObjectAttributes: OBJECT_ATTRIBUTES,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlQueryRegistryValues(
|
||||
RelativeTo: ULONG,
|
||||
@ -312,7 +311,7 @@ pub extern "ntdll" fn RtlQueryRegistryValues(
|
||||
QueryTable: [*]RTL_QUERY_REGISTRY_TABLE,
|
||||
Context: ?*anyopaque,
|
||||
Environment: ?*anyopaque,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtReadVirtualMemory(
|
||||
ProcessHandle: HANDLE,
|
||||
@ -320,7 +319,7 @@ pub extern "ntdll" fn NtReadVirtualMemory(
|
||||
Buffer: LPVOID,
|
||||
NumberOfBytesToRead: SIZE_T,
|
||||
NumberOfBytesRead: ?*SIZE_T,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtWriteVirtualMemory(
|
||||
ProcessHandle: HANDLE,
|
||||
@ -328,7 +327,7 @@ pub extern "ntdll" fn NtWriteVirtualMemory(
|
||||
Buffer: LPCVOID,
|
||||
NumberOfBytesToWrite: SIZE_T,
|
||||
NumberOfBytesWritten: ?*SIZE_T,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn NtProtectVirtualMemory(
|
||||
ProcessHandle: HANDLE,
|
||||
@ -336,11 +335,11 @@ pub extern "ntdll" fn NtProtectVirtualMemory(
|
||||
NumberOfBytesToProtect: *SIZE_T,
|
||||
NewAccessProtection: ULONG,
|
||||
OldAccessProtection: *ULONG,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
||||
pub extern "ntdll" fn RtlExitUserProcess(
|
||||
ExitStatus: u32,
|
||||
) callconv(WINAPI) noreturn;
|
||||
) callconv(.winapi) noreturn;
|
||||
|
||||
pub extern "ntdll" fn NtCreateNamedPipeFile(
|
||||
FileHandle: *HANDLE,
|
||||
@ -357,4 +356,4 @@ pub extern "ntdll" fn NtCreateNamedPipeFile(
|
||||
InboundQuota: ULONG,
|
||||
OutboundQuota: ULONG,
|
||||
DefaultTimeout: *LARGE_INTEGER,
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
) callconv(.winapi) NTSTATUS;
|
||||
|
@ -250,7 +250,7 @@ test "loadWinsockExtensionFunction" {
|
||||
SendBufLen: windows.DWORD,
|
||||
BytesSent: *windows.DWORD,
|
||||
Overlapped: *windows.OVERLAPPED,
|
||||
) callconv(windows.WINAPI) windows.BOOL;
|
||||
) callconv(.winapi) windows.BOOL;
|
||||
|
||||
_ = windows.loadWinsockExtensionFunction(
|
||||
LPFN_CONNECTEX,
|
||||
|
@ -2,7 +2,6 @@ const std = @import("../../std.zig");
|
||||
const assert = std.debug.assert;
|
||||
const windows = std.os.windows;
|
||||
|
||||
const WINAPI = windows.WINAPI;
|
||||
const OVERLAPPED = windows.OVERLAPPED;
|
||||
const WORD = windows.WORD;
|
||||
const DWORD = windows.DWORD;
|
||||
@ -958,14 +957,14 @@ pub const LPCONDITIONPROC = *const fn (
|
||||
lpCalleeData: *WSABUF,
|
||||
g: *u32,
|
||||
dwCallbackData: usize,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = *const fn (
|
||||
dwError: u32,
|
||||
cbTransferred: u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
dwFlags: u32,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub const FLOWSPEC = extern struct {
|
||||
TokenRate: u32,
|
||||
@ -1196,7 +1195,7 @@ pub const LPFN_TRANSMITFILE = *const fn (
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
|
||||
dwReserved: u32,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub const LPFN_ACCEPTEX = *const fn (
|
||||
sListenSocket: SOCKET,
|
||||
@ -1207,7 +1206,7 @@ pub const LPFN_ACCEPTEX = *const fn (
|
||||
dwRemoteAddressLength: u32,
|
||||
lpdwBytesReceived: *u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub const LPFN_GETACCEPTEXSOCKADDRS = *const fn (
|
||||
lpOutputBuffer: *anyopaque,
|
||||
@ -1218,7 +1217,7 @@ pub const LPFN_GETACCEPTEXSOCKADDRS = *const fn (
|
||||
LocalSockaddrLength: *i32,
|
||||
RemoteSockaddr: **sockaddr,
|
||||
RemoteSockaddrLength: *i32,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub const LPFN_WSASENDMSG = *const fn (
|
||||
s: SOCKET,
|
||||
@ -1227,7 +1226,7 @@ pub const LPFN_WSASENDMSG = *const fn (
|
||||
lpNumberOfBytesSent: ?*u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub const LPFN_WSARECVMSG = *const fn (
|
||||
s: SOCKET,
|
||||
@ -1235,12 +1234,12 @@ pub const LPFN_WSARECVMSG = *const fn (
|
||||
lpdwNumberOfBytesRecv: ?*u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub const LPSERVICE_CALLBACK_PROC = *const fn (
|
||||
lParam: LPARAM,
|
||||
hAsyncTaskHandle: HANDLE,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub const SERVICE_ASYNC_INFO = extern struct {
|
||||
lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,
|
||||
@ -1252,7 +1251,7 @@ pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = *const fn (
|
||||
dwError: u32,
|
||||
dwBytes: u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub const fd_set = extern struct {
|
||||
fd_count: u32,
|
||||
@ -1725,41 +1724,41 @@ pub extern "ws2_32" fn accept(
|
||||
s: SOCKET,
|
||||
addr: ?*sockaddr,
|
||||
addrlen: ?*i32,
|
||||
) callconv(WINAPI) SOCKET;
|
||||
) callconv(.winapi) SOCKET;
|
||||
|
||||
pub extern "ws2_32" fn bind(
|
||||
s: SOCKET,
|
||||
name: *const sockaddr,
|
||||
namelen: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn closesocket(
|
||||
s: SOCKET,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn connect(
|
||||
s: SOCKET,
|
||||
name: *const sockaddr,
|
||||
namelen: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn ioctlsocket(
|
||||
s: SOCKET,
|
||||
cmd: i32,
|
||||
argp: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn getpeername(
|
||||
s: SOCKET,
|
||||
name: *sockaddr,
|
||||
namelen: *i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn getsockname(
|
||||
s: SOCKET,
|
||||
name: *sockaddr,
|
||||
namelen: *i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn getsockopt(
|
||||
s: SOCKET,
|
||||
@ -1767,39 +1766,39 @@ pub extern "ws2_32" fn getsockopt(
|
||||
optname: i32,
|
||||
optval: [*]u8,
|
||||
optlen: *i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn htonl(
|
||||
hostlong: u32,
|
||||
) callconv(WINAPI) u32;
|
||||
) callconv(.winapi) u32;
|
||||
|
||||
pub extern "ws2_32" fn htons(
|
||||
hostshort: u16,
|
||||
) callconv(WINAPI) u16;
|
||||
) callconv(.winapi) u16;
|
||||
|
||||
pub extern "ws2_32" fn inet_addr(
|
||||
cp: ?[*]const u8,
|
||||
) callconv(WINAPI) u32;
|
||||
) callconv(.winapi) u32;
|
||||
|
||||
pub extern "ws2_32" fn listen(
|
||||
s: SOCKET,
|
||||
backlog: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn ntohl(
|
||||
netlong: u32,
|
||||
) callconv(WINAPI) u32;
|
||||
) callconv(.winapi) u32;
|
||||
|
||||
pub extern "ws2_32" fn ntohs(
|
||||
netshort: u16,
|
||||
) callconv(WINAPI) u16;
|
||||
) callconv(.winapi) u16;
|
||||
|
||||
pub extern "ws2_32" fn recv(
|
||||
s: SOCKET,
|
||||
buf: [*]u8,
|
||||
len: i32,
|
||||
flags: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn recvfrom(
|
||||
s: SOCKET,
|
||||
@ -1808,7 +1807,7 @@ pub extern "ws2_32" fn recvfrom(
|
||||
flags: i32,
|
||||
from: ?*sockaddr,
|
||||
fromlen: ?*i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn select(
|
||||
nfds: i32,
|
||||
@ -1816,14 +1815,14 @@ pub extern "ws2_32" fn select(
|
||||
writefds: ?*fd_set,
|
||||
exceptfds: ?*fd_set,
|
||||
timeout: ?*const timeval,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn send(
|
||||
s: SOCKET,
|
||||
buf: [*]const u8,
|
||||
len: i32,
|
||||
flags: u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn sendto(
|
||||
s: SOCKET,
|
||||
@ -1832,7 +1831,7 @@ pub extern "ws2_32" fn sendto(
|
||||
flags: i32,
|
||||
to: *const sockaddr,
|
||||
tolen: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn setsockopt(
|
||||
s: SOCKET,
|
||||
@ -1840,37 +1839,37 @@ pub extern "ws2_32" fn setsockopt(
|
||||
optname: i32,
|
||||
optval: ?[*]const u8,
|
||||
optlen: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn shutdown(
|
||||
s: SOCKET,
|
||||
how: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn socket(
|
||||
af: i32,
|
||||
@"type": i32,
|
||||
protocol: i32,
|
||||
) callconv(WINAPI) SOCKET;
|
||||
) callconv(.winapi) SOCKET;
|
||||
|
||||
pub extern "ws2_32" fn WSAStartup(
|
||||
wVersionRequired: WORD,
|
||||
lpWSAData: *WSADATA,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSACleanup() callconv(WINAPI) i32;
|
||||
pub extern "ws2_32" fn WSACleanup() callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASetLastError(iError: i32) callconv(WINAPI) void;
|
||||
pub extern "ws2_32" fn WSASetLastError(iError: i32) callconv(.winapi) void;
|
||||
|
||||
pub extern "ws2_32" fn WSAGetLastError() callconv(WINAPI) WinsockError;
|
||||
pub extern "ws2_32" fn WSAGetLastError() callconv(.winapi) WinsockError;
|
||||
|
||||
pub extern "ws2_32" fn WSAIsBlocking() callconv(WINAPI) BOOL;
|
||||
pub extern "ws2_32" fn WSAIsBlocking() callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSAUnhookBlockingHook() callconv(WINAPI) i32;
|
||||
pub extern "ws2_32" fn WSAUnhookBlockingHook() callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASetBlockingHook(lpBlockFunc: FARPROC) callconv(WINAPI) FARPROC;
|
||||
pub extern "ws2_32" fn WSASetBlockingHook(lpBlockFunc: FARPROC) callconv(.winapi) FARPROC;
|
||||
|
||||
pub extern "ws2_32" fn WSACancelBlockingCall() callconv(WINAPI) i32;
|
||||
pub extern "ws2_32" fn WSACancelBlockingCall() callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAAsyncGetServByName(
|
||||
hWnd: HWND,
|
||||
@ -1879,7 +1878,7 @@ pub extern "ws2_32" fn WSAAsyncGetServByName(
|
||||
proto: ?[*:0]const u8,
|
||||
buf: [*]u8,
|
||||
buflen: i32,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "ws2_32" fn WSAAsyncGetServByPort(
|
||||
hWnd: HWND,
|
||||
@ -1888,7 +1887,7 @@ pub extern "ws2_32" fn WSAAsyncGetServByPort(
|
||||
proto: ?[*:0]const u8,
|
||||
buf: [*]u8,
|
||||
buflen: i32,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "ws2_32" fn WSAAsyncGetProtoByName(
|
||||
hWnd: HWND,
|
||||
@ -1896,7 +1895,7 @@ pub extern "ws2_32" fn WSAAsyncGetProtoByName(
|
||||
name: [*:0]const u8,
|
||||
buf: [*]u8,
|
||||
buflen: i32,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "ws2_32" fn WSAAsyncGetProtoByNumber(
|
||||
hWnd: HWND,
|
||||
@ -1904,16 +1903,16 @@ pub extern "ws2_32" fn WSAAsyncGetProtoByNumber(
|
||||
number: i32,
|
||||
buf: [*]u8,
|
||||
buflen: i32,
|
||||
) callconv(WINAPI) HANDLE;
|
||||
) callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "ws2_32" fn WSACancelAsyncRequest(hAsyncTaskHandle: HANDLE) callconv(WINAPI) i32;
|
||||
pub extern "ws2_32" fn WSACancelAsyncRequest(hAsyncTaskHandle: HANDLE) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAAsyncSelect(
|
||||
s: SOCKET,
|
||||
hWnd: HWND,
|
||||
wMsg: u32,
|
||||
lEvent: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAAccept(
|
||||
s: SOCKET,
|
||||
@ -1921,9 +1920,9 @@ pub extern "ws2_32" fn WSAAccept(
|
||||
addrlen: ?*i32,
|
||||
lpfnCondition: ?LPCONDITIONPROC,
|
||||
dwCallbackData: usize,
|
||||
) callconv(WINAPI) SOCKET;
|
||||
) callconv(.winapi) SOCKET;
|
||||
|
||||
pub extern "ws2_32" fn WSACloseEvent(hEvent: HANDLE) callconv(WINAPI) BOOL;
|
||||
pub extern "ws2_32" fn WSACloseEvent(hEvent: HANDLE) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSAConnect(
|
||||
s: SOCKET,
|
||||
@ -1933,7 +1932,7 @@ pub extern "ws2_32" fn WSAConnect(
|
||||
lpCalleeData: ?*WSABUF,
|
||||
lpSQOS: ?*QOS,
|
||||
lpGQOS: ?*QOS,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAConnectByNameW(
|
||||
s: SOCKET,
|
||||
@ -1945,7 +1944,7 @@ pub extern "ws2_32" fn WSAConnectByNameW(
|
||||
RemoteAddress: ?*sockaddr,
|
||||
timeout: ?*const timeval,
|
||||
Reserved: *OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSAConnectByNameA(
|
||||
s: SOCKET,
|
||||
@ -1957,7 +1956,7 @@ pub extern "ws2_32" fn WSAConnectByNameA(
|
||||
RemoteAddress: ?*sockaddr,
|
||||
timeout: ?*const timeval,
|
||||
Reserved: *OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSAConnectByList(
|
||||
s: SOCKET,
|
||||
@ -1968,45 +1967,45 @@ pub extern "ws2_32" fn WSAConnectByList(
|
||||
RemoteAddress: ?*sockaddr,
|
||||
timeout: ?*const timeval,
|
||||
Reserved: *OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSACreateEvent() callconv(WINAPI) HANDLE;
|
||||
pub extern "ws2_32" fn WSACreateEvent() callconv(.winapi) HANDLE;
|
||||
|
||||
pub extern "ws2_32" fn WSADuplicateSocketA(
|
||||
s: SOCKET,
|
||||
dwProcessId: u32,
|
||||
lpProtocolInfo: *WSAPROTOCOL_INFOA,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSADuplicateSocketW(
|
||||
s: SOCKET,
|
||||
dwProcessId: u32,
|
||||
lpProtocolInfo: *WSAPROTOCOL_INFOW,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAEnumNetworkEvents(
|
||||
s: SOCKET,
|
||||
hEventObject: HANDLE,
|
||||
lpNetworkEvents: *WSANETWORKEVENTS,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAEnumProtocolsA(
|
||||
lpiProtocols: ?*i32,
|
||||
lpProtocolBuffer: ?*WSAPROTOCOL_INFOA,
|
||||
lpdwBufferLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAEnumProtocolsW(
|
||||
lpiProtocols: ?*i32,
|
||||
lpProtocolBuffer: ?*WSAPROTOCOL_INFOW,
|
||||
lpdwBufferLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAEventSelect(
|
||||
s: SOCKET,
|
||||
hEventObject: HANDLE,
|
||||
lNetworkEvents: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAGetOverlappedResult(
|
||||
s: SOCKET,
|
||||
@ -2014,25 +2013,25 @@ pub extern "ws2_32" fn WSAGetOverlappedResult(
|
||||
lpcbTransfer: *u32,
|
||||
fWait: BOOL,
|
||||
lpdwFlags: *u32,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSAGetQOSByName(
|
||||
s: SOCKET,
|
||||
lpQOSName: *WSABUF,
|
||||
lpQOS: *QOS,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSAHtonl(
|
||||
s: SOCKET,
|
||||
hostlong: u32,
|
||||
lpnetlong: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAHtons(
|
||||
s: SOCKET,
|
||||
hostshort: u16,
|
||||
lpnetshort: *u16,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAIoctl(
|
||||
s: SOCKET,
|
||||
@ -2044,7 +2043,7 @@ pub extern "ws2_32" fn WSAIoctl(
|
||||
lpcbBytesReturned: *u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAJoinLeaf(
|
||||
s: SOCKET,
|
||||
@ -2055,19 +2054,19 @@ pub extern "ws2_32" fn WSAJoinLeaf(
|
||||
lpSQOS: ?*QOS,
|
||||
lpGQOS: ?*QOS,
|
||||
dwFlags: u32,
|
||||
) callconv(WINAPI) SOCKET;
|
||||
) callconv(.winapi) SOCKET;
|
||||
|
||||
pub extern "ws2_32" fn WSANtohl(
|
||||
s: SOCKET,
|
||||
netlong: u32,
|
||||
lphostlong: *u32,
|
||||
) callconv(WINAPI) u32;
|
||||
) callconv(.winapi) u32;
|
||||
|
||||
pub extern "ws2_32" fn WSANtohs(
|
||||
s: SOCKET,
|
||||
netshort: u16,
|
||||
lphostshort: *u16,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSARecv(
|
||||
s: SOCKET,
|
||||
@ -2077,12 +2076,12 @@ pub extern "ws2_32" fn WSARecv(
|
||||
lpFlags: *u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSARecvDisconnect(
|
||||
s: SOCKET,
|
||||
lpInboundDisconnectData: ?*WSABUF,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSARecvFrom(
|
||||
s: SOCKET,
|
||||
@ -2094,9 +2093,9 @@ pub extern "ws2_32" fn WSARecvFrom(
|
||||
lpFromlen: ?*i32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAResetEvent(hEvent: HANDLE) callconv(WINAPI) i32;
|
||||
pub extern "ws2_32" fn WSAResetEvent(hEvent: HANDLE) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASend(
|
||||
s: SOCKET,
|
||||
@ -2106,7 +2105,7 @@ pub extern "ws2_32" fn WSASend(
|
||||
dwFlags: u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASendMsg(
|
||||
s: SOCKET,
|
||||
@ -2115,7 +2114,7 @@ pub extern "ws2_32" fn WSASendMsg(
|
||||
lpNumberOfBytesSent: ?*u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSARecvMsg(
|
||||
s: SOCKET,
|
||||
@ -2123,12 +2122,12 @@ pub extern "ws2_32" fn WSARecvMsg(
|
||||
lpdwNumberOfBytesRecv: ?*u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASendDisconnect(
|
||||
s: SOCKET,
|
||||
lpOutboundDisconnectData: ?*WSABUF,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASendTo(
|
||||
s: SOCKET,
|
||||
@ -2140,11 +2139,11 @@ pub extern "ws2_32" fn WSASendTo(
|
||||
iToLen: i32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRounte: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSASetEvent(
|
||||
hEvent: HANDLE,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "ws2_32" fn WSASocketA(
|
||||
af: i32,
|
||||
@ -2153,7 +2152,7 @@ pub extern "ws2_32" fn WSASocketA(
|
||||
lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
|
||||
g: u32,
|
||||
dwFlags: u32,
|
||||
) callconv(WINAPI) SOCKET;
|
||||
) callconv(.winapi) SOCKET;
|
||||
|
||||
pub extern "ws2_32" fn WSASocketW(
|
||||
af: i32,
|
||||
@ -2162,7 +2161,7 @@ pub extern "ws2_32" fn WSASocketW(
|
||||
lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
|
||||
g: u32,
|
||||
dwFlags: u32,
|
||||
) callconv(WINAPI) SOCKET;
|
||||
) callconv(.winapi) SOCKET;
|
||||
|
||||
pub extern "ws2_32" fn WSAWaitForMultipleEvents(
|
||||
cEvents: u32,
|
||||
@ -2170,7 +2169,7 @@ pub extern "ws2_32" fn WSAWaitForMultipleEvents(
|
||||
fWaitAll: BOOL,
|
||||
dwTimeout: u32,
|
||||
fAlertable: BOOL,
|
||||
) callconv(WINAPI) u32;
|
||||
) callconv(.winapi) u32;
|
||||
|
||||
pub extern "ws2_32" fn WSAAddressToStringA(
|
||||
lpsaAddress: *sockaddr,
|
||||
@ -2178,7 +2177,7 @@ pub extern "ws2_32" fn WSAAddressToStringA(
|
||||
lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
|
||||
lpszAddressString: [*]u8,
|
||||
lpdwAddressStringLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAAddressToStringW(
|
||||
lpsaAddress: *sockaddr,
|
||||
@ -2186,7 +2185,7 @@ pub extern "ws2_32" fn WSAAddressToStringW(
|
||||
lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
|
||||
lpszAddressString: [*]u16,
|
||||
lpdwAddressStringLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAStringToAddressA(
|
||||
AddressString: [*:0]const u8,
|
||||
@ -2194,7 +2193,7 @@ pub extern "ws2_32" fn WSAStringToAddressA(
|
||||
lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
|
||||
lpAddress: *sockaddr,
|
||||
lpAddressLength: *i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAStringToAddressW(
|
||||
AddressString: [*:0]const u16,
|
||||
@ -2202,26 +2201,26 @@ pub extern "ws2_32" fn WSAStringToAddressW(
|
||||
lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
|
||||
lpAddrses: *sockaddr,
|
||||
lpAddressLength: *i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAProviderConfigChange(
|
||||
lpNotificationHandle: *HANDLE,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn WSAPoll(
|
||||
fdArray: [*]WSAPOLLFD,
|
||||
fds: u32,
|
||||
timeout: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn WSARecvEx(
|
||||
s: SOCKET,
|
||||
buf: [*]u8,
|
||||
len: i32,
|
||||
flags: *i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn TransmitFile(
|
||||
hSocket: SOCKET,
|
||||
@ -2231,7 +2230,7 @@ pub extern "mswsock" fn TransmitFile(
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
|
||||
dwReserved: u32,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "mswsock" fn AcceptEx(
|
||||
sListenSocket: SOCKET,
|
||||
@ -2242,7 +2241,7 @@ pub extern "mswsock" fn AcceptEx(
|
||||
dwRemoteAddressLength: u32,
|
||||
lpdwBytesReceived: *u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL;
|
||||
) callconv(.winapi) BOOL;
|
||||
|
||||
pub extern "mswsock" fn GetAcceptExSockaddrs(
|
||||
lpOutputBuffer: *anyopaque,
|
||||
@ -2253,24 +2252,24 @@ pub extern "mswsock" fn GetAcceptExSockaddrs(
|
||||
LocalSockaddrLength: *i32,
|
||||
RemoteSockaddr: **sockaddr,
|
||||
RemoteSockaddrLength: *i32,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub extern "ws2_32" fn WSAProviderCompleteAsyncCall(
|
||||
hAsyncCall: HANDLE,
|
||||
iRetCode: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn EnumProtocolsA(
|
||||
lpiProtocols: ?*i32,
|
||||
lpProtocolBuffer: *anyopaque,
|
||||
lpdwBufferLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn EnumProtocolsW(
|
||||
lpiProtocols: ?*i32,
|
||||
lpProtocolBuffer: *anyopaque,
|
||||
lpdwBufferLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn GetAddressByNameA(
|
||||
dwNameSpace: u32,
|
||||
@ -2282,7 +2281,7 @@ pub extern "mswsock" fn GetAddressByNameA(
|
||||
lpCsaddrBuffer: *anyopaque,
|
||||
lpAliasBuffer: ?[*:0]const u8,
|
||||
lpdwAliasBufferLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn GetAddressByNameW(
|
||||
dwNameSpace: u32,
|
||||
@ -2295,36 +2294,36 @@ pub extern "mswsock" fn GetAddressByNameW(
|
||||
ldwBufferLEngth: *u32,
|
||||
lpAliasBuffer: ?[*:0]u16,
|
||||
lpdwAliasBufferLength: *u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn GetTypeByNameA(
|
||||
lpServiceName: [*:0]u8,
|
||||
lpServiceType: *GUID,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn GetTypeByNameW(
|
||||
lpServiceName: [*:0]u16,
|
||||
lpServiceType: *GUID,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn GetNameByTypeA(
|
||||
lpServiceType: *GUID,
|
||||
lpServiceName: [*:0]u8,
|
||||
dwNameLength: u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "mswsock" fn GetNameByTypeW(
|
||||
lpServiceType: *GUID,
|
||||
lpServiceName: [*:0]u16,
|
||||
dwNameLength: u32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn getaddrinfo(
|
||||
pNodeName: ?[*:0]const u8,
|
||||
pServiceName: ?[*:0]const u8,
|
||||
pHints: ?*const addrinfoa,
|
||||
ppResult: *?*addrinfoa,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn GetAddrInfoExA(
|
||||
pName: ?[*:0]const u8,
|
||||
@ -2336,23 +2335,23 @@ pub extern "ws2_32" fn GetAddrInfoExA(
|
||||
timeout: ?*timeval,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn GetAddrInfoExCancel(
|
||||
lpHandle: *HANDLE,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn GetAddrInfoExOverlappedResult(
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "ws2_32" fn freeaddrinfo(
|
||||
pAddrInfo: ?*addrinfoa,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub extern "ws2_32" fn FreeAddrInfoEx(
|
||||
pAddrInfoEx: ?*addrinfoexA,
|
||||
) callconv(WINAPI) void;
|
||||
) callconv(.winapi) void;
|
||||
|
||||
pub extern "ws2_32" fn getnameinfo(
|
||||
pSockaddr: *const sockaddr,
|
||||
@ -2362,8 +2361,8 @@ pub extern "ws2_32" fn getnameinfo(
|
||||
pServiceBuffer: ?[*]u8,
|
||||
ServiceBufferName: u32,
|
||||
Flags: i32,
|
||||
) callconv(WINAPI) i32;
|
||||
) callconv(.winapi) i32;
|
||||
|
||||
pub extern "iphlpapi" fn if_nametoindex(
|
||||
InterfaceName: [*:0]const u8,
|
||||
) callconv(WINAPI) u32;
|
||||
) callconv(.winapi) u32;
|
||||
|
@ -29,7 +29,7 @@ comptime {
|
||||
if (simplified_logic) {
|
||||
if (builtin.output_mode == .Exe) {
|
||||
if ((builtin.link_libc or builtin.object_format == .c) and @hasDecl(root, "main")) {
|
||||
if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) {
|
||||
if (!@typeInfo(@TypeOf(root.main)).@"fn".calling_convention.eql(.c)) {
|
||||
@export(&main2, .{ .name = "main" });
|
||||
}
|
||||
} else if (builtin.os.tag == .windows) {
|
||||
@ -96,7 +96,7 @@ comptime {
|
||||
|
||||
// Simplified start code for stage2 until it supports more language features ///
|
||||
|
||||
fn main2() callconv(.C) c_int {
|
||||
fn main2() callconv(.c) c_int {
|
||||
root.main();
|
||||
return 0;
|
||||
}
|
||||
@ -110,11 +110,11 @@ fn callMain2() noreturn {
|
||||
exit2(0);
|
||||
}
|
||||
|
||||
fn spirvMain2() callconv(.Kernel) void {
|
||||
fn spirvMain2() callconv(.kernel) void {
|
||||
root.main();
|
||||
}
|
||||
|
||||
fn wWinMainCRTStartup2() callconv(.C) noreturn {
|
||||
fn wWinMainCRTStartup2() callconv(.c) noreturn {
|
||||
root.main();
|
||||
exit2(0);
|
||||
}
|
||||
@ -172,7 +172,7 @@ fn _DllMainCRTStartup(
|
||||
hinstDLL: std.os.windows.HINSTANCE,
|
||||
fdwReason: std.os.windows.DWORD,
|
||||
lpReserved: std.os.windows.LPVOID,
|
||||
) callconv(std.os.windows.WINAPI) std.os.windows.BOOL {
|
||||
) callconv(.winapi) std.os.windows.BOOL {
|
||||
if (!builtin.single_threaded and !builtin.link_libc) {
|
||||
_ = @import("os/windows/tls.zig");
|
||||
}
|
||||
@ -184,13 +184,13 @@ fn _DllMainCRTStartup(
|
||||
return std.os.windows.TRUE;
|
||||
}
|
||||
|
||||
fn wasm_freestanding_start() callconv(.C) void {
|
||||
fn wasm_freestanding_start() callconv(.c) void {
|
||||
// This is marked inline because for some reason LLVM in
|
||||
// release mode fails to inline it, and we want fewer call frames in stack traces.
|
||||
_ = @call(.always_inline, callMain, .{});
|
||||
}
|
||||
|
||||
fn wasi_start() callconv(.C) void {
|
||||
fn wasi_start() callconv(.c) void {
|
||||
// The function call is marked inline because for some reason LLVM in
|
||||
// release mode fails to inline it, and we want fewer call frames in stack traces.
|
||||
switch (builtin.wasi_exec_model) {
|
||||
@ -199,7 +199,7 @@ fn wasi_start() callconv(.C) void {
|
||||
}
|
||||
}
|
||||
|
||||
fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize {
|
||||
fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.c) usize {
|
||||
uefi.handle = handle;
|
||||
uefi.system_table = system_table;
|
||||
|
||||
@ -221,7 +221,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv
|
||||
}
|
||||
}
|
||||
|
||||
fn _start() callconv(.Naked) noreturn {
|
||||
fn _start() callconv(.naked) noreturn {
|
||||
// TODO set Top of Stack on non x86_64-plan9
|
||||
if (native_os == .plan9 and native_arch == .x86_64) {
|
||||
// from /sys/src/libc/amd64/main9.s
|
||||
@ -426,7 +426,7 @@ fn _start() callconv(.Naked) noreturn {
|
||||
);
|
||||
}
|
||||
|
||||
fn WinStartup() callconv(.withStackAlign(.winapi, 1)) noreturn {
|
||||
fn WinStartup() callconv(.withStackAlign(.c, 1)) noreturn {
|
||||
if (!builtin.single_threaded and !builtin.link_libc) {
|
||||
_ = @import("os/windows/tls.zig");
|
||||
}
|
||||
@ -436,7 +436,7 @@ fn WinStartup() callconv(.withStackAlign(.winapi, 1)) noreturn {
|
||||
std.os.windows.ntdll.RtlExitUserProcess(callMain());
|
||||
}
|
||||
|
||||
fn wWinMainCRTStartup() callconv(.withStackAlign(.winapi, 1)) noreturn {
|
||||
fn wWinMainCRTStartup() callconv(.withStackAlign(.c, 1)) noreturn {
|
||||
if (!builtin.single_threaded and !builtin.link_libc) {
|
||||
_ = @import("os/windows/tls.zig");
|
||||
}
|
||||
@ -447,7 +447,7 @@ fn wWinMainCRTStartup() callconv(.withStackAlign(.winapi, 1)) noreturn {
|
||||
std.os.windows.ntdll.RtlExitUserProcess(@as(std.os.windows.UINT, @bitCast(result)));
|
||||
}
|
||||
|
||||
fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn {
|
||||
fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.c) noreturn {
|
||||
// We're not ready to panic until thread local storage is initialized.
|
||||
@setRuntimeSafety(false);
|
||||
// Code coverage instrumentation might try to use thread local variables.
|
||||
@ -514,11 +514,11 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn {
|
||||
// to ask for more stack space.
|
||||
expandStackSize(phdrs);
|
||||
|
||||
const opt_init_array_start = @extern([*]*const fn () callconv(.C) void, .{
|
||||
const opt_init_array_start = @extern([*]*const fn () callconv(.c) void, .{
|
||||
.name = "__init_array_start",
|
||||
.linkage = .weak,
|
||||
});
|
||||
const opt_init_array_end = @extern([*]*const fn () callconv(.C) void, .{
|
||||
const opt_init_array_end = @extern([*]*const fn () callconv(.c) void, .{
|
||||
.name = "__init_array_end",
|
||||
.linkage = .weak,
|
||||
});
|
||||
@ -577,7 +577,7 @@ inline fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 {
|
||||
return callMain();
|
||||
}
|
||||
|
||||
fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) callconv(.C) c_int {
|
||||
fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) callconv(.c) c_int {
|
||||
var env_count: usize = 0;
|
||||
while (c_envp[env_count] != null) : (env_count += 1) {}
|
||||
const envp = @as([*][*:0]u8, @ptrCast(c_envp))[0..env_count];
|
||||
@ -592,7 +592,7 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal
|
||||
return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp);
|
||||
}
|
||||
|
||||
fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.C) c_int {
|
||||
fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int {
|
||||
std.os.argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@as(usize, @intCast(c_argc))];
|
||||
return callMain();
|
||||
}
|
||||
@ -702,4 +702,4 @@ fn maybeIgnoreSigpipe() void {
|
||||
}
|
||||
}
|
||||
|
||||
fn noopSigHandler(_: i32) callconv(.C) void {}
|
||||
fn noopSigHandler(_: i32) callconv(.c) void {}
|
||||
|
33
src/Sema.zig
33
src/Sema.zig
@ -7574,13 +7574,13 @@ fn analyzeCall(
|
||||
if (try sema.resolveValue(func)) |func_val|
|
||||
if (func_val.isUndef(zcu))
|
||||
return sema.failWithUseOfUndef(block, call_src);
|
||||
if (cc == .naked) {
|
||||
if (!callConvIsCallable(cc)) {
|
||||
const maybe_func_inst = try sema.funcDeclSrcInst(func);
|
||||
const msg = msg: {
|
||||
const msg = try sema.errMsg(
|
||||
func_src,
|
||||
"unable to call function with naked calling convention",
|
||||
.{},
|
||||
"unable to call function with calling convention '{s}'",
|
||||
.{@tagName(cc)},
|
||||
);
|
||||
errdefer msg.destroy(sema.gpa);
|
||||
|
||||
@ -9764,6 +9764,33 @@ fn checkCallConvSupportsVarArgs(sema: *Sema, block: *Block, src: LazySrcLoc, cc:
|
||||
}
|
||||
}
|
||||
|
||||
fn callConvIsCallable(cc: std.builtin.CallingConvention.Tag) bool {
|
||||
return switch (cc) {
|
||||
.naked,
|
||||
|
||||
.arm_interrupt,
|
||||
.avr_interrupt,
|
||||
.avr_signal,
|
||||
.csky_interrupt,
|
||||
.m68k_interrupt,
|
||||
.mips_interrupt,
|
||||
.mips64_interrupt,
|
||||
.riscv32_interrupt,
|
||||
.riscv64_interrupt,
|
||||
.x86_interrupt,
|
||||
.x86_64_interrupt,
|
||||
|
||||
.amdgcn_kernel,
|
||||
.nvptx_kernel,
|
||||
.spirv_kernel,
|
||||
.spirv_fragment,
|
||||
.spirv_vertex,
|
||||
=> false,
|
||||
|
||||
else => true,
|
||||
};
|
||||
}
|
||||
|
||||
fn checkMergeAllowed(sema: *Sema, block: *Block, src: LazySrcLoc, peer_ty: Type) !void {
|
||||
const pt = sema.pt;
|
||||
const zcu = pt.zcu;
|
||||
|
25
src/Zcu.zig
25
src/Zcu.zig
@ -3607,18 +3607,37 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu
|
||||
.x86_64_vectorcall,
|
||||
.x86_64_regcall_v3_sysv,
|
||||
.x86_64_regcall_v4_win,
|
||||
.x86_64_interrupt,
|
||||
.x86_fastcall,
|
||||
.x86_thiscall,
|
||||
.x86_vectorcall,
|
||||
.x86_regcall_v3,
|
||||
.x86_regcall_v4_win,
|
||||
.x86_interrupt,
|
||||
.aarch64_vfabi,
|
||||
.aarch64_vfabi_sve,
|
||||
.arm_aapcs,
|
||||
.arm_aapcs_vfp,
|
||||
.csky_interrupt,
|
||||
.riscv64_lp64_v,
|
||||
.riscv32_ilp32_v,
|
||||
.m68k_rtd,
|
||||
.m68k_interrupt,
|
||||
=> |opts| opts.incoming_stack_alignment == null,
|
||||
|
||||
.arm_aapcs_vfp,
|
||||
=> |opts| opts.incoming_stack_alignment == null and target.os.tag != .watchos,
|
||||
.arm_aapcs16_vfp,
|
||||
=> |opts| opts.incoming_stack_alignment == null and target.os.tag == .watchos,
|
||||
|
||||
.arm_interrupt,
|
||||
=> |opts| opts.incoming_stack_alignment == null,
|
||||
|
||||
.mips_interrupt,
|
||||
.mips64_interrupt,
|
||||
=> |opts| opts.incoming_stack_alignment == null,
|
||||
|
||||
.riscv32_interrupt,
|
||||
.riscv64_interrupt,
|
||||
=> |opts| opts.incoming_stack_alignment == null,
|
||||
|
||||
.x86_sysv,
|
||||
@ -3626,6 +3645,10 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu
|
||||
.x86_stdcall,
|
||||
=> |opts| opts.incoming_stack_alignment == null and opts.register_params == 0,
|
||||
|
||||
.avr_interrupt,
|
||||
.avr_signal,
|
||||
=> true,
|
||||
|
||||
.naked => true,
|
||||
|
||||
else => false,
|
||||
|
@ -7622,11 +7622,44 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8
|
||||
|
||||
.aarch64_vfabi => "aarch64_vector_pcs",
|
||||
.aarch64_vfabi_sve => "aarch64_sve_pcs",
|
||||
|
||||
.arm_aapcs => "pcs(\"aapcs\")",
|
||||
.arm_aapcs_vfp => "pcs(\"aapcs-vfp\")",
|
||||
.arm_aapcs_vfp, .arm_aapcs16_vfp => "pcs(\"aapcs-vfp\")",
|
||||
|
||||
.arm_interrupt => |opts| switch (opts.type) {
|
||||
.generic => "interrupt",
|
||||
.irq => "interrupt(\"IRQ\")",
|
||||
.fiq => "interrupt(\"FIQ\")",
|
||||
.swi => "interrupt(\"SWI\")",
|
||||
.abort => "interrupt(\"ABORT\")",
|
||||
.undef => "interrupt(\"UNDEF\")",
|
||||
},
|
||||
|
||||
.avr_signal => "signal",
|
||||
|
||||
.mips_interrupt,
|
||||
.mips64_interrupt,
|
||||
=> |opts| switch (opts.mode) {
|
||||
inline else => |m| "interrupt(\"" ++ @tagName(m) ++ "\")",
|
||||
},
|
||||
|
||||
.riscv64_lp64_v, .riscv32_ilp32_v => "riscv_vector_cc",
|
||||
|
||||
.riscv32_interrupt,
|
||||
.riscv64_interrupt,
|
||||
=> |opts| switch (opts.mode) {
|
||||
inline else => |m| "interrupt(\"" ++ @tagName(m) ++ "\")",
|
||||
},
|
||||
|
||||
.m68k_rtd => "m68k_rtd",
|
||||
|
||||
.avr_interrupt,
|
||||
.csky_interrupt,
|
||||
.m68k_interrupt,
|
||||
.x86_interrupt,
|
||||
.x86_64_interrupt,
|
||||
=> "interrupt",
|
||||
|
||||
else => unreachable, // `Zcu.callconvSupported`
|
||||
};
|
||||
}
|
||||
|
@ -11749,7 +11749,14 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Targ
|
||||
.aarch64_vfabi_sve => .aarch64_sve_vector_pcs,
|
||||
.arm_apcs => .arm_apcscc,
|
||||
.arm_aapcs => .arm_aapcscc,
|
||||
.arm_aapcs_vfp => .arm_aapcs_vfpcc,
|
||||
.arm_aapcs_vfp => if (target.os.tag != .watchos)
|
||||
.arm_aapcs_vfpcc
|
||||
else
|
||||
null,
|
||||
.arm_aapcs16_vfp => if (target.os.tag == .watchos)
|
||||
.arm_aapcs_vfpcc
|
||||
else
|
||||
null,
|
||||
.riscv64_lp64_v => .riscv_vectorcallcc,
|
||||
.riscv32_ilp32_v => .riscv_vectorcallcc,
|
||||
.avr_builtin => .avr_builtincc,
|
||||
@ -11779,7 +11786,6 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: std.Targ
|
||||
.aarch64_aapcs,
|
||||
.aarch64_aapcs_darwin,
|
||||
.aarch64_aapcs_win,
|
||||
.arm_aapcs16_vfp,
|
||||
.mips64_n64,
|
||||
.mips64_n32,
|
||||
.mips_o32,
|
||||
@ -11977,7 +11983,7 @@ fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: std.Targe
|
||||
.aarch64_aapcs_darwin,
|
||||
.aarch64_aapcs_win,
|
||||
=> aarch64_c_abi.classifyType(return_type, zcu) == .memory,
|
||||
.arm_aapcs, .arm_aapcs_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) {
|
||||
.arm_aapcs, .arm_aapcs_vfp, .arm_aapcs16_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) {
|
||||
.memory, .i64_array => true,
|
||||
.i32_array => |size| size != 1,
|
||||
.byval => false,
|
||||
@ -12027,7 +12033,7 @@ fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Error!Bu
|
||||
.integer => return o.builder.intType(@intCast(return_type.bitSize(zcu))),
|
||||
.double_integer => return o.builder.arrayType(2, .i64),
|
||||
},
|
||||
.arm_aapcs, .arm_aapcs_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) {
|
||||
.arm_aapcs, .arm_aapcs_vfp, .arm_aapcs16_vfp => switch (arm_c_abi.classifyType(return_type, zcu, .ret)) {
|
||||
.memory, .i64_array => return .void,
|
||||
.i32_array => |len| return if (len == 1) .i32 else .void,
|
||||
.byval => return o.lowerType(return_type),
|
||||
@ -12276,7 +12282,7 @@ const ParamTypeIterator = struct {
|
||||
.double_integer => return Lowering{ .i64_array = 2 },
|
||||
}
|
||||
},
|
||||
.arm_aapcs, .arm_aapcs_vfp => {
|
||||
.arm_aapcs, .arm_aapcs_vfp, .arm_aapcs16_vfp => {
|
||||
it.zig_index += 1;
|
||||
it.llvm_index += 1;
|
||||
switch (arm_c_abi.classifyType(ty, zcu, .arg)) {
|
||||
|
@ -229,7 +229,7 @@ const WindowsSegfaultMessage = union(enum) {
|
||||
illegal_instruction: void,
|
||||
};
|
||||
|
||||
fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(windows.WINAPI) c_long {
|
||||
fn handleSegfaultWindows(info: *windows.EXCEPTION_POINTERS) callconv(.winapi) c_long {
|
||||
switch (info.ExceptionRecord.ExceptionCode) {
|
||||
windows.EXCEPTION_DATATYPE_MISALIGNMENT => handleSegfaultWindowsExtra(info, .{ .literal = "Unaligned Memory Access" }),
|
||||
windows.EXCEPTION_ACCESS_VIOLATION => handleSegfaultWindowsExtra(info, .segfault),
|
||||
|
@ -3415,8 +3415,8 @@ fn updateType(
|
||||
.x86_64_regcall_v3_sysv => .LLVM_X86RegCall,
|
||||
.x86_64_regcall_v4_win => .LLVM_X86RegCall,
|
||||
.x86_64_vectorcall => .LLVM_vectorcall,
|
||||
.x86_sysv => .nocall,
|
||||
.x86_win => .nocall,
|
||||
.x86_sysv => .normal,
|
||||
.x86_win => .normal,
|
||||
.x86_stdcall => .BORLAND_stdcall,
|
||||
.x86_fastcall => .BORLAND_msfastcall,
|
||||
.x86_thiscall => .BORLAND_thiscall,
|
||||
@ -3425,16 +3425,17 @@ fn updateType(
|
||||
.x86_regcall_v4_win => .LLVM_X86RegCall,
|
||||
.x86_vectorcall => .LLVM_vectorcall,
|
||||
|
||||
.aarch64_aapcs => .LLVM_AAPCS,
|
||||
.aarch64_aapcs_darwin => .LLVM_AAPCS,
|
||||
.aarch64_aapcs_win => .LLVM_AAPCS,
|
||||
.aarch64_aapcs => .normal,
|
||||
.aarch64_aapcs_darwin => .normal,
|
||||
.aarch64_aapcs_win => .normal,
|
||||
.aarch64_vfabi => .LLVM_AAPCS,
|
||||
.aarch64_vfabi_sve => .LLVM_AAPCS,
|
||||
|
||||
.arm_apcs => .nocall,
|
||||
.arm_apcs => .normal,
|
||||
.arm_aapcs => .LLVM_AAPCS,
|
||||
.arm_aapcs_vfp => .LLVM_AAPCS_VFP,
|
||||
.arm_aapcs16_vfp => .nocall,
|
||||
.arm_aapcs_vfp,
|
||||
.arm_aapcs16_vfp,
|
||||
=> .LLVM_AAPCS_VFP,
|
||||
|
||||
.riscv64_lp64_v,
|
||||
.riscv32_ilp32_v,
|
||||
@ -3442,10 +3443,10 @@ fn updateType(
|
||||
|
||||
.m68k_rtd => .LLVM_M68kRTD,
|
||||
|
||||
.amdgcn_kernel,
|
||||
.amdgcn_kernel => .LLVM_OpenCLKernel,
|
||||
.nvptx_kernel,
|
||||
.spirv_kernel,
|
||||
=> .LLVM_OpenCLKernel,
|
||||
=> .nocall,
|
||||
|
||||
.x86_64_interrupt,
|
||||
.x86_interrupt,
|
||||
|
@ -1,11 +1,11 @@
|
||||
export fn entry() void {
|
||||
foo();
|
||||
}
|
||||
fn foo() callconv(.Naked) void {}
|
||||
fn foo() callconv(.naked) void {}
|
||||
|
||||
// error
|
||||
// backend=llvm
|
||||
// target=native
|
||||
//
|
||||
// :2:5: error: unable to call function with naked calling convention
|
||||
// :2:5: error: unable to call function with calling convention 'naked'
|
||||
// :4:1: note: function declared here
|
||||
|
@ -576,7 +576,7 @@ fn knownOption(name: []const u8) ?[]const u8 {
|
||||
|
||||
const cpu_targets = struct {
|
||||
pub const aarch64 = std.Target.aarch64;
|
||||
pub const amdgpu = std.Target.amdgpu;
|
||||
pub const amdgcn = std.Target.amdgcn;
|
||||
pub const arc = std.Target.arc;
|
||||
pub const arm = std.Target.arm;
|
||||
pub const avr = std.Target.avr;
|
||||
|
@ -390,7 +390,7 @@ const llvm_targets = [_]LlvmTarget{
|
||||
},
|
||||
},
|
||||
.{
|
||||
.zig_name = "amdgpu",
|
||||
.zig_name = "amdgcn",
|
||||
.llvm_name = "AMDGPU",
|
||||
.td_name = "AMDGPU.td",
|
||||
.feature_overrides = &.{
|
||||
|
Loading…
Reference in New Issue
Block a user