Initial import
This commit is contained in:
43
libc/nt/nt/debug.h
Normal file
43
libc/nt/nt/debug.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_DEBUG_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_DEBUG_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » debugging ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
struct NtContext;
|
||||
|
||||
NtStatus NtContinue(struct NtContext *Context, int32_t TestAlert);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_DEBUG_H_ */
|
||||
81
libc/nt/nt/file.h
Normal file
81
libc/nt/nt/file.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_FILE_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_FILE_H_
|
||||
#include "libc/nt/enum/fileinformationclass.h"
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#include "libc/nt/typedef/ioapcroutine.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » files ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
struct NtIoStatusBlock;
|
||||
struct NtObjectAttributes;
|
||||
|
||||
NtStatus NtCreateFile(int64_t *out_FileHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes,
|
||||
struct NtIoStatusBlock *out_IoStatusBlock,
|
||||
int64_t *opt_AllocationSize, uint32_t FileAttributes,
|
||||
uint32_t ShareAccess, uint32_t CreateDisposition,
|
||||
uint32_t CreateOptions, void *opt_EaBuffer,
|
||||
uint32_t EaLength);
|
||||
NtStatus NtReadFile(int64_t FileHandle, void *opt_Event,
|
||||
NtIoApcRoutine opt_ApcRoutine, void *opt_ApcContext,
|
||||
struct NtIoStatusBlock *out_IoStatusBlock, void *out_Buffer,
|
||||
uint32_t Length, int64_t *opt_ByteOffset,
|
||||
uint32_t *opt_Key);
|
||||
NtStatus NtWriteFile(int64_t FileHandle, void *opt_Event,
|
||||
NtIoApcRoutine opt_ApcRoutine, void *opt_ApcContext,
|
||||
struct NtIoStatusBlock *out_IoStatusBlock,
|
||||
const void *Buffer, uint32_t Length,
|
||||
int64_t *opt_ByteOffset, uint32_t *opt_Key);
|
||||
NtStatus NtClose(int64_t handle);
|
||||
NtStatus NtDuplicateObject(int64_t SourceProcessHandle, void *SourceHandle,
|
||||
void *TargetProcessHandle,
|
||||
void **opt_out_TargetHandle, uint32_t DesiredAcess,
|
||||
uint32_t Atrributes, uint32_t options_t);
|
||||
NtStatus NtQueryInformationFile(int64_t FileHandle,
|
||||
struct NtIoStatusBlock *out_IoStatusBlock,
|
||||
void *out_FileInformation,
|
||||
uint32_t FileInformationLength,
|
||||
uint32_t FileInformationClass);
|
||||
NtStatus NtSetInformationFile(int64_t FileHandle,
|
||||
struct NtIoStatusBlock *out_IoStatusBlock,
|
||||
void *FileInformation,
|
||||
uint32_t FileInformationLength,
|
||||
uint32_t FileInformationClass);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/thunk/ntfile.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_FILE_H_ */
|
||||
52
libc/nt/nt/ipc.h
Normal file
52
libc/nt/nt/ipc.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_IPC_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_IPC_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » ipc ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
struct NtIoStatusBlock;
|
||||
struct NtObjectAttributes;
|
||||
|
||||
NtStatus NtCreateNamedPipeFile(int64_t *out_FileHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes,
|
||||
struct NtIoStatusBlock *out_IoStatusBlock,
|
||||
uint32_t ShareAccess, uint32_t CreateDisposition,
|
||||
uint32_t CreateOptions, int32_t TypeMessage,
|
||||
int32_t ReadmodeMessage, int32_t Nonblocking,
|
||||
uint32_t MaxInstances, uint32_t InBufferSize,
|
||||
uint32_t OutBufferSize,
|
||||
int64_t *opt_DefaultTimeout);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_IPC_H_ */
|
||||
58
libc/nt/nt/loader.h
Normal file
58
libc/nt/nt/loader.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_LOADER_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_LOADER_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/nt/typedef/wambda.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » loader ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
struct NtAnsiString;
|
||||
struct NtLdrDataTableEntry;
|
||||
struct NtUnicodeString;
|
||||
|
||||
const struct NtLdrDataTableEntry *NtGetModule(const char *basename) nothrow;
|
||||
|
||||
NtStatus LdrLoadDll(const char16_t *opt_PathToFile, uint32_t *opt_Flags,
|
||||
struct NtUnicodeString *ModuleFileName,
|
||||
void **out_ModuleHandle);
|
||||
NtStatus LdrUnloadDll(void *ModuleHandle);
|
||||
NtStatus LdrGetProcedureAddress(void *ModuleHandle,
|
||||
struct NtAnsiString *opt_ProcedureName,
|
||||
uint32_t opt_Ordinal,
|
||||
wambda *out_ProcedureAddress);
|
||||
NtStatus LdrGetDllHandle(const char16_t *opt_PathToFile, uint32_t opt_Unused,
|
||||
struct NtUnicodeString *ModuleFileName,
|
||||
void **out_ModuleHandle);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_LOADER_H_ */
|
||||
59
libc/nt/nt/memory.h
Normal file
59
libc/nt/nt/memory.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_MEMORY_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_MEMORY_H_
|
||||
#include "libc/nt/enum/memoryinformationclass.h"
|
||||
#include "libc/nt/enum/status.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » memory ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
NtStatus NtAllocateVirtualMemory(int64_t ProcessHandle,
|
||||
void **inout_BaseAddress, uint32_t dwZeroBits,
|
||||
uint32_t *inout_AllocationSize,
|
||||
uint32_t dwMemAllocationType,
|
||||
uint32_t dwPageProtect);
|
||||
NtStatus NtFreeVirtualMemory(int64_t ProcessHandle, void **inout_BaseAddress,
|
||||
size_t *inout_FreeSize, uint32_t FreeType);
|
||||
NtStatus NtQueryVirtualMemory(
|
||||
int64_t ProcessHandle, const void *BaseAddress,
|
||||
enum NtMemoryInformationClass MemoryInformationClass,
|
||||
void *out_MemoryInformation, size_t MemoryInformationLength,
|
||||
size_t *opt_out_ReturnLength);
|
||||
NtStatus NtProtectVirtualMemory(int64_t ProcessHandle, void **inout_BaseAddress,
|
||||
uint32_t *inout_ProtectSize,
|
||||
uint32_t NewProtect, uint32_t *out_OldProtect);
|
||||
NtStatus NtWriteVirtualMemory(int64_t ProcessHandle, void *BaseAddress,
|
||||
const void *Buffer, size_t BufferLength,
|
||||
size_t *opt_out_ReturnLength);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_MEMORY_H_ */
|
||||
87
libc/nt/nt/process.h
Normal file
87
libc/nt/nt/process.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_PROCESS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_PROCESS_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » processes ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
struct NtClientId;
|
||||
struct NtObjectAttributes;
|
||||
struct NtRtlUserProcessInformation;
|
||||
struct NtRtlUserProcessParameters;
|
||||
struct NtSecurityDescriptor;
|
||||
struct NtUnicodeString;
|
||||
|
||||
NtStatus NtCreateProcess(int64_t *out_ProcessHandle, uint32_t dwDesiredAccess,
|
||||
struct NtObjectAttributes *opt_ObjectAttributes,
|
||||
void *InheritFromProcessHandle, int32_t InheritHandles,
|
||||
void *opt_SectionHandle, void *opt_DebugPort,
|
||||
void *opt_ExceptionPort);
|
||||
NtStatus NtTerminateProcess(int64_t opt_ProcessHandle, int32_t ExitStatus);
|
||||
|
||||
NtStatus NtQueryInformationProcess(int64_t ProcessHandle,
|
||||
int ProcessInformationClass,
|
||||
void *out_ProcessInformation,
|
||||
uint32_t ProcessInformationLength,
|
||||
uint32_t *opt_out_ReturnLength);
|
||||
NtStatus NtOpenProcessToken(int64_t ProcessToken, uint32_t DesiredAccess,
|
||||
int64_t *out_TokenHandle);
|
||||
NtStatus NtOpenProcess(int64_t *out_ProcessHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes,
|
||||
struct NtClientId *ClientId);
|
||||
|
||||
NtStatus RtlCreateProcessParameters(
|
||||
struct NtRtlUserProcessParameters **out_ProcessParameters,
|
||||
struct NtUnicodeString *ImageFile, struct NtUnicodeString *opt_DllPath,
|
||||
struct NtUnicodeString *opt_CurrentDirectory,
|
||||
struct NtUnicodeString *opt_CommandLine, uint32_t CreationFlags,
|
||||
struct NtUnicodeString *opt_WindowTitle,
|
||||
struct NtUnicodeString *opt_Desktop, struct NtUnicodeString *opt_Reserved,
|
||||
struct NtUnicodeString *opt_Reserved2);
|
||||
|
||||
NtStatus RtlDestroyProcessParameters(
|
||||
struct NtRtlUserProcessParameters *ProcessParameters);
|
||||
|
||||
NtStatus RtlCloneUserProcess(
|
||||
uint32_t ProcessFlags,
|
||||
struct NtSecurityDescriptor *opt_ProcessSecurityDescriptor,
|
||||
struct NtSecurityDescriptor *opt_ThreadSecurityDescriptor,
|
||||
void *opt_DebugPort,
|
||||
struct NtRtlUserProcessInformation *ProcessInformation);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/nt/thunk/process.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_PROCESS_H_ */
|
||||
32
libc/nt/nt/sections.h
Normal file
32
libc/nt/nt/sections.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_SECTIONS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_SECTIONS_H_
|
||||
#include "libc/nt/enum/sectioninformationclass.h"
|
||||
#include "libc/nt/enum/sectioninherit.h"
|
||||
#include "libc/nt/enum/status.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct NtObjectAttributes;
|
||||
|
||||
NtStatus NtCreateSection(int64_t *out_SectionHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes,
|
||||
int64_t *opt_SectionSize, uint32_t Protect,
|
||||
uint32_t Attributes, int64_t FileHandle);
|
||||
NtStatus NtOpenSection(int64_t *out_SectionHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes);
|
||||
NtStatus NtMapViewOfSection(int64_t SectionHandle, int64_t ProcessHandle,
|
||||
void **inout_BaseAddress, uint32_t *ZeroBits,
|
||||
size_t CommitSize, int64_t *opt_inout_SectionOffset,
|
||||
size_t *inout_ViewSize,
|
||||
enum NtSectionInherit InheritDisposition,
|
||||
uint32_t AllocationType, uint32_t Protect);
|
||||
NtStatus NtUnmapViewOfSection(int64_t ProcessHandle, void *BaseAddress);
|
||||
NtStatus NtQuerySection(int64_t SectionHandle,
|
||||
enum NtSectionInformationClass SectionInformationClass,
|
||||
void *out_SectionInformation,
|
||||
uint32_t SectionInformationLength,
|
||||
uint32_t *opt_out_ResultLength);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_SECTIONS_H_ */
|
||||
42
libc/nt/nt/signing.h
Normal file
42
libc/nt/nt/signing.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_SIGNING_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_SIGNING_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » code signing ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
NtStatus CsrClientCallServer(void *inout_Message, void *unknown,
|
||||
uint32_t Opcode, uint32_t Size);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_SIGNING_H_ */
|
||||
23
libc/nt/nt/systemthreads.h
Normal file
23
libc/nt/nt/systemthreads.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_SYSTEMTHREADS_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_SYSTEMTHREADS_H_
|
||||
#include "libc/nt/enum/kwaitreason.h"
|
||||
#include "libc/nt/enum/threadstate.h"
|
||||
#include "libc/nt/struct/clientid.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
struct NtSystemThreads {
|
||||
int64_t KernelTime;
|
||||
int64_t UserTime;
|
||||
int64_t CreateTime;
|
||||
uint32_t WaitTime;
|
||||
void *StartAddress;
|
||||
struct NtClientId ClientId;
|
||||
int32_t Priority;
|
||||
int32_t BasePriority;
|
||||
uint32_t ContextSwitchCount;
|
||||
enum NtThreadState State;
|
||||
uint32_t WaitReason;
|
||||
};
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_SYSTEMTHREADS_H_ */
|
||||
79
libc/nt/nt/thread.h
Normal file
79
libc/nt/nt/thread.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_THREAD_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_THREAD_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/nt/enum/threadinfoclass.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » threads ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
struct NtClientId;
|
||||
struct NtContext;
|
||||
struct NtObjectAttributes;
|
||||
struct NtUserStack;
|
||||
|
||||
NtStatus NtCreateThread(int64_t *out_ThreadHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes,
|
||||
int64_t ProcessHandle, struct NtClientId *out_ClientId,
|
||||
struct NtContext *ThreadContext,
|
||||
struct NtUserStack *UserStack, int32_t CreateSuspended);
|
||||
|
||||
NtStatus NtTerminateThread(void *opt_ThreadHandle, int32_t ExitStatus);
|
||||
|
||||
NtStatus NtOpenThread(int64_t *out_ThreadHandle, uint32_t DesiredAccess,
|
||||
struct NtObjectAttributes *ObjectAttributes,
|
||||
struct NtClientId *ClientId);
|
||||
|
||||
NtStatus NtQueryInformationThread(int64_t ThreadHandle,
|
||||
enum NtThreadInfoClass ThreadInformationClass,
|
||||
void *out_ThreadInformation,
|
||||
uint32_t ThreadInformationLength,
|
||||
uint32_t *opt_out_ReturnLength);
|
||||
|
||||
NtStatus NtGetContextThread(int64_t ThreadHandle,
|
||||
struct NtContext *out_Context);
|
||||
NtStatus NtSetContextThread(int64_t ThreadHandle, struct NtContext *Context);
|
||||
NtStatus NtSuspendThread(int64_t ThreadHandle,
|
||||
uint32_t *opt_out_PreviousSuspendCount);
|
||||
NtStatus NtResumeThread(int64_t ThreadHandle,
|
||||
uint32_t *opt_out_PreviousSuspendCount);
|
||||
|
||||
NtStatus NtOpenThreadToken(int64_t ThreadHandle, uint32_t DesiredAccess,
|
||||
int32_t OpenAsSelf, int64_t *out_TokenHandle);
|
||||
|
||||
NtStatus NtSetInformationThread(int64_t ThreadHandle,
|
||||
enum NtThreadInfoClass ThreadInformationClass,
|
||||
void *ThreadInformation,
|
||||
uint32_t ThreadInformationLength);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_THREAD_H_ */
|
||||
5
libc/nt/nt/thunk/process.inc
Normal file
5
libc/nt/nt/thunk/process.inc
Normal file
@@ -0,0 +1,5 @@
|
||||
#define NtQueryInformationProcess(...) \
|
||||
__imp_NtQueryInformationProcess(__VA_ARGS__)
|
||||
|
||||
extern typeof(NtQueryInformationProcess) *const
|
||||
__imp_NtQueryInformationProcess __msabi;
|
||||
3
libc/nt/nt/thunk/time.inc
Normal file
3
libc/nt/nt/thunk/time.inc
Normal file
@@ -0,0 +1,3 @@
|
||||
#define NtDelayExecution(...) __imp_NtDelayExecution(__VA_ARGS__)
|
||||
|
||||
extern typeof(NtDelayExecution) *const __imp_NtDelayExecution __msabi;
|
||||
45
libc/nt/nt/time.h
Normal file
45
libc/nt/nt/time.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_NT_NT_THREAD_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_NT_THREAD_H_
|
||||
#include "libc/nt/enum/status.h"
|
||||
#include "libc/nt/thunk/msabi.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
#if 0
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » beyond the pale » time ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│─╝
|
||||
“The functions and structures in [for these APIs] are internal to
|
||||
the operating system and subject to change from one release of
|
||||
Windows to the next, and possibly even between service packs for
|
||||
each release.” ──Quoth MSDN */
|
||||
#endif
|
||||
|
||||
NtStatus NtDelayExecution(bool32 alertable, int64_t *hectonanoseconds);
|
||||
|
||||
#if ShouldUseMsabiAttribute()
|
||||
#include "libc/nt/nt/thunk/time.inc"
|
||||
#endif /* ShouldUseMsabiAttribute() */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_NT_THREAD_H_ */
|
||||
Reference in New Issue
Block a user