https://git.reactos.org/?p=reactos.git;a=commitdiff;h=79d21f76644bbc890b53a…
commit 79d21f76644bbc890b53a9cd2beab7af6bc62fa3
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Dec 1 13:55:43 2019 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sun Dec 1 13:55:43 2019 +0900
[SHELL32] Fix regression of DoCreateSendToFiles
CoInitializeEx/CoUninitialize added.
CORE-12562
---
dll/win32/shell32/wine/shellpath.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dll/win32/shell32/wine/shellpath.c b/dll/win32/shell32/wine/shellpath.c
index 6974a4d9628..3c1906375fe 100644
--- a/dll/win32/shell32/wine/shellpath.c
+++ b/dll/win32/shell32/wine/shellpath.c
@@ -2195,6 +2195,28 @@ CreateShellLink(
return hr;
}
+static HRESULT
+CreateShellLinkCoInit(
+ LPCWSTR pszLinkPath,
+ LPCWSTR pszCmd,
+ LPCWSTR pszArg OPTIONAL,
+ LPCWSTR pszDir OPTIONAL,
+ LPCWSTR pszIconPath OPTIONAL,
+ INT iIconNr OPTIONAL,
+ LPCWSTR pszComment OPTIONAL)
+{
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ BOOL bCoInit = (hr == S_OK);
+
+ hr = CreateShellLink(pszLinkPath, pszCmd, pszArg, pszDir,
+ pszIconPath, iIconNr, pszComment);
+
+ if (bCoInit)
+ CoUninitialize();
+
+ return hr;
+}
+
HRESULT DoCreateSendToFiles(LPCWSTR pszSendTo)
{
WCHAR szTarget[MAX_PATH];
@@ -2212,8 +2234,8 @@ HRESULT DoCreateSendToFiles(LPCWSTR pszSendTo)
GetSystemDirectoryW(szShell32, ARRAY_SIZE(szShell32));
PathAppendW(szShell32, L"shell32.dll");
- hr = CreateShellLink(szSendToFile, szTarget, NULL, NULL,
- szShell32, -IDI_SHELL_MY_DOCUMENTS, NULL);
+ hr = CreateShellLinkCoInit(szSendToFile, szTarget, NULL, NULL,
+ szShell32, -IDI_SHELL_MY_DOCUMENTS, NULL);
if (FAILED_UNEXPECTEDLY(hr))
return hr;