Here is code of export function of a DLL that just adds two number and prints it to a MessageBox.
int Add(int a, int b)
{
OutputDebugString(L"add function called");
int sum = 0;
sum = a + b;
// MessageBoxA();
char buf[10];
_itoa(sum, buf, 10);
MessageBoxA(NULL, buf, "Caption", MB_OK);
When I pass the parameters to the exported function using rundll32 (command rundll32 dllName,Add 2 3), I get some junk number popped up in messagebox. But when I use Olldebugger to debug, I get the expected result which is the sum of numbers.
How do I correctly pass the parameters to the DLL export using rundll32?