I'm trying to invoke Internet Options Control Panel applet through command line (Run dialogue). Specifically, the "Connections" tab.
I used the following syntax:
rundll32.exe shell32.dll,Control_RunDLL INETCPL.CPL,,4
Which worked fine. My question is 2-fold:
- For the "Control_RunDLL" function, what is the 2nd parameter it takes?
(In my cases, and in all the documentation I found, it's NULL or empty)
(1st parameter being the applet name, and the 3rd being the tab number)
- Where can I access Microsoft documentation that specifically mentions the 2nd parameter?
CodePudding user response:
After digging around some more, turns out a .cpl (a control panel item)[1] file can contain multiple applets (of which enumeration starts from 0).
The 2nd parameter is for the applet index number within a .cpl file, then the 3rd parameter is for the tab index number within the specific applet (as mentioned in my question).
References:
[2] https://www.walkernews.net/2007/06/06/quick-start-to-rundll32-syntax-and-example/
[5] https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj-shruncontrolpanel
CodePudding user response:
Control_RunDLL
is a private shell function, it is not documented. We still know its parameters because all rundll32 functions look like this:
void CALLBACK FunctionName(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
This means it is something deeper inside shell32 that parses the command line parameters.
As you found out on your own, .cpl files can support more than one control panel "applet":
When Control Panel loads a .dll (or .cpl) file, it calls the CPlApplet function to get information such as the number of Control Panel items the file hosts, as well as information about each item.
Shell32 simply pretends to be the control panel when it "hosts" a .cpl file.
The 2nd parameter is known as the "The dialog box number" in the documentation and is represented by a icon in the classic/all control panel view. The 3rd parameter is parsed by the applet itself in response to CPL_STARTWPARMS
and is often a name or number specifying a particular tab in a property sheet dialog.
The connections tab is documented as page 4 and the documented way to show it on Vista and later is
control.exe /name Microsoft.InternetOptions /page 4