On Windows XP and Vista, I can run this code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL bResult = FALSE;
ZeroMemory(&pi, sizeof(pi));
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
bResult = CreateProcess(NULL,
"rundll32.exe shell32.dll,Control_RunDLL modem.cpl",
NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&si, &pi);
if (bResult)
{
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
and it works as I would expect, i.e. WaitForSingleObject does not return until the user closes the modem control panel window.
In Windows 7, the same code, WaitForSingleObject returns immediately (with a return code of 0, indicating that the object signaled the requested state).
Similarly, if I take it on the command line, on XP and Vista I can run
start /wait rundll32.exe shell32.dll,Control_RunDLL modem.cpl
and it does not return command line control until the control panel window is closed, but in Windows 7 it will immediately return.
RunDll32? , MS RunDll32 Windows 7 UAC, , . , , , , , , , rundll32.
? , .