2018-07-20 20:37:37 -07:00
|
|
|
use @import("index.zig");
|
|
|
|
|
2018-08-08 12:05:57 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn CancelIoEx(hFile: HANDLE, lpOverlapped: LPOVERLAPPED) BOOL;
|
|
|
|
|
2018-07-20 20:37:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL;
|
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn CreateDirectoryW(lpPathName: [*]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) BOOL;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-08-09 13:48:44 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn CreateFileW(
|
2018-09-27 14:51:22 -07:00
|
|
|
lpFileName: [*]const u16, // TODO null terminated pointer type
|
2018-07-20 20:37:37 -07:00
|
|
|
dwDesiredAccess: DWORD,
|
|
|
|
dwShareMode: DWORD,
|
|
|
|
lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES,
|
|
|
|
dwCreationDisposition: DWORD,
|
|
|
|
dwFlagsAndAttributes: DWORD,
|
|
|
|
hTemplateFile: ?HANDLE,
|
|
|
|
) HANDLE;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn CreatePipe(
|
|
|
|
hReadPipe: *HANDLE,
|
|
|
|
hWritePipe: *HANDLE,
|
|
|
|
lpPipeAttributes: *const SECURITY_ATTRIBUTES,
|
|
|
|
nSize: DWORD,
|
|
|
|
) BOOL;
|
|
|
|
|
2018-09-02 20:25:04 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn CreateProcessW(
|
|
|
|
lpApplicationName: ?LPWSTR,
|
|
|
|
lpCommandLine: LPWSTR,
|
2018-07-20 20:37:37 -07:00
|
|
|
lpProcessAttributes: ?*SECURITY_ATTRIBUTES,
|
|
|
|
lpThreadAttributes: ?*SECURITY_ATTRIBUTES,
|
|
|
|
bInheritHandles: BOOL,
|
|
|
|
dwCreationFlags: DWORD,
|
|
|
|
lpEnvironment: ?*c_void,
|
2018-09-02 20:25:04 -07:00
|
|
|
lpCurrentDirectory: ?LPWSTR,
|
|
|
|
lpStartupInfo: *STARTUPINFOW,
|
2018-07-20 20:37:37 -07:00
|
|
|
lpProcessInformation: *PROCESS_INFORMATION,
|
|
|
|
) BOOL;
|
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn CreateSymbolicLinkW(lpSymlinkFileName: [*]const u16, lpTargetFileName: [*]const u16, dwFlags: DWORD) BOOLEAN;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn CreateIoCompletionPort(FileHandle: HANDLE, ExistingCompletionPort: ?HANDLE, CompletionKey: ULONG_PTR, NumberOfConcurrentThreads: DWORD) ?HANDLE;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn CreateThread(lpThreadAttributes: ?LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?LPDWORD) ?HANDLE;
|
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn DeleteFileW(lpFileName: [*]const u16) BOOL;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn;
|
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn FindFirstFileW(lpFileName: [*]const u16, lpFindFileData: *WIN32_FIND_DATAW) HANDLE;
|
2018-07-20 20:37:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn FindClose(hFindFile: HANDLE) BOOL;
|
2018-09-02 20:25:04 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) BOOL;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-11-22 02:15:22 -08:00
|
|
|
pub extern "kernel32" stdcallcc fn FreeEnvironmentStringsW(penv: [*]u16) BOOL;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetCommandLineA() LPSTR;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetConsoleMode(in_hConsoleHandle: HANDLE, out_lpMode: *DWORD) BOOL;
|
|
|
|
|
2018-09-02 12:58:08 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: *CONSOLE_SCREEN_BUFFER_INFO) BOOL;
|
|
|
|
|
2018-08-21 13:07:28 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: ?[*]WCHAR) DWORD;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-08-02 14:44:20 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetCurrentThread() HANDLE;
|
2018-08-06 14:25:24 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetCurrentThreadId() DWORD;
|
2018-08-02 14:44:20 -07:00
|
|
|
|
2018-11-22 02:15:22 -08:00
|
|
|
pub extern "kernel32" stdcallcc fn GetEnvironmentStringsW() ?[*]u16;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-11-22 02:15:22 -08:00
|
|
|
pub extern "kernel32" stdcallcc fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: LPWSTR, nSize: DWORD) DWORD;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: *DWORD) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetFileSizeEx(hFile: HANDLE, lpFileSize: *LARGE_INTEGER) BOOL;
|
|
|
|
|
2018-08-21 13:07:28 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetFileAttributesW(lpFileName: [*]const WCHAR) DWORD;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetModuleFileNameW(hModule: ?HMODULE, lpFilename: [*]u16, nSize: DWORD) DWORD;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-08-28 14:32:32 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetModuleHandleW(lpModuleName: ?[*]const WCHAR) HMODULE;
|
|
|
|
|
2018-07-20 20:37:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetLastError() DWORD;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetFileInformationByHandleEx(
|
|
|
|
in_hFile: HANDLE,
|
|
|
|
in_FileInformationClass: FILE_INFO_BY_HANDLE_CLASS,
|
|
|
|
out_lpFileInformation: *c_void,
|
|
|
|
in_dwBufferSize: DWORD,
|
|
|
|
) BOOL;
|
|
|
|
|
2018-08-21 17:28:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetFinalPathNameByHandleW(
|
|
|
|
hFile: HANDLE,
|
2018-09-27 14:51:22 -07:00
|
|
|
lpszFilePath: [*]u16,
|
2018-08-21 17:28:37 -07:00
|
|
|
cchFilePath: DWORD,
|
|
|
|
dwFlags: DWORD,
|
|
|
|
) DWORD;
|
|
|
|
|
2018-08-08 12:05:57 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetOverlappedResult(hFile: HANDLE, lpOverlapped: *OVERLAPPED, lpNumberOfBytesTransferred: *DWORD, bWait: BOOL) BOOL;
|
|
|
|
|
2018-07-20 20:37:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetProcessHeap() ?HANDLE;
|
|
|
|
pub extern "kernel32" stdcallcc fn GetQueuedCompletionStatus(CompletionPort: HANDLE, lpNumberOfBytesTransferred: LPDWORD, lpCompletionKey: *ULONG_PTR, lpOverlapped: *?*OVERLAPPED, dwMilliseconds: DWORD) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetSystemInfo(lpSystemInfo: *SYSTEM_INFO) void;
|
|
|
|
pub extern "kernel32" stdcallcc fn GetSystemTimeAsFileTime(*FILETIME) void;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapCreate(flOptions: DWORD, dwInitialSize: SIZE_T, dwMaximumSize: SIZE_T) ?HANDLE;
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapDestroy(hHeap: HANDLE) BOOL;
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: *c_void, dwBytes: SIZE_T) ?*c_void;
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapSize(hHeap: HANDLE, dwFlags: DWORD, lpMem: *const c_void) SIZE_T;
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapCompact(hHeap: HANDLE, dwFlags: DWORD) SIZE_T;
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn GetStdHandle(in_nStdHandle: DWORD) ?HANDLE;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) ?*c_void;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: *c_void) BOOL;
|
|
|
|
|
2018-08-09 18:48:25 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: ?*const c_void) BOOL;
|
|
|
|
|
2018-08-21 13:07:28 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn MoveFileExW(
|
2018-09-27 14:51:22 -07:00
|
|
|
lpExistingFileName: [*]const u16,
|
|
|
|
lpNewFileName: [*]const u16,
|
2018-07-20 20:37:37 -07:00
|
|
|
dwFlags: DWORD,
|
|
|
|
) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn PostQueuedCompletionStatus(CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, lpOverlapped: ?*OVERLAPPED) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn QueryPerformanceCounter(lpPerformanceCount: *LARGE_INTEGER) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn QueryPerformanceFrequency(lpFrequency: *LARGE_INTEGER) BOOL;
|
|
|
|
|
2018-08-09 13:48:44 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn ReadDirectoryChangesW(
|
|
|
|
hDirectory: HANDLE,
|
|
|
|
lpBuffer: [*]align(@alignOf(FILE_NOTIFY_INFORMATION)) u8,
|
|
|
|
nBufferLength: DWORD,
|
|
|
|
bWatchSubtree: BOOL,
|
|
|
|
dwNotifyFilter: DWORD,
|
|
|
|
lpBytesReturned: ?*DWORD,
|
|
|
|
lpOverlapped: ?*OVERLAPPED,
|
|
|
|
lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
|
|
|
|
) BOOL;
|
|
|
|
|
2018-07-20 20:37:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn ReadFile(
|
|
|
|
in_hFile: HANDLE,
|
2018-09-27 14:51:22 -07:00
|
|
|
out_lpBuffer: [*]u8,
|
2018-07-20 20:37:37 -07:00
|
|
|
in_nNumberOfBytesToRead: DWORD,
|
2018-08-08 13:55:19 -07:00
|
|
|
out_lpNumberOfBytesRead: ?*DWORD,
|
2018-07-20 20:37:37 -07:00
|
|
|
in_out_lpOverlapped: ?*OVERLAPPED,
|
|
|
|
) BOOL;
|
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn RemoveDirectoryW(lpPathName: [*]const u16) BOOL;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
2018-09-02 12:58:08 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) BOOL;
|
|
|
|
|
2018-07-20 20:37:37 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn SetFilePointerEx(
|
|
|
|
in_fFile: HANDLE,
|
|
|
|
in_liDistanceToMove: LARGE_INTEGER,
|
|
|
|
out_opt_ldNewFilePointer: ?*LARGE_INTEGER,
|
|
|
|
in_dwMoveMethod: DWORD,
|
|
|
|
) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn Sleep(dwMilliseconds: DWORD) void;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) BOOL;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) DWORD;
|
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn WriteFile(
|
|
|
|
in_hFile: HANDLE,
|
2018-09-27 14:51:22 -07:00
|
|
|
in_lpBuffer: [*]const u8,
|
2018-07-20 20:37:37 -07:00
|
|
|
in_nNumberOfBytesToWrite: DWORD,
|
|
|
|
out_lpNumberOfBytesWritten: ?*DWORD,
|
|
|
|
in_out_lpOverlapped: ?*OVERLAPPED,
|
|
|
|
) BOOL;
|
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) BOOL;
|
2018-08-08 12:05:57 -07:00
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn LoadLibraryW(lpLibFileName: [*]const u16) ?HMODULE;
|
2018-09-26 22:18:47 -07:00
|
|
|
|
2018-09-27 14:51:22 -07:00
|
|
|
pub extern "kernel32" stdcallcc fn GetProcAddress(hModule: HMODULE, lpProcName: [*]const u8) ?FARPROC;
|
2018-07-20 20:37:37 -07:00
|
|
|
|
|
|
|
pub extern "kernel32" stdcallcc fn FreeLibrary(hModule: HMODULE) BOOL;
|
2018-08-09 13:48:44 -07:00
|
|
|
|
2018-11-13 05:08:37 -08:00
|
|
|
pub const FILE_NOTIFY_INFORMATION = extern struct {
|
2018-08-09 13:48:44 -07:00
|
|
|
NextEntryOffset: DWORD,
|
|
|
|
Action: DWORD,
|
|
|
|
FileNameLength: DWORD,
|
|
|
|
FileName: [1]WCHAR,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const FILE_ACTION_ADDED = 0x00000001;
|
|
|
|
pub const FILE_ACTION_REMOVED = 0x00000002;
|
|
|
|
pub const FILE_ACTION_MODIFIED = 0x00000003;
|
|
|
|
pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
|
|
|
|
pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;
|
|
|
|
|
2018-08-20 21:46:42 -07:00
|
|
|
pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?extern fn (DWORD, DWORD, *OVERLAPPED) void;
|
2018-08-09 13:48:44 -07:00
|
|
|
|
|
|
|
pub const FILE_LIST_DIRECTORY = 1;
|
|
|
|
|
|
|
|
pub const FILE_NOTIFY_CHANGE_CREATION = 64;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_SIZE = 8;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_SECURITY = 256;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_LAST_ACCESS = 32;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_LAST_WRITE = 16;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_DIR_NAME = 2;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_FILE_NAME = 1;
|
|
|
|
pub const FILE_NOTIFY_CHANGE_ATTRIBUTES = 4;
|
2018-09-02 12:58:08 -07:00
|
|
|
|
2018-11-13 05:08:37 -08:00
|
|
|
pub const CONSOLE_SCREEN_BUFFER_INFO = extern struct {
|
2018-09-02 12:58:08 -07:00
|
|
|
dwSize: COORD,
|
|
|
|
dwCursorPosition: COORD,
|
|
|
|
wAttributes: WORD,
|
|
|
|
srWindow: SMALL_RECT,
|
|
|
|
dwMaximumWindowSize: COORD,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const FOREGROUND_BLUE = 1;
|
|
|
|
pub const FOREGROUND_GREEN = 2;
|
|
|
|
pub const FOREGROUND_RED = 4;
|
|
|
|
pub const FOREGROUND_INTENSITY = 8;
|