mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Add several NT functions (#1318)
With these addtions, I could build and run a [sokol](https://github.com/floooh/sokol) application (using OpenGL) on both Linux and Windows.
This commit is contained in:
parent
4e44517c9c
commit
baad1df71d
33 changed files with 618 additions and 0 deletions
18
libc/nt/user32/AdjustWindowRectEx.S
Normal file
18
libc/nt/user32/AdjustWindowRectEx.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_AdjustWindowRectEx,AdjustWindowRectEx
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
AdjustWindowRectEx:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_AdjustWindowRectEx(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn AdjustWindowRectEx,globl
|
||||
.previous
|
18
libc/nt/user32/ClientToScreen.S
Normal file
18
libc/nt/user32/ClientToScreen.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_ClientToScreen,ClientToScreen
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
ClientToScreen:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_ClientToScreen(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn ClientToScreen,globl
|
||||
.previous
|
20
libc/nt/user32/ClipCursor.S
Normal file
20
libc/nt/user32/ClipCursor.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_ClipCursor,ClipCursor
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
ClipCursor:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_ClipCursor(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn ClipCursor,globl
|
||||
.previous
|
19
libc/nt/user32/CloseClipboard.S
Normal file
19
libc/nt/user32/CloseClipboard.S
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_CloseClipboard,CloseClipboard
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
CloseClipboard:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
sub $32,%rsp
|
||||
call *__imp_CloseClipboard(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn CloseClipboard,globl
|
||||
.previous
|
19
libc/nt/user32/EmptyClipboard.S
Normal file
19
libc/nt/user32/EmptyClipboard.S
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_EmptyClipboard,EmptyClipboard
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
EmptyClipboard:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
sub $32,%rsp
|
||||
call *__imp_EmptyClipboard(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn EmptyClipboard,globl
|
||||
.previous
|
20
libc/nt/user32/GetAsyncKeyState.S
Normal file
20
libc/nt/user32/GetAsyncKeyState.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_GetAsyncKeyState,GetAsyncKeyState
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetAsyncKeyState:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_GetAsyncKeyState(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn GetAsyncKeyState,globl
|
||||
.previous
|
20
libc/nt/user32/GetClipboardData.S
Normal file
20
libc/nt/user32/GetClipboardData.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_GetClipboardData,GetClipboardData
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetClipboardData:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_GetClipboardData(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn GetClipboardData,globl
|
||||
.previous
|
18
libc/nt/user32/GetMonitorInfoW.S
Normal file
18
libc/nt/user32/GetMonitorInfoW.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_GetMonitorInfoW,GetMonitorInfoW
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetMonitorInfo:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_GetMonitorInfoW(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn GetMonitorInfo,globl
|
||||
.previous
|
18
libc/nt/user32/GetRawInputData.S
Normal file
18
libc/nt/user32/GetRawInputData.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_GetRawInputData,GetRawInputData
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetRawInputData:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_GetRawInputData(%rip),%rax
|
||||
jmp __sysv2nt6
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn GetRawInputData,globl
|
||||
.previous
|
20
libc/nt/user32/GetSystemMetrics.S
Normal file
20
libc/nt/user32/GetSystemMetrics.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_GetSystemMetrics,GetSystemMetrics
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
GetSystemMetrics:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_GetSystemMetrics(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn GetSystemMetrics,globl
|
||||
.previous
|
18
libc/nt/user32/MonitorFromPoint.S
Normal file
18
libc/nt/user32/MonitorFromPoint.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_MonitorFromPoint,MonitorFromPoint
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
MonitorFromPoint:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_MonitorFromPoint(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn MonitorFromPoint,globl
|
||||
.previous
|
18
libc/nt/user32/MonitorFromWindow.S
Normal file
18
libc/nt/user32/MonitorFromWindow.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_MonitorFromWindow,MonitorFromWindow
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
MonitorFromWindow:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_MonitorFromWindow(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn MonitorFromWindow,globl
|
||||
.previous
|
20
libc/nt/user32/OpenClipboard.S
Normal file
20
libc/nt/user32/OpenClipboard.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_OpenClipboard,OpenClipboard
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
OpenClipboard:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_OpenClipboard(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn OpenClipboard,globl
|
||||
.previous
|
18
libc/nt/user32/PostMessageW.S
Normal file
18
libc/nt/user32/PostMessageW.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_PostMessageW,PostMessageW
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
PostMessage:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_PostMessageW(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn PostMessage,globl
|
||||
.previous
|
18
libc/nt/user32/PtInRect.S
Normal file
18
libc/nt/user32/PtInRect.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_PtInRect,PtInRect
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
PtInRect:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_PtInRect(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn PtInRect,globl
|
||||
.previous
|
18
libc/nt/user32/RegisterRawInputDevices.S
Normal file
18
libc/nt/user32/RegisterRawInputDevices.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_RegisterRawInputDevices,RegisterRawInputDevices
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
RegisterRawInputDevices:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_RegisterRawInputDevices(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn RegisterRawInputDevices,globl
|
||||
.previous
|
18
libc/nt/user32/ScreenToClient.S
Normal file
18
libc/nt/user32/ScreenToClient.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_ScreenToClient,ScreenToClient
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
ScreenToClient:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_ScreenToClient(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn ScreenToClient,globl
|
||||
.previous
|
18
libc/nt/user32/SetClipboardData.S
Normal file
18
libc/nt/user32/SetClipboardData.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_SetClipboardData,SetClipboardData
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
SetClipboardData:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_SetClipboardData(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn SetClipboardData,globl
|
||||
.previous
|
18
libc/nt/user32/SetCursorPos.S
Normal file
18
libc/nt/user32/SetCursorPos.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_SetCursorPos,SetCursorPos
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
SetCursorPos:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_SetCursorPos(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn SetCursorPos,globl
|
||||
.previous
|
18
libc/nt/user32/SetWindowLongPtrW.S
Normal file
18
libc/nt/user32/SetWindowLongPtrW.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_SetWindowLongPtrW,SetWindowLongPtrW
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
SetWindowLongPtr:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_SetWindowLongPtrW(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn SetWindowLongPtr,globl
|
||||
.previous
|
20
libc/nt/user32/TrackMouseEvent.S
Normal file
20
libc/nt/user32/TrackMouseEvent.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_TrackMouseEvent,TrackMouseEvent
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
TrackMouseEvent:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_TrackMouseEvent(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn TrackMouseEvent,globl
|
||||
.previous
|
18
libc/nt/user32/UnregisterClassW.S
Normal file
18
libc/nt/user32/UnregisterClassW.S
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_UnregisterClassW,UnregisterClassW
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
UnregisterClass:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_UnregisterClassW(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn UnregisterClass,globl
|
||||
.previous
|
20
libc/nt/user32/WindowFromPoint.S
Normal file
20
libc/nt/user32/WindowFromPoint.S
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp user32,__imp_WindowFromPoint,WindowFromPoint
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
WindowFromPoint:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov %rdi,%rcx
|
||||
sub $32,%rsp
|
||||
call *__imp_WindowFromPoint(%rip)
|
||||
leave
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
#endif
|
||||
ret
|
||||
.endfn WindowFromPoint,globl
|
||||
.previous
|
Loading…
Add table
Add a link
Reference in a new issue