Author: hbelusca
Date: Tue Jan 17 19:16:50 2017
New Revision: 73570
URL:
http://svn.reactos.org/svn/reactos?rev=73570&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/shell32/CExtractIcon.cpp
trunk/reactos/dll/win32/shell32/CNewMenu.cpp
trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp
trunk/reactos/dll/win32/shell32/folders.cpp
Modified: trunk/reactos/dll/win32/shell32/CExtractIcon.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CExtract…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CExtractIcon.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CExtractIcon.cpp [iso-8859-1] Tue Jan 17 19:16:50
2017
@@ -237,8 +237,7 @@
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;
Modified: trunk/reactos/dll/win32/shell32/CNewMenu.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CNewMenu…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CNewMenu.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CNewMenu.cpp [iso-8859-1] Tue Jan 17 19:16:50 2017
@@ -138,7 +138,7 @@
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;
Modified: trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/dialogs/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/dialogs/filedefext.cpp [iso-8859-1] Tue Jan 17
19:16:50 2017
@@ -362,7 +362,7 @@
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());
Modified: trunk/reactos/dll/win32/shell32/folders.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders.cpp [iso-8859-1] Tue Jan 17 19:16:50 2017
@@ -196,12 +196,12 @@
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 @@
if (_ILIsFolder (pidl))
{
if (SUCCEEDED(getIconLocationForFolder(psf,
- pidl, 0, wTemp, MAX_PATH,
+ pidl, 0, wTemp, _countof(wTemp),
&icon_idx,
&flags)))
{
@@ -221,21 +221,21 @@
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 @@
{
BOOL found = FALSE;
- if (_ILGetExtension(pidl, sTemp, MAX_PATH))
- {
- if (HCR_MapTypeToValueA(sTemp, sTemp, MAX_PATH, TRUE)
- && HCR_GetIconA(sTemp, sTemp, NULL, MAX_PATH,
&icon_idx))
+ if (_ILGetExtension(pidl, sTemp, _countof(sTemp)))
+ {
+ 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 @@
}
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 @@
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);
-
- if (SUCCEEDED(hr) && *sTemp)
+ hr = psl->GetIconLocation(wTemp, _countof(wTemp), &icon_idx);
+
+ 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);