mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 05:26:58 +00:00
[SHELL32]
- Fix copying files in New menu. Fixes WinRAR new items. - Don't show message if copying file failed because empty file is already created svn path=/trunk/; revision=54923
This commit is contained in:
parent
dc8fff1c5a
commit
41a8364f1c
|
@ -118,15 +118,15 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPCWSTR pwszExt)
|
||||||
/* Find first valid value */
|
/* Find first valid value */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
LPCSTR pszName;
|
LPCWSTR pszName;
|
||||||
SHELLNEW_TYPE Type;
|
SHELLNEW_TYPE Type;
|
||||||
BOOL bNeedData;
|
BOOL bNeedData;
|
||||||
BOOL bStr;
|
BOOL bStr;
|
||||||
} Types[] = {
|
} Types[] = {
|
||||||
{"FileName", SHELLNEW_TYPE_FILENAME, TRUE, TRUE},
|
{L"FileName", SHELLNEW_TYPE_FILENAME, TRUE, TRUE},
|
||||||
{"Command", SHELLNEW_TYPE_COMMAND, TRUE, TRUE},
|
{L"Command", SHELLNEW_TYPE_COMMAND, TRUE, TRUE},
|
||||||
{"Data", SHELLNEW_TYPE_DATA, TRUE, FALSE},
|
{L"Data", SHELLNEW_TYPE_DATA, TRUE, FALSE},
|
||||||
{"NullFile", SHELLNEW_TYPE_NULLFILE, FALSE},
|
{L"NullFile", SHELLNEW_TYPE_NULLFILE, FALSE},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
UINT i;
|
UINT i;
|
||||||
|
@ -136,12 +136,20 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPCWSTR pwszExt)
|
||||||
/* Note: We are using ANSI function because strings can be treated as data */
|
/* Note: We are using ANSI function because strings can be treated as data */
|
||||||
cbData = 0;
|
cbData = 0;
|
||||||
DWORD dwFlags = Types[i].bStr ? RRF_RT_REG_SZ : RRF_RT_ANY;
|
DWORD dwFlags = Types[i].bStr ? RRF_RT_REG_SZ : RRF_RT_ANY;
|
||||||
if (RegGetValueA(hKey, NULL, Types[i].pszName, dwFlags, NULL, NULL, &cbData) == ERROR_SUCCESS)
|
DWORD dwType;
|
||||||
|
if (RegGetValueW(hKey, NULL, Types[i].pszName, dwFlags, NULL, NULL, &cbData) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (Types[i].bNeedData && cbData > 0)
|
if (Types[i].bNeedData && cbData > 0)
|
||||||
{
|
{
|
||||||
pData = (BYTE*)malloc(cbData);
|
pData = (BYTE*)malloc(cbData);
|
||||||
RegGetValueA(hKey, NULL, Types[i].pszName, dwFlags, NULL, pData, &cbData);
|
RegGetValueW(hKey, NULL, Types[i].pszName, dwFlags, &dwType, pData, &cbData);
|
||||||
|
if (!Types[i].bStr && (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
|
||||||
|
{
|
||||||
|
PBYTE pData2 = (PBYTE)malloc(cbData);
|
||||||
|
cbData = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)pData, -1, (LPSTR)pData2, cbData, NULL, NULL);
|
||||||
|
free(pData);
|
||||||
|
pData = pData2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +502,8 @@ HRESULT CNewMenu::CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcm
|
||||||
if (pItem->Type == SHELLNEW_TYPE_FILENAME)
|
if (pItem->Type == SHELLNEW_TYPE_FILENAME)
|
||||||
{
|
{
|
||||||
/* Copy file */
|
/* Copy file */
|
||||||
bSuccess = CopyFileW((LPWSTR)pItem->pData, wszPath, FALSE);
|
if (!CopyFileW((LPWSTR)pItem->pData, wszPath, FALSE))
|
||||||
|
ERR("Copy file failed: %ls\n", (LPWSTR)pItem->pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show message if we failed */
|
/* Show message if we failed */
|
||||||
|
|
Loading…
Reference in a new issue