Files
BCompat/user32.c
T

25 lines
1.0 KiB
C

#include "common.h"
#include "user32.h"
typedef int (WINAPI *MessageBoxAPtr)(HWND hwnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
typedef int (WINAPI *MessageBoxWPtr)(HWND hwnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
DLL_EXPORT WINAPI int MessageBoxA(HWND hwnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) {
MessageBoxAPtr proc = (MessageBoxAPtr) getFunction("_user32.dll", "MessageBoxA");
LPSTR buffer = malloc(strlen(lpText) + 1 + 26);
strcpy(buffer, "MessageBoxA gruesst Sie!\n"),
strcat(buffer, lpText);
int result = proc(hwnd, buffer, lpCaption, uType);
free(buffer);
return result;
}
DLL_EXPORT WINAPI int MessageBoxW(HWND hwnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType) {
MessageBoxWPtr proc = (MessageBoxWPtr) getFunction("_user32.dll", "MessageBoxW");
LPWSTR buffer = malloc(wcslen(lpText) + 1 + 26);
wcscpy(buffer, L"MessageBoxW gruesst Sie!\n");
wcscat(buffer, lpText);
int result = proc(hwnd, buffer, lpCaption, uType);
free(buffer);
return result;
}