https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4c25af5bd4ac8ea3bdfb8…
commit 4c25af5bd4ac8ea3bdfb855478683980922ed32b
Author: Muthu R Kumar <muthu90tech(a)gmail.com>
AuthorDate: Tue Dec 20 07:42:07 2022 -0800
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Dec 20 18:42:07 2022 +0300
[SHELL32] Fix detailed list views in Control Panel and Registry Folder
- Add enums for Control Panel and Registry Folder columns
- Fix iColumn values in GetDetailsOf() and fix checks in
GetDefaultColumnState()
Current CControlPanelFolder::CompareIDs was using wrong lparam column
index. Actual column index should be 1 instead of 4. Because of this
the comment column next to name in details view was not being displayed
correctly. The same fixes for CRegFolder class functions.
PR #4944. CORE-18743 CORE-18501
---
dll/win32/shell32/folders/CControlPanelFolder.cpp | 24 ++++++++++++++---------
dll/win32/shell32/folders/CRegFolder.cpp | 16 +++++++++++----
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/dll/win32/shell32/folders/CControlPanelFolder.cpp
b/dll/win32/shell32/folders/CControlPanelFolder.cpp
index 5782ed49d3c..ff62b2e964f 100644
--- a/dll/win32/shell32/folders/CControlPanelFolder.cpp
+++ b/dll/win32/shell32/folders/CControlPanelFolder.cpp
@@ -52,7 +52,12 @@ static const shvheader ControlPanelSFHeader[] = {
{IDS_SHV_COLUMN_COMMENTS, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT,
80},/*FIXME*/
};
-#define CONROLPANELSHELLVIEWCOLUMNS 2
+enum controlpanel_columns
+{
+ CONTROLPANEL_COL_NAME,
+ CONTROLPANEL_COL_COMMENT,
+ CONTROLPANEL_COL_COUNT,
+};
CControlPanelEnum::CControlPanelEnum()
{
@@ -324,16 +329,16 @@ HRESULT WINAPI CControlPanelFolder::CompareIDs(LPARAM lParam,
PCUIDLIST_RELATIVE
PIDLCPanelStruct *pData1 = _ILGetCPanelPointer(pidl1);
PIDLCPanelStruct *pData2 = _ILGetCPanelPointer(pidl2);
- if (!pData1 || !pData2 || LOWORD(lParam)>= CONROLPANELSHELLVIEWCOLUMNS)
+ if (!pData1 || !pData2 || LOWORD(lParam) >= CONTROLPANEL_COL_COUNT)
return E_INVALIDARG;
int result;
switch(LOWORD(lParam))
{
- case 0: /* name */
+ case CONTROLPANEL_COL_NAME:
result = wcsicmp(pData1->szName + pData1->offsDispName,
pData2->szName + pData2->offsDispName);
break;
- case 4: /* comment */
+ case CONTROLPANEL_COL_COMMENT:
result = wcsicmp(pData1->szName + pData1->offsComment,
pData2->szName + pData2->offsComment);
break;
default:
@@ -544,7 +549,8 @@ HRESULT WINAPI CControlPanelFolder::GetDefaultColumnState(UINT
iColumn, DWORD *p
{
TRACE("(%p)\n", this);
- if (!pcsFlags || iColumn >= CONROLPANELSHELLVIEWCOLUMNS) return E_INVALIDARG;
+ if (!pcsFlags || iColumn >= CONTROLPANEL_COL_COUNT)
+ return E_INVALIDARG;
*pcsFlags = ControlPanelSFHeader[iColumn].pcsFlags;
return S_OK;
}
@@ -557,7 +563,7 @@ HRESULT WINAPI CControlPanelFolder::GetDetailsEx(PCUITEMID_CHILD pidl,
const SHC
HRESULT WINAPI CControlPanelFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn,
SHELLDETAILS *psd)
{
- if (!psd || iColumn >= CONROLPANELSHELLVIEWCOLUMNS)
+ if (!psd || iColumn >= CONTROLPANEL_COL_COUNT)
return E_INVALIDARG;
if (!pidl)
@@ -579,14 +585,14 @@ HRESULT WINAPI CControlPanelFolder::GetDetailsOf(PCUITEMID_CHILD
pidl, UINT iCol
switch(iColumn)
{
- case 0: /* name */
+ case CONTROLPANEL_COL_NAME:
return SHSetStrRet(&psd->str, pCPanel->szName +
pCPanel->offsDispName);
- case 4: /* comment */
+ case CONTROLPANEL_COL_COMMENT:
return SHSetStrRet(&psd->str, pCPanel->szName +
pCPanel->offsComment);
}
}
- return S_OK;
+ return E_FAIL;
}
HRESULT WINAPI CControlPanelFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
diff --git a/dll/win32/shell32/folders/CRegFolder.cpp
b/dll/win32/shell32/folders/CRegFolder.cpp
index 11652661f01..464d00fe55b 100644
--- a/dll/win32/shell32/folders/CRegFolder.cpp
+++ b/dll/win32/shell32/folders/CRegFolder.cpp
@@ -212,6 +212,14 @@ class CRegFolderEnum :
END_COM_MAP()
};
+enum registry_columns
+{
+ REGISTRY_COL_NAME,
+ REGISTRY_COL_TYPE,
+ REGISTRY_COL_VALUE,
+ REGISTRY_COL_COUNT,
+};
+
CRegFolderEnum::CRegFolderEnum()
{
}
@@ -723,7 +731,7 @@ HRESULT WINAPI CRegFolder::GetDefaultColumn(DWORD dwRes, ULONG *pSort,
ULONG *pD
HRESULT WINAPI CRegFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
{
- if (iColumn >= 2)
+ if (iColumn >= REGISTRY_COL_COUNT)
return E_INVALIDARG;
*pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
return S_OK;
@@ -749,11 +757,11 @@ HRESULT WINAPI CRegFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT
iColumn, SHEL
switch(iColumn)
{
- case 0: /* name */
+ case REGISTRY_COL_NAME:
return GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER,
&psd->str);
- case 1: /* type */
+ case REGISTRY_COL_TYPE:
return SHSetStrRet(&psd->str, IDS_SYSTEMFOLDER);
- case 4: /* comments */
+ case REGISTRY_COL_VALUE:
HKEY hKey;
if (!HCR_RegOpenClassIDKey(*clsid, &hKey))
return SHSetStrRet(&psd->str, "");