I have a DLL which exports a function:
__declspec(dllexport)
void __stdcall MyEntryPoint(char* params)
{
MessageBoxA("MyEntryPoint",params,0,0);
}
How can I use rundll32.exe to load my DLL and call MyEntryPoint()?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to define a function with a very specific signature in order for it to be callable by rundll32. Have a look at this blog entry for information, which includes details on how and why you may get crashes.
Also, take a look at this answer to a similar question, where the signature of the function is detailed.
Essentially for your function to be callable safely it would need to be defined as something like:
or
Anything else will corrupt the stack and may (or may not) cause a crash. I think that in later versions of Windows, rundll will first look for the
MyEntryPointWfunction, and if found call that – the difference is in the UnicodepszCmdLineparameter.For more information on how to use
rundll32, have a look at MSDN, which details what to expect for each of the parameters, etc.