[0.4.7][SHELL32] Squashed port of several RunDlg and ShellExecuteW() fixes

This is a big backport, that brings us closer to releases/0.4.14/0.4.14-release-10-g1b0b852

The main motivation is to fix the regression:
CORE-6412 'FoxitReader4 starts directly instead of launching setup wizard'
which regressed by SVN r56438 == git e5491506f1

By porting back the following commits:

0.4.15-dev-2883-g 33c7c91b36 CORE-17351 CORE-16898 (#3797) Improve performance of Start-Run Dialog Box Options
0.4.14-dev-1016-g 4e721f780e CORE-12266 (#1854) [SHELL32] This fixes the ERROR_DDE_FAIL in the 'www.google.de' testcase
0.4.13-dev-790-g 0f16d44b66 CORE-6412 + CORE-12927
but in return we have to fix all the callers of ShellExecuteW() that relied on this ancient hack-code, and we do this by picking
0.4.13-dev-930-g cb77f1701f CORE-16299 [SHELL32][STOBJECT] ShellExecuteW() params part2
0.4.13-dev-860-g 944aba1fcc CORE-16299 [SHELL32] ShellExecuteW() params part1 (#1833)

0.4.12-dev-94-g 932a812c66 CORE-15434 [SHELL32] shlexec.cpp UNICODE_NULL Add backslash if path was like C: (#1152)
0.4.12-dev-49-g fad9f6677a CORE-15434 [SHELL32] dialogs.cpp (#1117) Addendum
0.4.12-dev-48-g c64d31e9b8 CORE-15434 [BROWSEUI] Add backslash for directory (#1121) C: C:\
0.4.12-dev-36-g 472787ffea CORE-15431 (#1117) Crash on %SYSTEMROOT%
0.4.12-dev-19-g 06d717e3bc CORE-15431 (#1111) Enable Environment Variables
0.4.10-dev-446-g db13b422b3 (#737) shlexec.cpp to avoid regression CORE-14886 "regsvr32 can no longer register dlls"
0.4.10-dev-419-g bfcbda227f (#665) Multiple parameters dialogs.cpp, shlexec.cpp, sdk/include/reactis/undocshell.h
0.4.10-dev-335-g e018ccea4b CORE-14469 (#681) [SHELL32] lpDirectory must have priority in ShellExecuteEx
0.4.10-dev-238-g c84f398306 CORE-14583 (#593) base/shell/explorer/traywnd.cpp
0.4.10-dev-106-g 222534a5a2 IDS_FILE_NOT_FOUND from that unrelated commit was reused to display errors of the RunDlg
0.4.8-dev-253-g 53edadb8c0 CORE-12882, CORE-13847 (#159) [BROWSEUI] SHExplorerParseCmdLine: Improve relative path handling
and a few whitespace-fixes in undocshell.h to bring the file 100% in sync to current 0.4.8
This commit is contained in:
Joachim Henze 2022-02-20 21:29:07 +01:00
parent 13133ecefa
commit 6057f41b6b
39 changed files with 359 additions and 57 deletions

View file

@ -161,7 +161,12 @@ HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray * pSysTray)
static void _RunHotplug(CSysTray * pSysTray)
{
ShellExecuteW(pSysTray->GetHWnd(), L"open", L"rundll32.exe shell32.dll,Control_RunDLL hotplug.dll", NULL, NULL, SW_SHOWNORMAL);
ShellExecuteW(pSysTray->GetHWnd(),
L"open",
L"rundll32.exe",
L"shell32.dll,Control_RunDLL hotplug.dll",
NULL,
SW_SHOWNORMAL);
}
static void _ShowContextMenu(CSysTray * pSysTray)

View file

@ -382,6 +382,15 @@ SHExplorerParseCmdLine(ExplorerCommandLineParseResults * pInfo)
{
// Or just a plain old string.
if (PathIsDirectoryW(strField))
PathAddBackslash(strField);
WCHAR szPath[MAX_PATH];
DWORD result = GetFullPathNameW(strField, _countof(szPath), szPath, NULL);
if (result != 0 && result <= _countof(szPath) && PathFileExistsW(szPath))
StringCchCopyW(strField, _countof(strField), szPath);
LPITEMIDLIST pidlPath = ILCreateFromPathW(strField);
pInfo->pidlPath = pidlPath;

View file

@ -408,7 +408,8 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
LRESULT lRet;
HWND htxt = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH);
INT ic;
WCHAR *psz, *parent = NULL;
WCHAR *psz, *pszExpanded, *parent = NULL;
DWORD cchExpand;
SHELLEXECUTEINFOW sei;
NMRUNFILEDLGW nmrfd;
@ -434,10 +435,28 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
}
GetWindowTextW(htxt, psz, ic + 1);
sei.hwnd = hwnd;
sei.nShow = SW_SHOWNORMAL;
sei.lpFile = psz;
StrTrimW(psz, L" \t");
if (wcschr(psz, L'%') != NULL)
{
cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand * sizeof(WCHAR));
if (!pszExpanded)
{
HeapFree(GetProcessHeap(), 0, psz);
EndDialog(hwnd, IDCANCEL);
return TRUE;
}
ExpandEnvironmentStringsW(psz, pszExpanded, cchExpand);
StrTrimW(pszExpanded, L" \t");
}
else
{
pszExpanded = psz;
}
/*
* The precedence is the following: first the user-given
@ -445,12 +464,22 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
* directory is computed if the RFF_CALCDIRECTORY is set,
* otherwise no current directory is defined.
*/
LPCWSTR pszStartDir;
if (prfdp->lpstrDirectory)
{
sei.lpDirectory = prfdp->lpstrDirectory;
pszStartDir = prfdp->lpstrDirectory;
}
else if (prfdp->uFlags & RFF_CALCDIRECTORY)
{
sei.lpDirectory = parent = RunDlg_GetParentDir(sei.lpFile);
pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
}
else
{
sei.lpDirectory = NULL;
pszStartDir = NULL;
}
/* Hide the dialog for now on, we will show it up in case of retry */
ShowWindow(hwnd, SW_HIDE);
@ -467,9 +496,9 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
nmrfd.hdr.code = RFN_VALIDATE;
nmrfd.hdr.hwndFrom = hwnd;
nmrfd.hdr.idFrom = 0;
nmrfd.lpFile = sei.lpFile;
nmrfd.lpDirectory = sei.lpDirectory;
nmrfd.nShow = sei.nShow;
nmrfd.lpFile = pszExpanded;
nmrfd.lpDirectory = pszStartDir;
nmrfd.nShow = SW_SHOWNORMAL;
lRet = SendMessageW(prfdp->hwndOwner, WM_NOTIFY, 0, (LPARAM)&nmrfd.hdr);
@ -480,9 +509,21 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
break;
case RF_OK:
if (ShellExecuteExW(&sei))
/* We use SECL_NO_UI because we don't want to see
* errors here, but we will try again below and
* there we will output our errors. */
if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL,
SECL_ALLOW_NONEXE | SECL_NO_UI)))
{
/* Call again GetWindowText in case the contents of the edit box has changed? */
/* Call GetWindowText again in case the contents of the edit box have changed. */
GetWindowTextW(htxt, psz, ic + 1);
FillList(htxt, psz, ic + 2 + 1, FALSE);
EndDialog(hwnd, IDOK);
break;
}
else if (SUCCEEDED(ShellExecuteExW(&sei)))
{
/* Call GetWindowText again in case the contents of the edit box have changed. */
GetWindowTextW(htxt, psz, ic + 1);
FillList(htxt, psz, ic + 2 + 1, FALSE);
EndDialog(hwnd, IDOK);
@ -500,6 +541,8 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
HeapFree(GetProcessHeap(), 0, parent);
HeapFree(GetProcessHeap(), 0, psz);
if (psz != pszExpanded)
HeapFree(GetProcessHeap(), 0, pszExpanded);
return TRUE;
}
@ -515,8 +558,8 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
WCHAR filter[MAX_PATH], szCaption[MAX_PATH];
OPENFILENAMEW ofn;
LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER, filter, MAX_PATH);
LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_CAPTION, szCaption, MAX_PATH);
LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER, filter, _countof(filter));
LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_CAPTION, szCaption, _countof(szCaption));
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);

View file

@ -842,8 +842,11 @@ HRESULT WINAPI CDesktopFolder::CallBack(IShellFolder *psf, HWND hwndOwner, IData
{
if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
{
if (32 >= (UINT)ShellExecuteW(hwndOwner, L"open", L"rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL))
if (32 >= (UINT_PTR)ShellExecuteW(hwndOwner, L"open", L"rundll32.exe",
L"shell32.dll,Control_RunDLL desk.cpl", NULL, SW_SHOWNORMAL))
{
return E_FAIL;
}
return S_OK;
}
else if (uMsg == DFM_MERGECONTEXTMENU)

View file

@ -41,21 +41,40 @@ HRESULT CALLBACK RegFolderContextMenuCallback(IShellFolder *psf,
if (_ILIsMyComputer(apidl[0]))
{
if (32 >= (UINT)ShellExecuteW(hwnd, L"open", L"rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl", NULL, NULL, SW_SHOWNORMAL))
if (32 >= (UINT_PTR)ShellExecuteW(hwnd,
L"open",
L"rundll32.exe",
L"shell32.dll,Control_RunDLL sysdm.cpl",
NULL,
SW_SHOWNORMAL))
{
hr = E_FAIL;
}
}
else if (_ILIsDesktop(apidl[0]))
{
if (32 >= (UINT)ShellExecuteW(hwnd, L"open", L"rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL))
if (32 >= (UINT_PTR)ShellExecuteW(hwnd,
L"open",
L"rundll32.exe",
L"shell32.dll,Control_RunDLL desk.cpl",
NULL,
SW_SHOWNORMAL))
{
hr = E_FAIL;
}
}
else if (_ILIsNetHood(apidl[0]))
{
// FIXME path!
if (32 >= (UINT)ShellExecuteW(NULL, L"open", L"explorer.exe",
L"::{7007ACC7-3202-11D1-AAD2-00805FC1270E}",
NULL, SW_SHOWDEFAULT))
if (32 >= (UINT_PTR)ShellExecuteW(NULL,
L"open",
L"explorer.exe",
L"::{7007ACC7-3202-11D1-AAD2-00805FC1270E}",
NULL,
SW_SHOWDEFAULT))
{
hr = E_FAIL;
}
}
else if (_ILIsBitBucket(apidl[0]))
{

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -836,4 +836,5 @@ BEGIN
IDS_MENU_EMPTY "(Prázdné)"
IDS_OBJECTS "Položek: %d"
IDS_OBJECTS_SELECTED "Položek vybráno: %d"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -856,4 +856,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -852,4 +852,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Systemsteuerung unter Arbeitsplatz einblenden"
IDS_ADVANCED_SHOW_COMP_COLOR "Verschlüsselte oder komprimierte NTFS-Dateien farbig anzeigen"
IDS_ADVANCED_SHOW_INFO_TIP "Popupinformationen für Ordner- und Desktop-Elemente anzeigen"
IDS_FILE_NOT_FOUND "Die Datei '%s' wurde nicht gefunden."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -851,4 +851,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -852,4 +852,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "El archivo '%s' no pudo ser encontrado."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -847,4 +847,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "マイ コンピュータでコントロール パネルを表示する"
IDS_ADVANCED_SHOW_COMP_COLOR "暗号化または圧縮されたNTFSファイルを色付きで表示する"
IDS_ADVANCED_SHOW_INFO_TIP "フォルダとデスクトップの項目にポップアップ式の説明を表示する"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -854,4 +854,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Pokaż Panel sterowania w oknie Mój komputer"
IDS_ADVANCED_SHOW_COMP_COLOR "Pokaż zaszyfrowane lub skompresowane pliki NTFS w kolorze"
IDS_ADVANCED_SHOW_INFO_TIP "Pokaż podręczny opis elementów folderów i pulpitu"
IDS_FILE_NOT_FOUND "Nie odnaleziono pliku '%s'."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -852,4 +852,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Afișează Panoul de control în Calculatorul meu"
IDS_ADVANCED_SHOW_COMP_COLOR "Afișează în culori fișierele NTFS criptate sau comprimate"
IDS_ADVANCED_SHOW_INFO_TIP "Permite descriere prin indicii pentru dosare și elemente de birou"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -852,4 +852,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Показать ""Панель управления"" в ""Мой компьютер"""
IDS_ADVANCED_SHOW_COMP_COLOR "Отображать сжатые или зашифрованные файлы NTFS другим цветом"
IDS_ADVANCED_SHOW_INFO_TIP "Отображать описание для папок и элементов рабочего стола"
IDS_FILE_NOT_FOUND "Файл '%s' не найден."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -854,4 +854,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -852,4 +852,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Bilgisayarım'da Denetim Masası'nı göster"
IDS_ADVANCED_SHOW_COMP_COLOR "Şifrelenmiş veyâ sıkıştırılmış NTFS kütüklerini renkli göster"
IDS_ADVANCED_SHOW_INFO_TIP "Dizin ve masaüstü ögeleri için açılan tanım göster"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -850,4 +850,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -857,4 +857,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -858,4 +858,5 @@ BEGIN
IDS_ADVANCED_CONTROL_PANEL_IN_MY_COMPUTER "Show Control Panel in My Computer"
IDS_ADVANCED_SHOW_COMP_COLOR "Show encrypted or compressed NTFS files in color"
IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items"
IDS_FILE_NOT_FOUND "The file '%s' was not found."
END

View file

@ -20,11 +20,13 @@
*/
#include "precomp.h"
#include <undocshell.h>
WINE_DEFAULT_DEBUG_CHANNEL(exec);
static const WCHAR wszOpen[] = L"open";
static const WCHAR wszExe[] = L".exe";
static const WCHAR wszCom[] = L".com";
#define SEE_MASK_CLASSALL (SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY)
@ -178,7 +180,7 @@ static void ParseTildeEffect(PWSTR &res, LPCWSTR &args, DWORD &len, DWORD &used,
* - use rules from here http://www.autohotkey.net/~deleyd/parameters/parameters.htm
*/
static BOOL SHELL_ArgifyW(WCHAR* out, DWORD len, const WCHAR* fmt, const WCHAR* lpFile, LPITEMIDLIST pidl, LPCWSTR args, DWORD* out_len)
static BOOL SHELL_ArgifyW(WCHAR* out, DWORD len, const WCHAR* fmt, const WCHAR* lpFile, LPITEMIDLIST pidl, LPCWSTR args, DWORD* out_len, const WCHAR* lpDir)
{
WCHAR xlpFile[1024];
BOOL done = FALSE;
@ -265,7 +267,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, DWORD len, const WCHAR* fmt, const WCHAR*
if (!done || (*fmt == '1'))
{
/*FIXME Is the call to SearchPathW() really needed? We already have separated out the parameter string in args. */
if (SearchPathW(NULL, lpFile, wszExe, sizeof(xlpFile) / sizeof(WCHAR), xlpFile, NULL))
if (SearchPathW(lpDir, lpFile, wszExe, sizeof(xlpFile) / sizeof(WCHAR), xlpFile, NULL))
cmd = xlpFile;
else
cmd = lpFile;
@ -828,7 +830,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
if (retval > 32)
{
DWORD finishedLen;
SHELL_ArgifyW(lpResult, resultLen, command, xlpFile, pidl, args, &finishedLen);
SHELL_ArgifyW(lpResult, resultLen, command, xlpFile, pidl, args, &finishedLen, lpPath);
if (finishedLen > resultLen)
ERR("Argify buffer not large enough.. truncated\n");
/* Remove double quotation marks and command line arguments */
@ -1039,6 +1041,22 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
TRACE("Couldn't launch\n");
goto error;
}
/* if ddeexec is NULL, then we just need to exit here */
if (ddeexec == NULL)
{
TRACE("Exiting because ddeexec is NULL. ret=42.\n");
/* See https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew */
/* for reason why we use 42 here and also "Shell32_apitest ShellExecuteW" regression test */
return 42;
}
/* if ddeexec is 'empty string', then we just need to exit here */
if (wcscmp(ddeexec, L"") == 0)
{
TRACE("Exiting because ddeexec is 'empty string'. ret=42.\n");
/* See https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew */
/* for reason why we use 42 here and also "Shell32_apitest ShellExecuteW" regression test */
return 42;
}
hConv = DdeConnect(ddeInst, hszApp, hszTopic, NULL);
if (!hConv)
{
@ -1061,11 +1079,11 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
}
}
SHELL_ArgifyW(static_res, sizeof(static_res)/sizeof(WCHAR), exec, lpFile, pidl, szCommandline, &resultLen);
SHELL_ArgifyW(static_res, sizeof(static_res)/sizeof(WCHAR), exec, lpFile, pidl, szCommandline, &resultLen, NULL);
if (resultLen > sizeof(static_res)/sizeof(WCHAR))
{
res = dynamic_res = static_cast<WCHAR *>(HeapAlloc(GetProcessHeap(), 0, resultLen * sizeof(WCHAR)));
SHELL_ArgifyW(dynamic_res, resultLen, exec, lpFile, pidl, szCommandline, NULL);
SHELL_ArgifyW(dynamic_res, resultLen, exec, lpFile, pidl, szCommandline, NULL, NULL);
}
else
res = static_res;
@ -1131,7 +1149,8 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env,
if (cmdlen >= sizeof(cmd) / sizeof(WCHAR))
cmdlen = sizeof(cmd) / sizeof(WCHAR) - 1;
cmd[cmdlen] = '\0';
SHELL_ArgifyW(param, sizeof(param) / sizeof(WCHAR), cmd, lpFile, (LPITEMIDLIST)psei->lpIDList, szCommandline, &resultLen);
SHELL_ArgifyW(param, sizeof(param) / sizeof(WCHAR), cmd, lpFile, (LPITEMIDLIST)psei->lpIDList, szCommandline, &resultLen,
(psei->lpDirectory && *psei->lpDirectory) ? psei->lpDirectory : NULL);
if (resultLen > sizeof(param) / sizeof(WCHAR))
ERR("Argify buffer not large enough, truncating\n");
}
@ -1511,7 +1530,8 @@ static UINT_PTR SHELL_execute_class(LPCWSTR wszApplicationName, LPSHELLEXECUTEIN
TRACE("SEE_MASK_CLASSNAME->%s, doc->%s\n", debugstr_w(execCmd), debugstr_w(wszApplicationName));
wcmd[0] = '\0';
done = SHELL_ArgifyW(wcmd, sizeof(wcmd) / sizeof(WCHAR), execCmd, wszApplicationName, (LPITEMIDLIST)psei->lpIDList, NULL, &resultLen);
done = SHELL_ArgifyW(wcmd, sizeof(wcmd) / sizeof(WCHAR), execCmd, wszApplicationName, (LPITEMIDLIST)psei->lpIDList, NULL, &resultLen,
(psei->lpDirectory && *psei->lpDirectory) ? psei->lpDirectory : NULL);
if (!done && wszApplicationName[0])
{
strcatW(wcmd, L" ");
@ -1577,7 +1597,8 @@ static BOOL SHELL_translate_idlist(LPSHELLEXECUTEINFOW sei, LPWSTR wszParameters
sei->lpVerb,
buffer, sizeof(buffer))) {
SHELL_ArgifyW(wszApplicationName, dwApplicationNameLen,
buffer, target, (LPITEMIDLIST)sei->lpIDList, NULL, &resultLen);
buffer, target, (LPITEMIDLIST)sei->lpIDList, NULL, &resultLen,
(sei->lpDirectory && *sei->lpDirectory) ? sei->lpDirectory : NULL);
if (resultLen > dwApplicationNameLen)
ERR("Argify buffer not large enough... truncating\n");
appKnownSingular = FALSE;
@ -1987,34 +2008,6 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc)
}
else
{
/* If the executable name is not quoted, we have to use this search loop here,
that in CreateProcess() is not sufficient because it does not handle shell links. */
WCHAR buffer[MAX_PATH], xlpFile[MAX_PATH];
LPWSTR space, s;
LPWSTR beg = wszApplicationName/*sei_tmp.lpFile*/;
for(s = beg; (space = const_cast<LPWSTR>(strchrW(s, L' '))); s = space + 1)
{
int idx = space - sei_tmp.lpFile;
memcpy(buffer, sei_tmp.lpFile, idx * sizeof(WCHAR));
buffer[idx] = '\0';
/*FIXME This finds directory paths if the targeted file name contains spaces. */
if (SearchPathW(*sei_tmp.lpDirectory ? sei_tmp.lpDirectory : NULL, buffer, wszExe, sizeof(xlpFile) / sizeof(xlpFile[0]), xlpFile, NULL))
{
/* separate out command from parameter string */
LPCWSTR p = space + 1;
while(isspaceW(*p))
++p;
strcpyW(wszParameters, p);
*space = L'\0';
break;
}
}
lpFile = sei_tmp.lpFile;
}
}
@ -2302,3 +2295,185 @@ EXTERN_C void WINAPI OpenAs_RunDLLW(HWND hwnd, HINSTANCE hinst, LPCWSTR cmdline,
{
FIXME("%p, %p, %s, %d\n", hwnd, hinst, debugstr_w(cmdline), cmdshow);
}
/*************************************************************************/
static LPCWSTR
SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
{
LPCWSTR pch;
size_t ich = 0;
if (*psz == L'"')
{
// 1st argument is quoted. the string in quotes is quoted 1st argument.
// [pch] --> [pszArg0+ich]
for (pch = psz + 1; *pch && ich + 1 < cchArg0; ++ich, ++pch)
{
if (*pch == L'"' && pch[1] == L'"')
{
// doubled double quotations found!
pszArg0[ich] = L'"';
}
else if (*pch == L'"')
{
// single double quotation found!
++pch;
break;
}
else
{
// otherwise
pszArg0[ich] = *pch;
}
}
}
else
{
// 1st argument is unquoted. non-space sequence is 1st argument.
// [pch] --> [pszArg0+ich]
for (pch = psz; *pch && !iswspace(*pch) && ich + 1 < cchArg0; ++ich, ++pch)
{
pszArg0[ich] = *pch;
}
}
pszArg0[ich] = 0;
// skip space
while (iswspace(*pch))
++pch;
return pch;
}
HRESULT WINAPI ShellExecCmdLine(
HWND hwnd,
LPCWSTR pwszCommand,
LPCWSTR pwszStartDir,
int nShow,
LPVOID pUnused,
DWORD dwSeclFlags)
{
SHELLEXECUTEINFOW info;
DWORD dwSize, dwError, dwType, dwFlags = SEE_MASK_DOENVSUBST | SEE_MASK_NOASYNC;
LPCWSTR pszVerb = NULL;
WCHAR szFile[MAX_PATH], szFile2[MAX_PATH];
HRESULT hr;
LPCWSTR pchParams;
LPWSTR lpCommand = NULL;
if (pwszCommand == NULL)
RaiseException(EXCEPTION_ACCESS_VIOLATION, EXCEPTION_NONCONTINUABLE,
1, (ULONG_PTR*)pwszCommand);
__SHCloneStrW(&lpCommand, pwszCommand);
StrTrimW(lpCommand, L" \t");
if (dwSeclFlags & SECL_NO_UI)
dwFlags |= SEE_MASK_FLAG_NO_UI;
if (dwSeclFlags & SECL_LOG_USAGE)
dwFlags |= SEE_MASK_FLAG_LOG_USAGE;
if (dwSeclFlags & SECL_USE_IDLIST)
dwFlags |= SEE_MASK_INVOKEIDLIST;
if (dwSeclFlags & SECL_RUNAS)
{
dwSize = 0;
hr = AssocQueryStringW(0, ASSOCSTR_COMMAND, lpCommand, L"RunAs", NULL, &dwSize);
if (SUCCEEDED(hr) && dwSize != 0)
{
pszVerb = L"runas";
}
}
if (PathIsURLW(lpCommand) || UrlIsW(lpCommand, URLIS_APPLIABLE))
{
StringCchCopyW(szFile, _countof(szFile), lpCommand);
pchParams = NULL;
}
else
{
pchParams = SplitParams(lpCommand, szFile, _countof(szFile));
if (szFile[0] != UNICODE_NULL && szFile[1] == L':' &&
szFile[2] == UNICODE_NULL)
{
PathAddBackslashW(szFile);
}
if (SearchPathW(NULL, szFile, NULL, _countof(szFile2), szFile2, NULL) ||
SearchPathW(NULL, szFile, wszExe, _countof(szFile2), szFile2, NULL) ||
SearchPathW(NULL, szFile, wszCom, _countof(szFile2), szFile2, NULL) ||
SearchPathW(pwszStartDir, szFile, NULL, _countof(szFile2), szFile2, NULL) ||
SearchPathW(pwszStartDir, szFile, wszExe, _countof(szFile2), szFile2, NULL) ||
SearchPathW(pwszStartDir, szFile, wszCom, _countof(szFile2), szFile2, NULL))
{
StringCchCopyW(szFile, _countof(szFile), szFile2);
}
else if (SearchPathW(NULL, lpCommand, NULL, _countof(szFile2), szFile2, NULL) ||
SearchPathW(NULL, lpCommand, wszExe, _countof(szFile2), szFile2, NULL) ||
SearchPathW(NULL, lpCommand, wszCom, _countof(szFile2), szFile2, NULL) ||
SearchPathW(pwszStartDir, lpCommand, NULL, _countof(szFile2), szFile2, NULL) ||
SearchPathW(pwszStartDir, lpCommand, wszExe, _countof(szFile2), szFile2, NULL) ||
SearchPathW(pwszStartDir, lpCommand, wszCom, _countof(szFile2), szFile2, NULL))
{
StringCchCopyW(szFile, _countof(szFile), szFile2);
pchParams = NULL;
}
if (!(dwSeclFlags & SECL_ALLOW_NONEXE))
{
if (!GetBinaryTypeW(szFile, &dwType))
{
SHFree(lpCommand);
if (!(dwSeclFlags & SECL_NO_UI))
{
WCHAR szText[128 + MAX_PATH], szFormat[128];
LoadStringW(shell32_hInstance, IDS_FILE_NOT_FOUND, szFormat, _countof(szFormat));
StringCchPrintfW(szText, _countof(szText), szFormat, szFile);
MessageBoxW(hwnd, szText, NULL, MB_ICONERROR);
}
return CO_E_APPNOTFOUND;
}
}
else
{
if (GetFileAttributesW(szFile) == INVALID_FILE_ATTRIBUTES)
{
SHFree(lpCommand);
if (!(dwSeclFlags & SECL_NO_UI))
{
WCHAR szText[128 + MAX_PATH], szFormat[128];
LoadStringW(shell32_hInstance, IDS_FILE_NOT_FOUND, szFormat, _countof(szFormat));
StringCchPrintfW(szText, _countof(szText), szFormat, szFile);
MessageBoxW(hwnd, szText, NULL, MB_ICONERROR);
}
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
}
}
}
ZeroMemory(&info, sizeof(info));
info.cbSize = sizeof(info);
info.fMask = dwFlags;
info.hwnd = hwnd;
info.lpVerb = pszVerb;
info.lpFile = szFile;
info.lpParameters = (pchParams && *pchParams) ? pchParams : NULL;
info.lpDirectory = pwszStartDir;
info.nShow = nShow;
if (ShellExecuteExW(&info))
{
if (info.lpIDList)
CoTaskMemFree(info.lpIDList);
SHFree(lpCommand);
return S_OK;
}
dwError = GetLastError();
SHFree(lpCommand);
return HRESULT_FROM_WIN32(dwError);
}

View file

@ -245,6 +245,8 @@
#define IDS_ADVANCED_SHOW_COMP_COLOR 30512
#define IDS_ADVANCED_SHOW_INFO_TIP 30502
#define IDS_FILE_NOT_FOUND 30530
/* Dialogs */
/* Run dialog */

View file

@ -98,8 +98,8 @@ BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
/****************************************************************************
* SHChangeNotifyRegister API
*/
* SHChangeNotifyRegister API
*/
#define SHCNRF_InterruptLevel 0x0001
#define SHCNRF_ShellLevel 0x0002
#define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with SHCNRF_InterruptLevel */
@ -543,6 +543,21 @@ WORD WINAPI ArrangeWindows(
WORD cKids,
CONST HWND * lpKids);
/* Flags for ShellExecCmdLine */
#define SECL_NO_UI 0x2
#define SECL_LOG_USAGE 0x8
#define SECL_USE_IDLIST 0x10
#define SECL_ALLOW_NONEXE 0x20
#define SECL_RUNAS 0x40
HRESULT WINAPI ShellExecCmdLine(
HWND hwnd,
LPCWSTR pwszCommand,
LPCWSTR pwszStartDir,
int nShow,
LPVOID pUnused,
DWORD dwSeclFlags);
/* RegisterShellHook types */
#define RSH_DEREGISTER 0
#define RSH_REGISTER 1
@ -599,7 +614,7 @@ BOOL WINAPI GUIDFromStringW(
_In_ PCWSTR psz,
_Out_ LPGUID pguid
);
static inline ULONG
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
{
@ -857,7 +872,7 @@ typedef struct tagSHELL_LINK_INFOW
/*****************************************************************************
* SHELL_LINK_INFO_VOLUME_IDA/W
* If cbVolumeLabelOffset != 0x00000014 (should be 0x00000010) then use
* If cbVolumeLabelOffset != 0x00000014 (should be 0x00000010) then use
* SHELL_LINK_INFO_VOLUME_IDA
* If cbVolumeLabelOffset == 0x00000014 then use SHELL_LINK_INFO_VOLUME_IDW
*/
@ -977,7 +992,7 @@ typedef struct tagEXP_VISTA_ID_LIST
{
/* .cbSize >= 0x0000000a, .dwSignature = 0xa000000c */
DATABLOCK_HEADER dbh;
/* Specifies an alternate IDList that can be used instead
/* Specifies an alternate IDList that can be used instead
of the "normal" IDList (SLDF_HAS_ID_LIST) */
/* LPITEMIDLIST pIDList; (variable) */
} EXP_VISTA_ID_LIST, *LPEXP_VISTA_ID_LIST;