//! NOTE: this file is autogenerated, DO NOT MODIFY
//--------------------------------------------------------------------------------
// Section: Constants (0)
//--------------------------------------------------------------------------------

//--------------------------------------------------------------------------------
// Section: Types (3)
//--------------------------------------------------------------------------------
pub const OVERLAPPED = extern struct {
    Internal: usize,
    InternalHigh: usize,
    Anonymous: extern union {
        Anonymous: extern struct {
            Offset: u32,
            OffsetHigh: u32,
        },
        Pointer: ?*anyopaque,
    },
    hEvent: ?HANDLE,
};

pub const OVERLAPPED_ENTRY = extern struct {
    lpCompletionKey: usize,
    lpOverlapped: ?*OVERLAPPED,
    Internal: usize,
    dwNumberOfBytesTransferred: u32,
};

pub const LPOVERLAPPED_COMPLETION_ROUTINE = switch (@import("builtin").zig_backend) {
    .stage1 => fn (
        dwErrorCode: u32,
        dwNumberOfBytesTransfered: u32,
        lpOverlapped: ?*OVERLAPPED,
    ) callconv(@import("std").os.windows.WINAPI) void,
    else => *const fn (
        dwErrorCode: u32,
        dwNumberOfBytesTransfered: u32,
        lpOverlapped: ?*OVERLAPPED,
    ) callconv(@import("std").os.windows.WINAPI) void,
};

//--------------------------------------------------------------------------------
// Section: Functions (11)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn CreateIoCompletionPort(
    FileHandle: ?HANDLE,
    ExistingCompletionPort: ?HANDLE,
    CompletionKey: usize,
    NumberOfConcurrentThreads: u32,
) callconv(@import("std").os.windows.WINAPI) ?HANDLE;

// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn GetQueuedCompletionStatus(
    CompletionPort: ?HANDLE,
    lpNumberOfBytesTransferred: ?*u32,
    lpCompletionKey: ?*usize,
    lpOverlapped: ?*?*OVERLAPPED,
    dwMilliseconds: u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "kernel32" fn GetQueuedCompletionStatusEx(
    CompletionPort: ?HANDLE,
    lpCompletionPortEntries: [*]OVERLAPPED_ENTRY,
    ulCount: u32,
    ulNumEntriesRemoved: ?*u32,
    dwMilliseconds: u32,
    fAlertable: BOOL,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn PostQueuedCompletionStatus(
    CompletionPort: ?HANDLE,
    dwNumberOfBytesTransferred: u32,
    dwCompletionKey: usize,
    lpOverlapped: ?*OVERLAPPED,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn DeviceIoControl(
    hDevice: ?HANDLE,
    dwIoControlCode: u32,
    // TODO: what to do with BytesParamIndex 3?
    lpInBuffer: ?*anyopaque,
    nInBufferSize: u32,
    // TODO: what to do with BytesParamIndex 5?
    lpOutBuffer: ?*anyopaque,
    nOutBufferSize: u32,
    lpBytesReturned: ?*u32,
    lpOverlapped: ?*OVERLAPPED,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn GetOverlappedResult(
    hFile: ?HANDLE,
    lpOverlapped: ?*OVERLAPPED,
    lpNumberOfBytesTransferred: ?*u32,
    bWait: BOOL,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "kernel32" fn CancelIoEx(
    hFile: ?HANDLE,
    lpOverlapped: ?*OVERLAPPED,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn CancelIo(
    hFile: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows8.0'
pub extern "kernel32" fn GetOverlappedResultEx(
    hFile: ?HANDLE,
    lpOverlapped: ?*OVERLAPPED,
    lpNumberOfBytesTransferred: ?*u32,
    dwMilliseconds: u32,
    bAlertable: BOOL,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "kernel32" fn CancelSynchronousIo(
    hThread: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) BOOL;

// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "kernel32" fn BindIoCompletionCallback(
    FileHandle: ?HANDLE,
    Function: ?LPOVERLAPPED_COMPLETION_ROUTINE,
    Flags: u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;

//--------------------------------------------------------------------------------
// Section: Unicode Aliases (0)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
    .ansi => struct {},
    .wide => struct {},
    .unspecified => if (@import("builtin").is_test) struct {} else struct {},
};
//--------------------------------------------------------------------------------
// Section: Imports (2)
//--------------------------------------------------------------------------------
const BOOL = @import("../foundation.zig").BOOL;
const HANDLE = @import("../foundation.zig").HANDLE;

test {
    // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
    if (@hasDecl(@This(), "LPOVERLAPPED_COMPLETION_ROUTINE")) {
        _ = LPOVERLAPPED_COMPLETION_ROUTINE;
    }

    @setEvalBranchQuota(comptime @import("std").meta.declarations(@This()).len * 3);

    // reference all the pub declarations
    if (!@import("builtin").is_test) return;
    inline for (comptime @import("std").meta.declarations(@This())) |decl| {
        if (decl.is_pub) {
            _ = @field(@This(), decl.name);
        }
    }
}
