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 WIN_FUNC __attribute__((stdcall))
|
||||||
#define DEBUG_LOG(...) wibo::debug_log(__VA_ARGS__)
|
#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 {
|
namespace wibo {
|
||||||
extern uint32_t lastError;
|
extern uint32_t lastError;
|
||||||
extern char *commandLine;
|
extern char *commandLine;
|
||||||
|
|
|
@ -436,9 +436,6 @@ namespace kernel32 {
|
||||||
uint32_t dwReserved1;
|
uint32_t dwReserved1;
|
||||||
CharType cFileName[260];
|
CharType cFileName[260];
|
||||||
CharType cAlternateFileName[14];
|
CharType cAlternateFileName[14];
|
||||||
uint32_t dwFileType;
|
|
||||||
uint32_t dwCreatorType;
|
|
||||||
uint16_t wFinderFlags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void *WIN_FUNC FindFirstFileA(const char *lpFileName, WIN32_FIND_DATA<char> *lpFindFileData) {
|
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);
|
auto fileSize = std::filesystem::file_size(path);
|
||||||
lpFindFileData->nFileSizeHigh = (uint32_t)(fileSize >> 32);
|
lpFindFileData->nFileSizeHigh = (uint32_t)(fileSize >> 32);
|
||||||
lpFindFileData->nFileSizeLow = (uint32_t)fileSize;
|
lpFindFileData->nFileSizeLow = (uint32_t)fileSize;
|
||||||
assert(path.string().size() < 260);
|
auto fileName = path.filename().string();
|
||||||
strcpy(lpFindFileData->cFileName, path.c_str());
|
assert(fileName.size() < 260);
|
||||||
|
strcpy(lpFindFileData->cFileName, fileName.c_str());
|
||||||
strcpy(lpFindFileData->cAlternateFileName, "8P3FMTFN.BAD");
|
strcpy(lpFindFileData->cAlternateFileName, "8P3FMTFN.BAD");
|
||||||
lpFindFileData->dwFileType = lpFindFileData->dwCreatorType = lpFindFileData->wFinderFlags = 0;
|
|
||||||
return (void *) 1;
|
return (void *) 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,6 +465,7 @@ namespace kernel32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
int WIN_FUNC FindClose(void *hFindFile) {
|
int WIN_FUNC FindClose(void *hFindFile) {
|
||||||
|
DEBUG_LOG("FindClose\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,6 +719,7 @@ namespace kernel32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
int FileTimeToLocalFileTime(const FILETIME *lpFileTime, FILETIME *lpLocalFileTime) {
|
int FileTimeToLocalFileTime(const FILETIME *lpFileTime, FILETIME *lpLocalFileTime) {
|
||||||
|
DEBUG_LOG("FileTimeToLocalFileTime\n");
|
||||||
// we live on Iceland
|
// we live on Iceland
|
||||||
*lpLocalFileTime = *lpFileTime;
|
*lpLocalFileTime = *lpFileTime;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -737,6 +736,7 @@ namespace kernel32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
int WIN_FUNC GetTimeZoneInformation(TIME_ZONE_INFORMATION *lpTimeZoneInformation) {
|
int WIN_FUNC GetTimeZoneInformation(TIME_ZONE_INFORMATION *lpTimeZoneInformation) {
|
||||||
|
DEBUG_LOG("GetTimeZoneInformation\n");
|
||||||
memset(lpTimeZoneInformation, 0, sizeof(*lpTimeZoneInformation));
|
memset(lpTimeZoneInformation, 0, sizeof(*lpTimeZoneInformation));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -745,6 +745,7 @@ namespace kernel32 {
|
||||||
* Console Nonsense
|
* Console Nonsense
|
||||||
*/
|
*/
|
||||||
unsigned int WIN_FUNC SetConsoleCtrlHandler(void *HandlerRoutine, unsigned int Add) {
|
unsigned int WIN_FUNC SetConsoleCtrlHandler(void *HandlerRoutine, unsigned int Add) {
|
||||||
|
DEBUG_LOG("SetConsoleCtrlHandler\n");
|
||||||
// This is a function that gets called when doing ^C
|
// 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)
|
// 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, "FlsFree") == 0) return (void *) FlsFree;
|
||||||
// if (strcmp(lpProcName, "LCMapStringEx") == 0) return (void *) LCMapStringEx;
|
// if (strcmp(lpProcName, "LCMapStringEx") == 0) return (void *) LCMapStringEx;
|
||||||
// if (strcmp(lpProcName, "LocaleNameToLCID") == 0) return (void *) LocaleNameToLCID;
|
// if (strcmp(lpProcName, "LocaleNameToLCID") == 0) return (void *) LocaleNameToLCID;
|
||||||
|
if (strcmp(lpProcName, "MessageBoxA") == 0) return (void *) user32::MessageBoxA;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,9 +97,16 @@ namespace user32 {
|
||||||
DEBUG_LOG("returning: %s\n", lpBuffer);
|
DEBUG_LOG("returning: %s\n", lpBuffer);
|
||||||
return len;
|
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) {
|
void *wibo::resolveUser32(const char *name) {
|
||||||
if (strcmp(name, "LoadStringA") == 0) return (void *) user32::LoadStringA;
|
if (strcmp(name, "LoadStringA") == 0) return (void *) user32::LoadStringA;
|
||||||
|
if (strcmp(name, "MessageBoxA") == 0) return (void *) user32::MessageBoxA;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue