https://bugs.winehq.org/show_bug.cgi?id=49745
Bug ID: 49745 Summary: SHRunControlPanel implementation Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: shell32 Assignee: wine-bugs@winehq.org Reporter: contact@kcsoftwares.com Distribution: ---
SHRunControlPanel is currently only a stub. I propose an implementation based on ShellExecuteW :
[Shellord.c]
BOOL WINAPI SHRunControlPanel (LPCWSTR commandLine, HWND parent) { HINSTANCE hr; TRACE("SHRunControlPanel(%s, %p)n", debugstr_w(commandLine), parent); hr = ShellExecuteW(parent, NULL, commandLine, NULL, NULL, SW_NORMAL); return ((int)hr > 32); }
https://bugs.winehq.org/show_bug.cgi?id=49745
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- What do you need it for? Does it work on Windows 7/8/10 ?
https://bugs.winehq.org/show_bug.cgi?id=49745
--- Comment #2 from Kyle_Katarn contact@kcsoftwares.com --- See : https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj-shruncon... (This function is not supported as of Windows Vista)
But i need it for WinXP compatibility. And this proposal is a viable minimal implementation (current design is just an empty stub doing nothing and returning false)
https://bugs.winehq.org/show_bug.cgi?id=49745
--- Comment #3 from Kyle_Katarn contact@kcsoftwares.com --- (In reply to Kyle_Katarn from comment #2)
See : https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj- shruncontrolpanel (This function is not supported as of Windows Vista)
But i need it for WinXP compatibility. And this proposal is a viable minimal implementation (current design is just an empty stub doing nothing and returning false)
More precisely, i intend to have it used in ReactOS with WinXP compatibility.
https://bugs.winehq.org/show_bug.cgi?id=49745
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Kyle_Katarn from comment #3)
(In reply to Kyle_Katarn from comment #2)
See : https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj- shruncontrolpanel (This function is not supported as of Windows Vista)
But i need it for WinXP compatibility. And this proposal is a viable minimal implementation (current design is just an empty stub doing nothing and returning false)
More precisely, i intend to have it used in ReactOS with WinXP compatibility.
Okay. Could you verify if SHRunControlPanel("sample.txt") starts notepad on winxp as a simple test showing that shellexecute with no additional filtering is appropriate.
https://bugs.winehq.org/show_bug.cgi?id=49745
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
https://bugs.winehq.org/show_bug.cgi?id=49745
--- Comment #5 from Kyle_Katarn contact@kcsoftwares.com --- I will test later but any way, a MVP is better than a stub, right ?
Here comes a better desgin solution :
//TODO: 'If the specified Control Panel item is already running, SHRunControlPanel attempts to switch to that instance rather than opening a new instance.' /TODO: This function is not supported as of Windows Vista and as of Windows Vista, this function always returns FALSE (https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj-shruncon... )
TRACE("(%s, %p)n", debugstr_w(commandLine), parent); WCHAR parameters[MAX_PATH] = L"shell32.dll,Control_RunDLL "; wcscat(parameters, commandLine); return ((INT_PTR)ShellExecuteW(parent, L"open", L"rundll32.exe", parameters, NULL, SW_SHOWNORMAL) > 32);
https://bugs.winehq.org/show_bug.cgi?id=49745
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEEDINFO Ever confirmed|0 |1
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Kyle_Katarn from comment #5)
TRACE("(%s, %p)n", debugstr_w(commandLine), parent); WCHAR parameters[MAX_PATH] = L"shell32.dll,Control_RunDLL "; wcscat(parameters, commandLine); return ((INT_PTR)ShellExecuteW(parent, L"open", L"rundll32.exe", parameters, NULL, SW_SHOWNORMAL) > 32);
Yes, that's probably fine. You might as well put whole command line as third argument. At the same time you might as well use same couple of lines instead of SHRunControlPanel(), which looks stubbed out in current Windows versions.