|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Visual Basic System Services Rundll32: The Rundll and Rundll32 Interface |
||
Posted: | Friday July 3, 1997 | |
Applies to: | Win95, Win98, WinNT4, Win2000 | |
Author: | Microsoft Knowledge Base Article Q164787 | |
Related: |
Rundll32: Control Panel Functions A-C Rundll32: Control Panel Functions D-F Rundll32: Control Panel Functions G-J Rundll32: Control Panel Functions K-N Rundll32: Control Panel Functions O-R Rundll32: Control Panel Functions S-Z |
|
RunnDLL and RunDLL32 |
Summary Win32 contains two command-line utility programs named Rundll.exe and Rundll32.exe that allow you to invoke a function exported from a DLL, either 16-bit or 32-bit. However, Rundll and Rundll32 programs do not allow you to call any exported function from any DLL. For example, you can not use these utility programs to call the Win32 API (Application Programming Interface) calls exported from the system DLLs. The programs only allow you to call functions from a DLL that are explicitly written to be called by them. This article provides more details on the use of Rundll and Rundll32 programs under Windows NT and Windows 95/98. The Rundll and Rundll32 utility programs were originally designed only for internal use at Microsoft. But the functionality provided by them is sufficiently generic that they are now available for general use. Note that Windows NT 4.0 ships only with the Rundll32 utility program and supports only Rundll32. RUNDLL.EXE <dllname>,<entrypoint> <optional arguments> An example is as follows: RUNDLL.EXE SETUPX.DLL,InstallHinfSection 132 C:\WINDOWS\INF\SHELL.INF There are 3 issues to consider carefully in the above command line:
void FAR PASCAL __loadds 32-bit DLL: void CALLBACK Again, there are 3 issues to consider with the EntryPoint function:
ARTICLE ID:
Q140485 hwnd - window handle that should be used as the owner
window for any windows your DLL creates In the following example: RUNDLL.EXE SETUPX.DLL,InstallHinfSection 132 C:\WINDOWS\INF\SHELL.INF Rundll would call the InstallHinfSection() entrypoint function in
Setupx.dll and pass it the following parameters: Note that it is the On Windows NT, the behavior of Rundll32.exe is slightly different, in order to accommodate UNICODE command lines. Windows NT first attempts to GetProcAddress for <EntryPoint>W. If this entry point is found, then the prototype is assumed to be: void CALLBACK This is the same as the ANSI EntryPoint, except that the lpszCmdLine parameter is now a UNICODE string. If the <EntryPoint>W entry point is not found, then Windows NT will GetProcAddress for <entrypoint>A and for <entrypoint>. If either is found, then it is considered an ANSI entry point and is treated the same way as Windows 95. Therefore, if you want your DLL to run on Windows 95 with ANSI support and on Windows NT with UNICODE support, you should export two functions: EntryPointW and EntryPoint. On Windows NT, the EntryPointW function will be called with a UNICODE command line; on Windows 95, the EntryPoint function will be called with an ANSI Command line. For an example on the usage of Rundll, refer to the following article on how to launch a Control Panel Applet in Windows 95 using the Rundll command line utility: ARTICLE ID: Q135068 |
|
Comments |
|
|
|
|||||
|
|||||
|
|||||
Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved. |