mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-27 03:43:36 +00:00
[SHELL32]
- Use explicit unicode SHFILEINFOW structure (where needed); - In CFSExtractIcon_CreateInstance, use _countof instead of hardcoding the MAX_PATHs; add some FIXMEs about the 'flags' parameter; - Code formatting in CExtractIcon.cpp. svn path=/trunk/; revision=73570
This commit is contained in:
@@ -237,8 +237,7 @@ HRESULT STDMETHODCALLTYPE CExtractIcon::GetIconLocation(
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hr = GetIconLocation(
|
||||
uFlags, szIconFileW, cchMax, piIndex, pwFlags);
|
||||
hr = GetIconLocation(uFlags, szIconFileW, cchMax, piIndex, pwFlags);
|
||||
if (SUCCEEDED(hr) && cchMax > 0)
|
||||
if (0 == WideCharToMultiByte(CP_ACP, 0, szIconFileW, cchMax, szIconFile, cchMax, NULL, NULL))
|
||||
hr = E_FAIL;
|
||||
|
||||
@@ -138,7 +138,7 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPCWSTR pwszExt)
|
||||
if (!Types[i].pszName)
|
||||
return NULL;
|
||||
|
||||
SHFILEINFO fi;
|
||||
SHFILEINFOW fi;
|
||||
if (!SHGetFileInfoW(pwszExt, FILE_ATTRIBUTE_NORMAL, &fi, sizeof(fi), SHGFI_USEFILEATTRIBUTES|SHGFI_TYPENAME|SHGFI_ICON|SHGFI_SMALLICON))
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ CFileDefExt::InitFileType(HWND hwndDlg)
|
||||
return FALSE;
|
||||
|
||||
/* Get file information */
|
||||
SHFILEINFO fi;
|
||||
SHFILEINFOW fi;
|
||||
if (!SHGetFileInfoW(m_wszPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME|SHGFI_ICON))
|
||||
{
|
||||
ERR("SHGetFileInfoW failed for %ls (%lu)\n", m_wszPath, GetLastError());
|
||||
|
||||
@@ -196,12 +196,12 @@ GetIconOverlay(LPCITEMIDLIST pidl, WCHAR * wTemp, int* pIndex)
|
||||
|
||||
HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, REFIID iid, LPVOID * ppvOut)
|
||||
{
|
||||
CComPtr<IDefaultExtractIconInit> initIcon;
|
||||
CComPtr<IDefaultExtractIconInit> initIcon;
|
||||
HRESULT hr;
|
||||
int icon_idx;
|
||||
UINT flags;
|
||||
CHAR sTemp[MAX_PATH];
|
||||
WCHAR wTemp[MAX_PATH];
|
||||
int icon_idx = 0;
|
||||
UINT flags = 0; // FIXME: Use it!
|
||||
CHAR sTemp[MAX_PATH] = "";
|
||||
WCHAR wTemp[MAX_PATH] = L"";
|
||||
|
||||
hr = SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit,&initIcon));
|
||||
if (FAILED(hr))
|
||||
@@ -210,7 +210,7 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
|
||||
if (_ILIsFolder (pidl))
|
||||
{
|
||||
if (SUCCEEDED(getIconLocationForFolder(psf,
|
||||
pidl, 0, wTemp, MAX_PATH,
|
||||
pidl, 0, wTemp, _countof(wTemp),
|
||||
&icon_idx,
|
||||
&flags)))
|
||||
{
|
||||
@@ -221,21 +221,21 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
|
||||
initIcon->SetShortcutIcon(wTemp, icon_idx);
|
||||
}
|
||||
if (SUCCEEDED(getIconLocationForFolder(psf,
|
||||
pidl, GIL_DEFAULTICON, wTemp, MAX_PATH,
|
||||
pidl, GIL_DEFAULTICON, wTemp, _countof(wTemp),
|
||||
&icon_idx,
|
||||
&flags)))
|
||||
{
|
||||
initIcon->SetDefaultIcon(wTemp, icon_idx);
|
||||
}
|
||||
// if (SUCCEEDED(getIconLocationForFolder(psf,
|
||||
// pidl, GIL_FORSHORTCUT, wTemp, MAX_PATH,
|
||||
// pidl, GIL_FORSHORTCUT, wTemp, _countof(wTemp),
|
||||
// &icon_idx,
|
||||
// &flags)))
|
||||
// {
|
||||
// initIcon->SetShortcutIcon(wTemp, icon_idx);
|
||||
// }
|
||||
if (SUCCEEDED(getIconLocationForFolder(psf,
|
||||
pidl, GIL_OPENICON, wTemp, MAX_PATH,
|
||||
pidl, GIL_OPENICON, wTemp, _countof(wTemp),
|
||||
&icon_idx,
|
||||
&flags)))
|
||||
{
|
||||
@@ -246,10 +246,10 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
|
||||
{
|
||||
BOOL found = FALSE;
|
||||
|
||||
if (_ILGetExtension(pidl, sTemp, MAX_PATH))
|
||||
if (_ILGetExtension(pidl, sTemp, _countof(sTemp)))
|
||||
{
|
||||
if (HCR_MapTypeToValueA(sTemp, sTemp, MAX_PATH, TRUE)
|
||||
&& HCR_GetIconA(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
|
||||
if (HCR_MapTypeToValueA(sTemp, sTemp, _countof(sTemp), TRUE)
|
||||
&& HCR_GetIconA(sTemp, sTemp, NULL, _countof(sTemp), &icon_idx))
|
||||
{
|
||||
if (!lstrcmpA("%1", sTemp)) /* icon is in the file */
|
||||
{
|
||||
@@ -258,7 +258,7 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, sTemp, -1, wTemp, MAX_PATH);
|
||||
MultiByteToWideChar(CP_ACP, 0, sTemp, -1, wTemp, _countof(wTemp));
|
||||
}
|
||||
|
||||
found = TRUE;
|
||||
@@ -266,21 +266,20 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE
|
||||
else if (!lstrcmpiA(sTemp, "lnkfile"))
|
||||
{
|
||||
/* extract icon from shell shortcut */
|
||||
CComPtr<IShellLinkW> psl;
|
||||
CComPtr<IShellLinkW> psl;
|
||||
|
||||
HRESULT hr = psf->GetUIObjectOf(NULL, 1, &pidl, IID_NULL_PPV_ARG(IShellLinkW, &psl));
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = psl->GetIconLocation(wTemp, MAX_PATH, &icon_idx);
|
||||
hr = psl->GetIconLocation(wTemp, _countof(wTemp), &icon_idx);
|
||||
|
||||
if (SUCCEEDED(hr) && *sTemp)
|
||||
if (SUCCEEDED(hr) && *wTemp)
|
||||
found = TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: We should normally use the correct icon format according to 'flags' */
|
||||
if (!found)
|
||||
/* default icon */
|
||||
initIcon->SetNormalIcon(swShell32Name, 0);
|
||||
|
||||
Reference in New Issue
Block a user