Files
nt-lite/code/win32/user32.c
T

70 lines
2.3 KiB
C

// user32.c - Win32 User Interface
#include <stdint.h>
#include <stddef.h>
#include <syscall.h>
typedef void* HWND;
typedef void* HDC;
typedef long LONG;
typedef int BOOL;
typedef struct _RECT { LONG left, top, right, bottom; } RECT;
typedef struct tagPAINTSTRUCT {
HDC hdc; BOOL fErase; RECT rcPaint; BOOL fRestore; BOOL fIncUpdate; char res[32];
} PAINTSTRUCT;
// --- Painting Functions ---
__declspec(dllexport) HDC BeginPaint(HWND hwnd, PAINTSTRUCT* lpPaint) {
(void)hwnd;
if (lpPaint) {
lpPaint->hdc = (HDC)1;
lpPaint->rcPaint.right = 1920; lpPaint->rcPaint.bottom = 1080;
}
return (HDC)1;
}
__declspec(dllexport) BOOL EndPaint(HWND hwnd, const PAINTSTRUCT* lp) { (void)hwnd; (void)lp; return 1; }
// --- Message Loop Stubs ---
__declspec(dllexport) int GetMessage(void* m, HWND h, uint32_t f, uint32_t l) {
(void)m; (void)h; (void)f; (void)l; SysYield(); return 0;
}
__declspec(dllexport) int PeekMessage(void* m, HWND h, uint32_t f, uint32_t l, uint32_t r) {
(void)m; (void)h; (void)f; (void)l; (void)r;
return 0;
}
__declspec(dllexport) int DispatchMessage(const void* m) { (void)m; return 0; }
__declspec(dllexport) int TranslateMessage(const void* m) { (void)m; return 0; }
// --- Dialogs & UI ---
__declspec(dllexport) int MessageBoxA(HWND h, const char* txt, const char* cap, uint32_t type) {
(void)h; (void)cap; (void)type;
SysDebugPrint("USER32: MessageBoxA: ");
SysDebugPrint(txt);
SysDebugPrint("\n");
return 1; // IDOK
}
// --- Window Queries ---
__declspec(dllexport) HWND GetDesktopWindow(void) { return (HWND)0; }
__declspec(dllexport) HWND GetActiveWindow(void) { return (HWND)0; }
__declspec(dllexport) HWND GetTopWindow(HWND hwnd){ (void)hwnd; return (HWND)0; }
__declspec(dllexport) HWND GetWindow(HWND hwnd, unsigned int cmd) {
(void)hwnd; (void)cmd; return (HWND)0;
}
__declspec(dllexport) long GetWindowLongA(HWND hwnd, int index) {
(void)hwnd; (void)index; return 0;
}
__declspec(dllexport) intptr_t GetWindowLongPtrA(HWND hwnd, int index) {
(void)hwnd; (void)index; return 0;
}
__declspec(dllexport) unsigned long GetWindowThreadProcessId(HWND hwnd, unsigned long* pid) {
(void)hwnd;
if (pid) *pid = 1;
return 1; // Thread ID
}