mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[SHELL32] Fix regression of DoCreateSendToFiles
CoInitializeEx/CoUninitialize added. CORE-12562
This commit is contained in:
parent
4f7bb559fb
commit
79d21f7664
1 changed files with 24 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue