Add proper warning when building libbochs on 64bit

This commit is contained in:
pancake 2022-12-23 12:14:14 +01:00
parent 6ce2594102
commit e8a86a28e4
2 changed files with 9 additions and 5 deletions

View File

@ -772,13 +772,12 @@ R_API void r_cons_print_clear(void) {
}
R_API void r_cons_fill_line(void) {
char *p, white[1024];
char white[1024];
int cols = I->columns - 1;
if (cols < 1) {
return;
}
p = (cols >= sizeof (white))
? malloc (cols + 1): white;
char *p = (cols >= sizeof (white))? malloc (cols + 1): white;
if (p) {
memset (p, ' ', cols);
p[cols] = 0;

View File

@ -60,8 +60,13 @@ bool bochs_cmd_stop(libbochs_t * b) {
};
hKernel = GetModuleHandle (TEXT ("kernel32"));
FARPROC apiOffset = (FARPROC)GetProcAddress (hKernel, "GenerateConsoleCtrlEvent");
*((DWORD *)&buffer[20]) = (DWORD *)(size_t)apiOffset; // XXX
ExitCode = RunRemoteThread_(b, (const ut8*)&buffer, 0x1Eu, 0, &ExitCode) && ExitCode;
#if sizeof(DWORD) == 4
*((DWORD *)&buffer[20]) = (DWORD)(size_t)apiOffset;
#else
#warning this bochs shellcode is 32bit only
*((DWORD *)&buffer[20]) = 0;
#endif
ExitCode = RunRemoteThread_ (b, (const ut8*)&buffer, 0x1Eu, 0, &ExitCode) && ExitCode;
return ExitCode;
#else
return 0;