[PATCH v6 0/3] MR11709: Fix GUID paths not being accepted by ShellExecute and explorer's command-line arguments
This works on Windows, but was broken in WINE: {width=731 height=600} {width=731 height=600} The three patches belong together because `ShellExecute` invokes explorer. -- v6: shell32: Fix ShellExecute not accepting GUID shell folder paths explorer: Fix GUID shell folder paths not being accepted on command line shell32/tests: Add test for ShellExecute with GUID shell folder path https://gitlab.winehq.org/wine/wine/-/merge_requests/11709
From: Andrea Faulds <ajf@ajf.me> --- dlls/shell32/tests/shlexec.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 336dfbef4fe..3ff9c33a873 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -3034,6 +3034,35 @@ static void test_directory(void) SetCurrentDirectoryA(curdir); } +static void test_guid(void) +{ + todo_wine { + /* try to open My Computer's shell folder by its GUID */ + + BOOL result; + SHELLEXECUTEINFOW sei = {0}; + + if (!winetest_interactive) + { + /* This test will open a persistent explorer window for My Computer (if + * one isn't already open), and there's no practical way to consistently + * auto-close it, so this is best left out of the non-interactive tests. + */ + skip( "interactive explorer GUID path test (set WINETEST_INTERACTIVE=1)\n" ); + return; + } + + sei.cbSize = sizeof(sei); + sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NOASYNC | SEE_MASK_FLAG_NO_UI; + sei.lpVerb = L"open"; + sei.lpFile = L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}"; + sei.nShow = SW_SHOW; + + result = ShellExecuteExW(&sei); + ok(result, "ShellExecuteExW failed\n"); + } +} + START_TEST(shlexec) { @@ -3059,6 +3088,7 @@ START_TEST(shlexec) test_dde(); test_dde_default_app(); test_directory(); + test_guid(); cleanup_test(); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11709
From: Andrea Faulds <ajf@ajf.me> --- programs/explorer/explorer.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c index 185414417c9..b57a5a87178 100644 --- a/programs/explorer/explorer.c +++ b/programs/explorer/explorer.c @@ -385,7 +385,6 @@ static void make_explorer_window(parameters_struct *params) IShellWindows *sw; ITEMIDLIST *pidl; UINT dpix, dpiy; - DWORD size; LONG hwnd; HDC hdc; MSG msg; @@ -395,9 +394,14 @@ static void make_explorer_window(parameters_struct *params) if (params->root[0]) { - size = GetFullPathNameW(params->root, 0, NULL, NULL); - path = malloc( size * sizeof(WCHAR) ); - GetFullPathNameW(params->root, size, path, NULL); + if (wcsncmp(params->root, L"::{", 3)) + { + DWORD size = GetFullPathNameW(params->root, 0, NULL, NULL); + path = malloc( size * sizeof(WCHAR) ); + GetFullPathNameW(params->root, size, path, NULL); + } + else + path = wcsdup(params->root); } if (sw && path) @@ -930,7 +934,8 @@ int WINAPI wWinMain(HINSTANCE hinstance, ERR( "Could not initialize COM\n" ); ExitProcess(EXIT_FAILURE); } - if(parameters.root[0] && !PathIsDirectoryW(parameters.root)) + if(parameters.root[0] && + (wcsncmp(parameters.root, L"::{", 3) && !PathIsDirectoryW(parameters.root))) if(ShellExecuteW(NULL,NULL,parameters.root,NULL,NULL,SW_SHOWDEFAULT) > (HINSTANCE)32) ExitProcess(EXIT_SUCCESS); init_info.dwSize = sizeof(INITCOMMONCONTROLSEX); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11709
From: Andrea Faulds <ajf@ajf.me> --- dlls/shell32/shlexec.c | 2 +- dlls/shell32/tests/shlexec.c | 40 +++++++++++++++++------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index d2a6d5700d4..ff83b66fbb8 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -1895,7 +1895,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) sei, execfunc ); free( env ); } - else if (PathIsDirectoryW(lpFile)) + else if (!wcsncmp(lpFile, L"::{", 3) || PathIsDirectoryW(lpFile)) { WCHAR wExec[MAX_PATH]; WCHAR * lpQuotedFile = malloc( sizeof(WCHAR) * (lstrlenW(lpFile) + 3) ); diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 3ff9c33a873..9fe1f1f287f 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -3036,31 +3036,29 @@ static void test_directory(void) static void test_guid(void) { - todo_wine { - /* try to open My Computer's shell folder by its GUID */ + /* try to open My Computer's shell folder by its GUID */ - BOOL result; - SHELLEXECUTEINFOW sei = {0}; + BOOL result; + SHELLEXECUTEINFOW sei = {0}; - if (!winetest_interactive) - { - /* This test will open a persistent explorer window for My Computer (if - * one isn't already open), and there's no practical way to consistently - * auto-close it, so this is best left out of the non-interactive tests. - */ - skip( "interactive explorer GUID path test (set WINETEST_INTERACTIVE=1)\n" ); - return; - } + if (!winetest_interactive) + { + /* This test will open a persistent explorer window for My Computer (if + * one isn't already open), and there's no practical way to consistently + * auto-close it, so this is best left out of the non-interactive tests. + */ + skip( "interactive explorer GUID path test (set WINETEST_INTERACTIVE=1)\n" ); + return; + } - sei.cbSize = sizeof(sei); - sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NOASYNC | SEE_MASK_FLAG_NO_UI; - sei.lpVerb = L"open"; - sei.lpFile = L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}"; - sei.nShow = SW_SHOW; + sei.cbSize = sizeof(sei); + sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_NOASYNC | SEE_MASK_FLAG_NO_UI; + sei.lpVerb = L"open"; + sei.lpFile = L"::{20d04fe0-3aea-1069-a2d8-08002b30309d}"; + sei.nShow = SW_SHOW; - result = ShellExecuteExW(&sei); - ok(result, "ShellExecuteExW failed\n"); - } + result = ShellExecuteExW(&sei); + ok(result, "ShellExecuteExW failed\n"); } START_TEST(shlexec) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11709
participants (2)
-
Andrea Faulds -
Andrea Faulds (@hikari_no_yume)