89 lines
2.8 KiB
C
89 lines
2.8 KiB
C
// Win32 user32 compatibility stubs. This file provides windowing and message APIs that applications may probe.
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <ntlite/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;
|
|
|
|
|
|
// Implements the user32 Debug Print A operation.
|
|
static void User32DebugPrintA(const char* s) {
|
|
if (!s) return;
|
|
SYS_PRINT_DEBUG_REQUEST req = { SysSvFromCstr(s) };
|
|
SysPrintDebug(&req);
|
|
}
|
|
|
|
// --- 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;
|
|
}
|
|
|
|
// Implements the end Paint operation.
|
|
__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;
|
|
}
|
|
// Returns message.
|
|
__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;
|
|
}
|
|
// Dispatches message.
|
|
__declspec(dllexport) int DispatchMessage(const void* m) { (void)m; return 0; }
|
|
// Translates message.
|
|
__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;
|
|
User32DebugPrintA("USER32: MessageBoxA: ");
|
|
User32DebugPrintA(txt);
|
|
User32DebugPrintA("\n");
|
|
return 1; // IDOK
|
|
}
|
|
|
|
// --- Window Queries ---.
|
|
__declspec(dllexport) HWND GetDesktopWindow(void) { return (HWND)0; }
|
|
// Returns active Window.
|
|
__declspec(dllexport) HWND GetActiveWindow(void) { return (HWND)0; }
|
|
// Returns top Window.
|
|
__declspec(dllexport) HWND GetTopWindow(HWND hwnd){ (void)hwnd; return (HWND)0; }
|
|
|
|
// Returns window.
|
|
__declspec(dllexport) HWND GetWindow(HWND hwnd, unsigned int cmd) {
|
|
(void)hwnd; (void)cmd; return (HWND)0;
|
|
}
|
|
|
|
// Returns window Long A.
|
|
__declspec(dllexport) long GetWindowLongA(HWND hwnd, int index) {
|
|
(void)hwnd; (void)index; return 0;
|
|
}
|
|
|
|
// Returns window Long Ptr A.
|
|
__declspec(dllexport) intptr_t GetWindowLongPtrA(HWND hwnd, int index) {
|
|
(void)hwnd; (void)index; return 0;
|
|
}
|
|
|
|
// Returns window Thread Process Id.
|
|
__declspec(dllexport) unsigned long GetWindowThreadProcessId(HWND hwnd, unsigned long* pid) {
|
|
(void)hwnd;
|
|
if (pid) *pid = 1;
|
|
return 1; // Thread ID
|
|
}
|