#define WIN32_LEAN_AND_MEAN #define NOUSER #include #include #include #include "user32.h" #define DLL_EXPORT __declspec(dllexport) 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) GetProcAddress(GetModuleHandle("_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) GetProcAddress(GetModuleHandle("_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; }