mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Merge fb05588ebc
into f1e83d5240
This commit is contained in:
commit
ad88f50a30
8 changed files with 110 additions and 0 deletions
|
@ -381,6 +381,9 @@
|
|||
#define _FILE_STREAM_INFORMATION NtFileStreamInformation
|
||||
#define FILE_STREAM_INFORMATION struct NtFileStreamInformation
|
||||
#define PFILE_STREAM_INFORMATION struct NtFileStreamInformation*
|
||||
#define _FILE_NOTIFY_INFORMATION NtFileNotifyInformation
|
||||
#define FILE_NOTIFY_INFORMATION struct NtFileNotifyInformation
|
||||
#define PFILE_NOTIFY_INFORMATION struct NtFileNotifyInformation*
|
||||
#define _KERNEL_USER_TIMES NtKernelUserTimes
|
||||
#define KERNEL_USER_TIMES struct NtKernelUserTimes
|
||||
#define PKERNEL_USER_TIMES struct NtKernelUserTimes*
|
||||
|
@ -662,6 +665,16 @@
|
|||
#define FILE_SHARE_WRITE kNtFileShareWrite
|
||||
#define FILE_SHARE_DELETE kNtFileShareDelete
|
||||
|
||||
#include "libc/nt/enum/filenotify.h"
|
||||
#define FILE_NOTIFY_CHANGE_FILE_NAME kNtFileNotifyChangeFileName
|
||||
#define FILE_NOTIFY_CHANGE_DIR_NAME kNtFileNotifyChangeDirName
|
||||
#define FILE_NOTIFY_CHANGE_ATTRIBUTES kNtFileNotifyChangeAttributes
|
||||
#define FILE_NOTIFY_CHANGE_SIZE kNtFileNotifyChangeSize
|
||||
#define FILE_NOTIFY_CHANGE_LAST_WRITE kNtFileNotifyChangeLastWrite
|
||||
#define FILE_NOTIFY_CHANGE_LAST_ACCESS kNtFileNotifyChangeLastAccess
|
||||
#define FILE_NOTIFY_CHANGE_CREATION kNtFileNotifyChangeCreation
|
||||
#define FILE_NOTIFY_CHANGE_SECURITY kNtFileNotifyChangeSecurity
|
||||
|
||||
#include "libc/nt/runtime.h"
|
||||
#define INVALID_HANDLE_VALUE kNtInvalidHandleValue
|
||||
#define STD_INPUT_HANDLE kNtStdInputHandle
|
||||
|
@ -1361,6 +1374,9 @@
|
|||
|
||||
#define WSAEVENT HANDLE
|
||||
#define GROUP uint32_t
|
||||
#define _OVERLAPPED NtOverlapped
|
||||
#define OVERLAPPED struct NtOverlapped
|
||||
#define LOVERLAPPED struct NtOverlapped*
|
||||
#define WSAOVERLAPPED OVERLAPPED
|
||||
#define INVALID_SOCKET -1ULL
|
||||
#define SOCKET_ERROR -1
|
||||
|
|
39
libc/nt/base.h
Normal file
39
libc/nt/base.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_BASE_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_BASE_H_
|
||||
#include "struct/overlapped.h"
|
||||
/* ░░░░
|
||||
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
||||
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
||||
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
||||
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
||||
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
||||
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
||||
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
||||
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
||||
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
||||
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
||||
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
||||
│ cosmopolitan § new technology » string ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
typedef void (*NtOverlappedCompletionRoutine)(
|
||||
uint32_t dwErrorCode, uint32_t dwNumberOfBytesTransfered,
|
||||
struct NtOverlapped *lpOverlapped);
|
||||
|
||||
|
||||
uint32_t FormatMessageW(uint32_t dwFlags, const void* lpSource, uint32_t dwMessageId, uint32_t dwLanguageId, char16_t *lpBuffer, uint32_t nSize, va_list *Arguments);
|
||||
bool32 ReadDirectoryChangesW(int64_t hDirectory, void *lpBuffer, uint32_t nBufferLength, bool32 bWatchSubtree, uint32_t dwNotifyFilter, uint32_t *lpBytesReturned, struct NtOverlapped *lpOverlapped, NtOverlappedCompletionRoutine lpCompletionRoutine);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_BASE_H_ */
|
13
libc/nt/enum/filenotify.h
Normal file
13
libc/nt/enum/filenotify.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_FILENOTIFY_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_ENUM_FILENOTIFY_H_
|
||||
|
||||
#define kNtFileNotifyChangeFileName 0x00000001
|
||||
#define kNtFileNotifyChangeDirName 0x00000002
|
||||
#define kNtFileNotifyChangeAttributes 0x00000004
|
||||
#define kNtFileNotifyChangeSize 0x00000008
|
||||
#define kNtFileNotifyChangeLastWrite 0x00000010
|
||||
#define kNtFileNotifyChangeLastAccess 0x00000020
|
||||
#define kNtFileNotifyChangeCreation 0x00000040
|
||||
#define kNtFileNotifyChangeSecurity 0x00000100
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_FILENOTIFY_H_ */
|
|
@ -49,6 +49,7 @@ COSMOPOLITAN_C_START_
|
|||
intptr_t LoadResource(int64_t hModule, int64_t hResInfo);
|
||||
uint32_t SetHandleCount(uint32_t uNumber);
|
||||
uint32_t GetLogicalDrives(void);
|
||||
unsigned int GetDriveTypeA(const char *lpRootPathName);
|
||||
uint32_t GetLogicalDriveStringsA(uint32_t nBufferLength, char *lpBuffer);
|
||||
bool32 FlushFileBuffers(int64_t hFile);
|
||||
|
||||
|
|
20
libc/nt/kernel32/GetDriveTypeA.S
Normal file
20
libc/nt/kernel32/GetDriveTypeA.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp kernel32,__imp_GetDriveTypeA,GetDriveTypeA
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetDriveTypeA:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_GetDriveTypeA(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn GetDriveTypeA,globl
|
||||
.previous
|
18
libc/nt/kernel32/ReadDirectoryChangesW.S
Normal file
18
libc/nt/kernel32/ReadDirectoryChangesW.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp kernel32,__imp_ReadDirectoryChangesW,ReadDirectoryChangesW
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
ReadDirectoryChanges:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_ReadDirectoryChangesW(%rip),%rax
|
||||
jmp __sysv2nt8
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn ReadDirectoryChanges,globl
|
||||
.previous
|
|
@ -117,6 +117,7 @@ imp 'GetCurrentProcessorNumberEx' GetCurrentProcessorNumberEx kernel32 1
|
|||
imp 'GetCurrentThread' GetCurrentThread kernel32 0
|
||||
imp 'GetCurrentThreadId' GetCurrentThreadId kernel32 0
|
||||
imp 'GetDynamicTimeZoneInformation' GetDynamicTimeZoneInformation kernel32 1
|
||||
imp 'GetDriveTypeA' GetDriveTypeA kernel32 1
|
||||
imp 'GetEnvironmentStrings' GetEnvironmentStringsW kernel32 1
|
||||
imp 'GetEnvironmentVariable' GetEnvironmentVariableW kernel32 3
|
||||
imp 'GetExitCodeThread' GetExitCodeThread kernel32 2
|
||||
|
@ -239,6 +240,7 @@ imp 'ReadConsoleOutputCharacter' ReadConsoleOutputCharacterW kernel32 5
|
|||
imp 'ReadFile' ReadFile kernel32 5
|
||||
imp 'ReadFileEx' ReadFileEx kernel32 5
|
||||
imp 'ReadFileScatter' ReadFileScatter kernel32 5
|
||||
imp 'ReadDirectoryChanges' ReadDirectoryChangesW kernel32 8
|
||||
imp 'RegisterWaitForSingleObject' RegisterWaitForSingleObject kernel32 6
|
||||
imp 'ReleaseMutex' ReleaseMutex kernel32 1
|
||||
imp 'ReleaseSRWLockExclusive' ReleaseSRWLockExclusive kernel32 1
|
||||
|
|
|
@ -94,6 +94,7 @@ int WideCharToMultiByte(unsigned int CodePage, uint32_t dwFlags,
|
|||
uint16_t *lpWideCharStr, int cchWideChar,
|
||||
char *lpMultiByteStr, int cbMultiByte,
|
||||
uint16_t *lpDefaultChar, int *lpUsedDefaultChar);
|
||||
int MutliByteToWideChar(unsigned int CodePage, uint32_t dwFlags, const char *lpMultiByteStr, int cbMultiByte, uint16_t *lpWideCharStr, int cchWideChar);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_WINDOWS_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue