I am currently attempting to reverse engineer a simple function from within a 16-Bit Windows 3.1 (NE) DLL, which from what I can tell is used to display a message box when required.
I would assume that the two arguments of the ShowMessageBox
function are used to set the Title and Message (this is a DLL so I assume it doesn't bother with a HWND?). I can see that those two parameters get passed in and are pushed to the stack, but can't quite work out how they are passed into the system call.
Ghidra seems a little confused as the C source ignores the two parameters and passes in the two other values that are added into the stack (0x41
and 0x41b
).
I have added the following function signature into the MessageBox system call:
int MessageBox (HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, uint uType)
An example of the message box produced by this function is:
Any suggestions would be greatly appreciated.
The assembly and Ghidra generated C source are included below.
**************************************************************
* FUNCTION *
**************************************************************
void __cdecl16far ShowMessageBox(undefined param_1,undefined param_2)
assume DS = 0x1008
void <VOID> <RETURN>
undefined Stack[0x4]:1 param_1
undefined Stack[0x6]:1 param_2
1000:001c c8 00 00 00 ENTER 0x0,0x0
1000:0020 57 PUSH DI
1000:0021 56 PUSH SI
1000:0022 6a 00 PUSH 0x0
1000:0024 ff 76 08 PUSH word ptr [BP + param_2]
1000:0027 ff 76 06 PUSH word ptr [BP + param_1]
1000:002a 1e PUSH DS
1000:002b 68 1b 04 PUSH 0x41b
1000:002e 6a 41 PUSH 0x41
1000:0030 9a 5c 00 CALLF USER::MessageBox
18 10
1000:0035 e9 00 00 JMP LAB_1000_0038
void __cdecl16far ShowMessageBox(undefined param_1,undefined param_2)
{
HWND unaff_CS;
MessageBox(unaff_CS,(LPCTSTR)0x41,(LPCTSTR)0x41b,0x1008);
return;
}
Thanks, James.