We know that Windows DLL is not able to run independently, but Microsoft provides rundll32.exe for running DLLs.
First Test: Run "Rundll32.exe Shell32.dll,restartdialog", will pop up the restart dialog box. This same way you can turn on other features of the Windows system.
Here's how to define your own DLL to let Rundll32.exe run.
The DLL function prototype given by Microsoft is as follows:
void CALLBACK
EntryPoint (HWND hwnd, HINSTANCE hinst, LPSTR lpszcmdline, int ncmdshow);
Hwnd-window handle that should to used as the owner window for any
windows your DLL creates
hinst-your dll ' s I Nstance handle
lpszcmdline-asciiz command line your DLL should parse ncmdshow-describes the how
your DLL ' s windows should be displayed
The custom test DLL is as follows:
extern "C" _declspec (dllexport) void __cdecl Rundll32dllfun (HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine,
int nCmdShow)
{
MessageBox (NULL, "TEST", LPSZCMDLINE,MB_OK);
Return
}
Generate Dynamic Library Rundll32dll.dll.
Run:
Rundll32.exe "E:\demo\rudll32dll\Release\rudll32dll.dll", Rundll32dllfun
A familiar dialog box pops up, stating that the call was successful.
You can also pass in parameters and run:
Rundll32.exe "E:\demo\rudll32dll\Release\rudll32dll.dll", Rundll32dllfun 888
The dialog box pops up, and 888 shows the dialog box above, indicating that the parameter can also be passed, where the parameters are obtained in lpszCmdLine.
Run command description: rundll32.exe "Xxx.dll", dllfun parameter
This allows us to develop DLLs to run as applications, to see only rundll32.exe in the process, and to see which DLLs are running through the Process Viewer tool.
rundll32.exe where the location of the 4-bit system is described:
Windows/system32/rundll32.exe call 64-bit DLL
Windows/syswow64/rundll32.exe call 32-bit DLL
Microsoft's reference article is as follows: http://support2.microsoft.com/kb/164787