rundll32 is a small program (not a DLL) that comes with Microsoft Windows 95, 98, NT, 2000 etc. It is used to load a dynamic link library (DLL) and call an exported function (entry point) in the DLL.
The function to be called in the DLL must be written for this purpose. It is not possible to call the Windows API functions in the system DLL:s (kernel32, GDI32, user32 etc). The exception is shell32.dll, which exports some functions that can be called by rundll32.
More specifically, the function must have this prototype:
void CALLBACK EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow); (NT/2000 only)
void CALLBACK EntryPointW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow);
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
Executing this example will open the "Sound and Multimedia properties" control panel applet.
shell32.dll is the DLL that is loaded,
Control_RunDLL the function that is called and
mmsys.cpl is an argument that is passed to the function (in the
This will start the Format A:\ utility that is normally accessed by right-clicking the floppy drive icon. (It will not start formatting without asking...)
rundll32 is used a lot by the Windows shell (Explorer). Just open Regedit and search for "rundll32" for some more examples. It is mostly used when double-clicking certain files.
For more information, see the article Q164787 in the Microsoft Knowledge Base.