Resurrect <windows.h> as <windowsesque.h>

This commit is contained in:
Justine Tunney 2024-02-21 16:40:32 -08:00
parent 68b9479f0c
commit 3eb405e0e2
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 4340 additions and 0 deletions

4296
libc/isystem/windowsesque.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,7 @@ COSMOPOLITAN_C_START_
*/
int64_t LoadLibrary(const char16_t *lpLibFileName);
int64_t LoadLibraryA(const char *lpLibFileName);
int64_t LoadLibraryEx(const char16_t *lpLibFileName, int64_t hFile,
uint32_t dwFlags);
uint32_t GetModuleFileNameA(int64_t hModule, char *lpFilename, uint32_t nSize);

View file

@ -57,6 +57,9 @@ int32_t DeregisterEventSource(uint64_t handle);
int64_t CreateEvent(const struct NtSecurityAttributes *opt_lpEventAttributes,
bool32 bManualReset, bool32 bInitialState,
const char16_t *opt_lpName);
int64_t CreateEventA(const struct NtSecurityAttributes *opt_lpEventAttributes,
bool32 bManualReset, bool32 bInitialState,
const char *opt_lpName);
int64_t CreateEventEx(const struct NtSecurityAttributes *lpEventAttributes,
const char16_t *lpName, uint32_t dwFlags,
uint32_t dwDesiredAccess);

View file

@ -0,0 +1,18 @@
#include "libc/nt/codegen.h"
.imp kernel32,__imp_CreateEventA,CreateEventA
.text.windows
.ftrace1
CreateEventA:
.ftrace2
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
mov __imp_CreateEventA(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn CreateEventA,globl
.previous

View file

@ -0,0 +1,20 @@
#include "libc/nt/codegen.h"
.imp kernel32,__imp_LoadLibraryA,LoadLibraryA
.text.windows
.ftrace1
LoadLibraryA:
.ftrace2
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
mov %rdi,%rcx
sub $32,%rsp
call *__imp_LoadLibraryA(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn LoadLibraryA,globl
.previous

View file

@ -63,6 +63,7 @@ imp 'ConnectNamedPipe' ConnectNamedPipe kernel32 2
imp 'ContinueDebugEvent' ContinueDebugEvent kernel32 3
imp 'CopyFile' CopyFileW kernel32 3
imp 'CreateEvent' CreateEventW kernel32 4
imp 'CreateEventA' CreateEventA kernel32 4
imp 'CreateEventEx' CreateEventExW kernel32 4
imp 'CreateHardLink' CreateHardLinkW kernel32 3
imp 'CreateIoCompletionPort' CreateIoCompletionPort kernel32 4
@ -195,6 +196,7 @@ imp 'InitializeProcThreadAttributeList' InitializeProcThreadAttributeList ke
imp 'InitializeSRWLock' InitializeSRWLock kernel32 1
imp 'LeaveCriticalSection' LeaveCriticalSection kernel32 1
imp 'LoadLibrary' LoadLibraryW kernel32 1
imp 'LoadLibraryA' LoadLibraryA kernel32 1
imp 'LoadLibraryEx' LoadLibraryExW kernel32 3
imp 'LoadResource' LoadResource kernel32 2
imp 'LocalFree' LocalFree kernel32 1