mirror of https://github.com/decompals/wibo.git
MessageBoxA
This commit is contained in:
parent
ff947fb707
commit
42f2e6935e
4
common.h
4
common.h
|
@ -9,6 +9,10 @@
|
|||
#define WIN_FUNC __attribute__((stdcall))
|
||||
#define DEBUG_LOG(...) wibo::debug_log(__VA_ARGS__)
|
||||
|
||||
namespace user32 {
|
||||
int WIN_FUNC MessageBoxA(void *hwnd, const char *lpText, const char *lpCaption, unsigned int uType);
|
||||
}
|
||||
|
||||
namespace wibo {
|
||||
extern uint32_t lastError;
|
||||
extern char *commandLine;
|
||||
|
|
|
@ -436,9 +436,6 @@ namespace kernel32 {
|
|||
uint32_t dwReserved1;
|
||||
CharType cFileName[260];
|
||||
CharType cAlternateFileName[14];
|
||||
uint32_t dwFileType;
|
||||
uint32_t dwCreatorType;
|
||||
uint16_t wFinderFlags;
|
||||
};
|
||||
|
||||
void *WIN_FUNC FindFirstFileA(const char *lpFileName, WIN32_FIND_DATA<char> *lpFindFileData) {
|
||||
|
@ -456,10 +453,10 @@ namespace kernel32 {
|
|||
auto fileSize = std::filesystem::file_size(path);
|
||||
lpFindFileData->nFileSizeHigh = (uint32_t)(fileSize >> 32);
|
||||
lpFindFileData->nFileSizeLow = (uint32_t)fileSize;
|
||||
assert(path.string().size() < 260);
|
||||
strcpy(lpFindFileData->cFileName, path.c_str());
|
||||
auto fileName = path.filename().string();
|
||||
assert(fileName.size() < 260);
|
||||
strcpy(lpFindFileData->cFileName, fileName.c_str());
|
||||
strcpy(lpFindFileData->cAlternateFileName, "8P3FMTFN.BAD");
|
||||
lpFindFileData->dwFileType = lpFindFileData->dwCreatorType = lpFindFileData->wFinderFlags = 0;
|
||||
return (void *) 1;
|
||||
}
|
||||
|
||||
|
@ -468,6 +465,7 @@ namespace kernel32 {
|
|||
}
|
||||
|
||||
int WIN_FUNC FindClose(void *hFindFile) {
|
||||
DEBUG_LOG("FindClose\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -721,6 +719,7 @@ namespace kernel32 {
|
|||
}
|
||||
|
||||
int FileTimeToLocalFileTime(const FILETIME *lpFileTime, FILETIME *lpLocalFileTime) {
|
||||
DEBUG_LOG("FileTimeToLocalFileTime\n");
|
||||
// we live on Iceland
|
||||
*lpLocalFileTime = *lpFileTime;
|
||||
return 1;
|
||||
|
@ -737,6 +736,7 @@ namespace kernel32 {
|
|||
};
|
||||
|
||||
int WIN_FUNC GetTimeZoneInformation(TIME_ZONE_INFORMATION *lpTimeZoneInformation) {
|
||||
DEBUG_LOG("GetTimeZoneInformation\n");
|
||||
memset(lpTimeZoneInformation, 0, sizeof(*lpTimeZoneInformation));
|
||||
return 0;
|
||||
}
|
||||
|
@ -745,6 +745,7 @@ namespace kernel32 {
|
|||
* Console Nonsense
|
||||
*/
|
||||
unsigned int WIN_FUNC SetConsoleCtrlHandler(void *HandlerRoutine, unsigned int Add) {
|
||||
DEBUG_LOG("SetConsoleCtrlHandler\n");
|
||||
// This is a function that gets called when doing ^C
|
||||
// We might want to call this later (being mindful that it'll be stdcall I think)
|
||||
|
||||
|
@ -1127,6 +1128,7 @@ namespace kernel32 {
|
|||
// if (strcmp(lpProcName, "FlsFree") == 0) return (void *) FlsFree;
|
||||
// if (strcmp(lpProcName, "LCMapStringEx") == 0) return (void *) LCMapStringEx;
|
||||
// if (strcmp(lpProcName, "LocaleNameToLCID") == 0) return (void *) LocaleNameToLCID;
|
||||
if (strcmp(lpProcName, "MessageBoxA") == 0) return (void *) user32::MessageBoxA;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -97,9 +97,16 @@ namespace user32 {
|
|||
DEBUG_LOG("returning: %s\n", lpBuffer);
|
||||
return len;
|
||||
}
|
||||
|
||||
int WIN_FUNC MessageBoxA(void *hwnd, const char *lpText, const char *lpCaption, unsigned int uType) {
|
||||
printf("MESSAGE BOX: [%s] %s\n", lpCaption, lpText);
|
||||
fflush(stdout);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void *wibo::resolveUser32(const char *name) {
|
||||
if (strcmp(name, "LoadStringA") == 0) return (void *) user32::LoadStringA;
|
||||
if (strcmp(name, "MessageBoxA") == 0) return (void *) user32::MessageBoxA;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue