#! @file kernel32.sakura #! @author John Christman (sorakatadzuma@gmail.com) #! @copyright Malunal Studios, LLC. #! @license MIT #! #! Contains `runtime::win32`: the functions of `kernel32.dll` the runtime calls, #! as C functions the executable imports. The runtime declares its own, rather #! than read `system::windows`, since it ships with the compiler and reads #! `core` alone, and `system` is a package of its own. A program that reads #! both imports each function once, as an executable names a function a library #! is named for twice once. The functions Windows keeps for waiting on a word #! are in `waits.sakura`, since a file names one library on Windows. extern import "kernel32.dll" when os == windows; extern module runtime::win32 when os == windows; pub def GetStdHandle(which: u32): u64; pub def CloseHandle(handle: u64): i32; pub def GetConsoleMode(handle: u64, mode: &mut u32): i32; pub def WaitForSingleObject(handle: u64, milliseconds: u32): u32; pub def GetCommandLineW(): *u16; pub def GetEnvironmentStringsW(): *mut u16; pub def FreeEnvironmentStringsW(block: *mut u16): i32; pub def ExitProcess(code: u32): void; pub def SetErrorMode(mode: u32): u32; pub def WriteFile( handle: u64, from: *u8, length: u32, written: &mut u32, overlapped: *mut u8 ): i32; pub def WriteConsoleW( handle: u64, from: *u16, length: u32, written: &mut u32, reserved: *mut u8 ): i32; pub def VirtualAlloc( address: u64, size: u64, kind: u32, protection: u32 ): u64; pub def VirtualFree( address: u64, size: u64, kind: u32 ): i32; pub def MultiByteToWideChar( page: u32, flags: u32, bytes: *u8, count: i32, units: *mut u16, room: i32 ): i32; pub def WideCharToMultiByte( page: u32, flags: u32, wide: *u16, count: i32, into: *mut u8, size: i32, fallback: *u8, used: *mut i32 ): i32;