From ff5fc9c0fa8b00a5bf806783a2f4acb5f14f53c3 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 4 Mar 2024 16:41:59 -0600 Subject: [PATCH] Rebase against c1b8db0c28ac5b7a14567bfb6df2c0af364de6a2. --- ...Do-not-sign-extend-after-multiplying.patch | 33 ----- ...002-shell32-Implement-the-runas-verb.patch | 76 ----------- ...ine.inf-Set-the-EnableLUA-value-to-1.patch | 29 ---- ...ustom-action-server-as-an-elevated-p.patch | 68 ---------- ...t-insert-paste-for-item-context-menu.patch | 128 ------------------ ...e-cut-copy-paste-string-verbs-in-ite.patch | 30 ---- patches/shell32-Context_Menu/definition | 1 + staging/upstream-commit | 2 +- 8 files changed, 2 insertions(+), 365 deletions(-) delete mode 100644 patches/msi-msi_vcl_get_cost/0001-msi-Do-not-sign-extend-after-multiplying.patch delete mode 100644 patches/server-default_integrity/0002-shell32-Implement-the-runas-verb.patch delete mode 100644 patches/server-default_integrity/0003-wine.inf-Set-the-EnableLUA-value-to-1.patch delete mode 100644 patches/server-default_integrity/0004-msi-Create-the-custom-action-server-as-an-elevated-p.patch delete mode 100644 patches/shell32-Context_Menu/0003-shell32-Implement-insert-paste-for-item-context-menu.patch delete mode 100644 patches/shell32-Context_Menu/0008-shell32-Recognize-cut-copy-paste-string-verbs-in-ite.patch diff --git a/patches/msi-msi_vcl_get_cost/0001-msi-Do-not-sign-extend-after-multiplying.patch b/patches/msi-msi_vcl_get_cost/0001-msi-Do-not-sign-extend-after-multiplying.patch deleted file mode 100644 index 816324c2..00000000 --- a/patches/msi-msi_vcl_get_cost/0001-msi-Do-not-sign-extend-after-multiplying.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 19fd6f33b8e55707072feb5d08d0f62028265951 Mon Sep 17 00:00:00 2001 -From: Mark Jansen -Date: Fri, 13 Jan 2017 23:20:52 +0100 -Subject: [PATCH] msi: Do not sign extend after multiplying. - -Signed-off-by: Mark Jansen ---- - dlls/msi/dialog.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c -index 8825c28..97fc89c 100644 ---- a/dlls/msi/dialog.c -+++ b/dlls/msi/dialog.c -@@ -3200,13 +3200,13 @@ static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) - MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &each_cost))) - { - /* each_cost is in 512-byte units */ -- total_cost += each_cost * 512; -+ total_cost += ((LONGLONG)each_cost) * 512; - } - if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, - MSICOSTTREE_SELFONLY, INSTALLSTATE_ABSENT, &each_cost))) - { - /* each_cost is in 512-byte units */ -- total_cost -= each_cost * 512; -+ total_cost -= ((LONGLONG)each_cost) * 512; - } - } - return total_cost; --- -1.9.1 - diff --git a/patches/server-default_integrity/0002-shell32-Implement-the-runas-verb.patch b/patches/server-default_integrity/0002-shell32-Implement-the-runas-verb.patch deleted file mode 100644 index e80bcd1b..00000000 --- a/patches/server-default_integrity/0002-shell32-Implement-the-runas-verb.patch +++ /dev/null @@ -1,76 +0,0 @@ -From ede24db26773b5ce2c2d7e13bf12939b55124281 Mon Sep 17 00:00:00 2001 -From: Zebediah Figura -Date: Fri, 26 Feb 2021 22:31:19 -0600 -Subject: [PATCH] shell32: Implement the "runas" verb. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Based on a patch by Michael Müller. - -Signed-off-by: Zebediah Figura ---- - dlls/shell32/shlexec.c | 26 ++++++++++++++++++++++++-- - 1 file changed, 24 insertions(+), 2 deletions(-) - -diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c -index 8c7e3cf0808..c9a996a13dd 100644 ---- a/dlls/shell32/shlexec.c -+++ b/dlls/shell32/shlexec.c -@@ -292,6 +292,21 @@ static HRESULT SHELL_GetPathFromIDListForExecuteW(LPCITEMIDLIST pidl, LPWSTR psz - return hr; - } - -+static HANDLE get_admin_token(void) -+{ -+ TOKEN_ELEVATION_TYPE type; -+ TOKEN_LINKED_TOKEN linked; -+ DWORD size; -+ -+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenElevationType, &type, sizeof(type), &size) -+ || type == TokenElevationTypeFull) -+ return NULL; -+ -+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size)) -+ return NULL; -+ return linked.LinkedToken; -+} -+ - /************************************************************************* - * SHELL_ExecuteW [Internal] - * -@@ -305,6 +320,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, - UINT gcdret = 0; - WCHAR curdir[MAX_PATH]; - DWORD dwCreationFlags; -+ HANDLE token = NULL; - - TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd), debugstr_w(psei->lpDirectory)); - -@@ -326,8 +342,12 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, - dwCreationFlags = CREATE_UNICODE_ENVIRONMENT; - if (!(psei->fMask & SEE_MASK_NO_CONSOLE)) - dwCreationFlags |= CREATE_NEW_CONSOLE; -- if (CreateProcessW(NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE, dwCreationFlags, env, -- NULL, &startup, &info)) -+ -+ if (psei->lpVerb && !wcsicmp(psei->lpVerb, L"runas")) -+ token = get_admin_token(); -+ -+ if (CreateProcessAsUserW(token, NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE, -+ dwCreationFlags, env, NULL, &startup, &info)) - { - /* Give 30 seconds to the app to come up, if desired. Probably only needed - when starting app immediately before making a DDE connection. */ -@@ -347,6 +367,8 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, - retval = ERROR_BAD_FORMAT; - } - -+ CloseHandle(token); -+ - TRACE("returning %Iu\n", retval); - - psei_out->hInstApp = (HINSTANCE)retval; --- -2.34.1 - diff --git a/patches/server-default_integrity/0003-wine.inf-Set-the-EnableLUA-value-to-1.patch b/patches/server-default_integrity/0003-wine.inf-Set-the-EnableLUA-value-to-1.patch deleted file mode 100644 index 8b0ccf78..00000000 --- a/patches/server-default_integrity/0003-wine.inf-Set-the-EnableLUA-value-to-1.patch +++ /dev/null @@ -1,29 +0,0 @@ -From dc1f602da6ed3a574697fe8b5bc4590d74e344f5 Mon Sep 17 00:00:00 2001 -From: Zebediah Figura -Date: Fri, 26 Feb 2021 22:41:35 -0600 -Subject: [PATCH] wine.inf: Set the EnableLUA value to 1. - -This signifies that UAC is active. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50727 -Signed-off-by: Zebediah Figura ---- - loader/wine.inf.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/loader/wine.inf.in b/loader/wine.inf.in -index 24da6f3af6b..a72279e9881 100644 ---- a/loader/wine.inf.in -+++ b/loader/wine.inf.in -@@ -526,7 +526,7 @@ HKLM,%CurrentVersion%\Explorer\DriveIcons,,16 - HKLM,%CurrentVersion%\Explorer\KindMap,,16 - HKLM,%CurrentVersion%\Group Policy,,16 - HKLM,%CurrentVersion%\Installer,"InstallerLocation",,"%11%" --HKLM,%CurrentVersion%\Policies\System,"EnableLUA",0x10003,0 -+HKLM,%CurrentVersion%\Policies\System,"EnableLUA",0x10001,1 - HKLM,%CurrentVersion%\PreviewHandlers,,16 - HKLM,%CurrentVersion%\Run,,16 - HKLM,%CurrentVersion%\Setup,"BootDir",,"%30%" --- -2.30.2 - diff --git a/patches/server-default_integrity/0004-msi-Create-the-custom-action-server-as-an-elevated-p.patch b/patches/server-default_integrity/0004-msi-Create-the-custom-action-server-as-an-elevated-p.patch deleted file mode 100644 index 476725ba..00000000 --- a/patches/server-default_integrity/0004-msi-Create-the-custom-action-server-as-an-elevated-p.patch +++ /dev/null @@ -1,68 +0,0 @@ -From f2de1c5d2fcda876276e077b61f9fba5ff3f7f12 Mon Sep 17 00:00:00 2001 -From: Zebediah Figura -Date: Sun, 16 May 2021 20:49:05 -0500 -Subject: [PATCH] msi: Create the custom action server as an elevated process. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51143 -Signed-off-by: Zebediah Figura ---- - dlls/msi/custom.c | 24 ++++++++++++++++++++++-- - 1 file changed, 22 insertions(+), 2 deletions(-) - -diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c -index fb03958eb11..874b9b92118 100644 ---- a/dlls/msi/custom.c -+++ b/dlls/msi/custom.c -@@ -574,12 +574,28 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) - return r; - } - -+static HANDLE get_admin_token(void) -+{ -+ TOKEN_ELEVATION_TYPE type; -+ TOKEN_LINKED_TOKEN linked; -+ DWORD size; -+ -+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenElevationType, &type, sizeof(type), &size) -+ || type == TokenElevationTypeFull) -+ return NULL; -+ -+ if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size)) -+ return NULL; -+ return linked.LinkedToken; -+} -+ - static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) - { - WCHAR path[MAX_PATH], cmdline[MAX_PATH + 23]; - PROCESS_INFORMATION pi = {0}; - STARTUPINFOW si = {0}; - WCHAR buffer[24]; -+ HANDLE token; - void *cookie; - HANDLE pipe; - -@@ -601,14 +617,18 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) - lstrcatW(path, L"\\msiexec.exe"); - swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId()); - -+ token = get_admin_token(); -+ - if (is_wow64 && arch == SCS_64BIT_BINARY) - { - Wow64DisableWow64FsRedirection(&cookie); -- CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); -+ CreateProcessAsUserW(token, path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); - Wow64RevertWow64FsRedirection(cookie); - } - else -- CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); -+ CreateProcessAsUserW(token, path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); -+ -+ if (token) CloseHandle(token); - - CloseHandle(pi.hThread); - --- -2.30.2 - diff --git a/patches/shell32-Context_Menu/0003-shell32-Implement-insert-paste-for-item-context-menu.patch b/patches/shell32-Context_Menu/0003-shell32-Implement-insert-paste-for-item-context-menu.patch deleted file mode 100644 index 5eab3c0d..00000000 --- a/patches/shell32-Context_Menu/0003-shell32-Implement-insert-paste-for-item-context-menu.patch +++ /dev/null @@ -1,128 +0,0 @@ -From cb562a6cf3aefe59d6173838e03030d0d882cf75 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sat, 2 Apr 2016 01:39:40 +0200 -Subject: [PATCH] shell32: Implement insert/paste for item context menus. - ---- - dlls/shell32/shell32.rc | 1 + - dlls/shell32/shlview_cmenu.c | 45 ++++++++++++++++++++++++++++++++---- - 2 files changed, 41 insertions(+), 5 deletions(-) - -diff --git a/dlls/shell32/shell32.rc b/dlls/shell32/shell32.rc -index a50fab6815d..dc418069100 100644 ---- a/dlls/shell32/shell32.rc -+++ b/dlls/shell32/shell32.rc -@@ -95,6 +95,7 @@ BEGIN - BEGIN - MENUITEM "C&ut", FCIDM_SHVIEW_CUT - MENUITEM "&Copy", FCIDM_SHVIEW_COPY -+ MENUITEM "&Paste", FCIDM_SHVIEW_INSERT - MENUITEM SEPARATOR - MENUITEM "Create &Link", FCIDM_SHVIEW_CREATELINK - MENUITEM "&Delete", FCIDM_SHVIEW_DELETE -diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c -index 9057d7c0175..aaa726ec14a 100644 ---- a/dlls/shell32/shlview_cmenu.c -+++ b/dlls/shell32/shlview_cmenu.c -@@ -73,6 +73,8 @@ typedef struct - BOOL desktop; - } ContextMenu; - -+static HRESULT DoPaste(ContextMenu *This); -+ - static inline ContextMenu *impl_from_IContextMenu3(IContextMenu3 *iface) - { - return CONTAINING_RECORD(iface, ContextMenu, IContextMenu3_iface); -@@ -188,6 +190,30 @@ static UINT max_menu_id(HMENU hmenu, UINT offset, UINT last) - return max_id; - } - -+static BOOL CheckClipboard(void) -+{ -+ IDataObject *pda; -+ BOOL ret = FALSE; -+ -+ if (SUCCEEDED(OleGetClipboard(&pda))) -+ { -+ STGMEDIUM medium; -+ FORMATETC formatetc; -+ -+ /* Set the FORMATETC structure*/ -+ InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_SHELLIDLISTW), TYMED_HGLOBAL); -+ -+ /* Get the pidls from IDataObject */ -+ if (SUCCEEDED(IDataObject_GetData(pda, &formatetc, &medium))) -+ { -+ ReleaseStgMedium(&medium); -+ ret = TRUE; -+ } -+ IDataObject_Release(pda); -+ } -+ return ret; -+} -+ - static HRESULT WINAPI ItemMenu_QueryContextMenu( - IContextMenu3 *iface, - HMENU hmenu, -@@ -199,6 +225,7 @@ static HRESULT WINAPI ItemMenu_QueryContextMenu( - ContextMenu *This = impl_from_IContextMenu3(iface); - MENUITEMINFOW mi; - INT uIDMax; -+ DWORD attr = SFGAO_CANRENAME; - - TRACE("(%p)->(%p %d 0x%x 0x%x 0x%x )\n", This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); - -@@ -232,6 +259,9 @@ static HRESULT WINAPI ItemMenu_QueryContextMenu( - - SetMenuDefaultItem(hmenu, 0, MF_BYPOSITION); - -+ if (This->apidl && This->cidl == 1) -+ IShellFolder_GetAttributesOf(This->parent, 1, (LPCITEMIDLIST*)This->apidl, &attr); -+ - if(uFlags & ~CMF_CANRENAME) - RemoveMenu(hmenu, FCIDM_SHVIEW_RENAME - FCIDM_BASE + idCmdFirst, MF_BYCOMMAND); - else -@@ -242,16 +272,14 @@ static HRESULT WINAPI ItemMenu_QueryContextMenu( - if (!This->apidl || This->cidl > 1) - enable |= MFS_DISABLED; - else -- { -- DWORD attr = SFGAO_CANRENAME; -- -- IShellFolder_GetAttributesOf(This->parent, 1, (LPCITEMIDLIST*)This->apidl, &attr); - enable |= (attr & SFGAO_CANRENAME) ? MFS_ENABLED : MFS_DISABLED; -- } - - EnableMenuItem(hmenu, FCIDM_SHVIEW_RENAME - FCIDM_BASE + idCmdFirst, enable); - } - -+ if ((attr & (SFGAO_FILESYSTEM|SFGAO_FOLDER)) != (SFGAO_FILESYSTEM|SFGAO_FOLDER) || !CheckClipboard()) -+ RemoveMenu(hmenu, FCIDM_SHVIEW_INSERT - FCIDM_BASE + idCmdFirst, MF_BYCOMMAND); -+ - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, uIDMax-idCmdFirst); - } - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); -@@ -791,6 +819,10 @@ static HRESULT WINAPI ItemMenu_InvokeCommand( - TRACE("Verb FCIDM_SHVIEW_CUT\n"); - DoCopyOrCut(This, lpcmi->hwnd, TRUE); - break; -+ case FCIDM_SHVIEW_INSERT: -+ TRACE("Verb FCIDM_SHVIEW_INSERT\n"); -+ DoPaste(This); -+ break; - case FCIDM_SHVIEW_PROPERTIES: - TRACE("Verb FCIDM_SHVIEW_PROPERTIES\n"); - DoOpenProperties(This, lpcmi->hwnd); -@@ -845,6 +877,9 @@ static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR c - case FCIDM_SHVIEW_COPY: - cmdW = L"copy"; - break; -+ case FCIDM_SHVIEW_INSERT: -+ cmdW = L"paste"; -+ break; - case FCIDM_SHVIEW_CREATELINK: - cmdW = L"link"; - break; --- -2.43.0 - diff --git a/patches/shell32-Context_Menu/0008-shell32-Recognize-cut-copy-paste-string-verbs-in-ite.patch b/patches/shell32-Context_Menu/0008-shell32-Recognize-cut-copy-paste-string-verbs-in-ite.patch deleted file mode 100644 index 11bb7778..00000000 --- a/patches/shell32-Context_Menu/0008-shell32-Recognize-cut-copy-paste-string-verbs-in-ite.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 295de3efbdb815a703e77c391ee1f3038987495b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sat, 2 Apr 2016 04:41:56 +0200 -Subject: [PATCH] shell32: Recognize cut/copy/paste string verbs in item menu - context menu. - ---- - dlls/shell32/shlview_cmenu.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c -index 3dce4a1fbac..8265993385f 100644 ---- a/dlls/shell32/shlview_cmenu.c -+++ b/dlls/shell32/shlview_cmenu.c -@@ -925,6 +925,12 @@ static HRESULT WINAPI ItemMenu_InvokeCommand( - DoCopyOrCut(This, lpcmi->hwnd, TRUE); - else if (strcmp(lpcmi->lpVerb,"properties")==0) - DoOpenProperties(This, lpcmi->hwnd); -+ else if (strcmp(lpcmi->lpVerb,"cut")==0) -+ DoCopyOrCut(This, lpcmi->hwnd, TRUE); -+ else if (strcmp(lpcmi->lpVerb,"copy")==0) -+ DoCopyOrCut(This, lpcmi->hwnd, FALSE); -+ else if (strcmp(lpcmi->lpVerb,"paste")==0) -+ DoPaste(This); - else { - FIXME("Unhandled string verb %s\n",debugstr_a(lpcmi->lpVerb)); - return E_FAIL; --- -2.30.2 - diff --git a/patches/shell32-Context_Menu/definition b/patches/shell32-Context_Menu/definition index d177a78e..d6c38054 100644 --- a/patches/shell32-Context_Menu/definition +++ b/patches/shell32-Context_Menu/definition @@ -1,3 +1,4 @@ Fixes: [34319] Add support for Paste in context menu Fixes: [34322] Fix implementation of Cut file operation Fixes: [34321] Fix Cut/Copy/Paste keyboard shortcuts in Total Commander +Disabled: true diff --git a/staging/upstream-commit b/staging/upstream-commit index 66edf653..3e79b52e 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -0fb7c99c33507ac494c9c35e15fb6df8b000cdd2 +c1b8db0c28ac5b7a14567bfb6df2c0af364de6a2