Add correct types for compare functions

This commit is contained in:
dmex
2026-02-01 17:48:58 +11:00
parent 06af9155c9
commit 6325685640
2 changed files with 30 additions and 8 deletions
+13 -7
View File
@@ -557,13 +557,13 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
break;
case ELVM_SETCOMPAREFUNCTION:
{
PPH_EXTLV_SETCOMPAREFUNCTION compare = (PPH_EXTLV_SETCOMPAREFUNCTION)lParam;
ULONG column = (ULONG)wParam;
PPH_COMPARE_FUNCTION compareFunction = (PPH_COMPARE_FUNCTION)lParam;
if (column >= PH_MAX_COMPARE_FUNCTIONS)
return FALSE;
context->CompareFunctions[column] = compareFunction;
context->CompareFunctions[column] = compare->CompareFunction;
}
return TRUE;
case ELVM_SETCONTEXT:
@@ -578,12 +578,16 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
return TRUE;
case ELVM_SETITEMCOLORFUNCTION:
{
context->ItemColorFunction = (PPH_EXTLV_GET_ITEM_COLOR)lParam;
PPH_EXTLV_SETITEMCOLORFUNCTION color = (PPH_EXTLV_SETITEMCOLORFUNCTION)lParam;
context->ItemColorFunction = color->ColorFunction;
}
return TRUE;
case ELVM_SETITEMFONTFUNCTION:
{
context->ItemFontFunction = (PPH_EXTLV_GET_ITEM_FONT)lParam;
PPH_EXTLV_SETITEMFONTFUNCTION font = (PPH_EXTLV_SETITEMFONTFUNCTION)lParam;
context->ItemFontFunction = font->FontFunction;
}
return TRUE;
case ELVM_SETREDRAW:
@@ -595,12 +599,12 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
if (context->EnableRedraw == 1)
{
SendMessage(WindowHandle, WM_SETREDRAW, TRUE, 0);
CallWindowProc(oldWndProc, WindowHandle, WM_SETREDRAW, TRUE, 0);
InvalidateRect(WindowHandle, NULL, FALSE);
}
else if (context->EnableRedraw == 0)
{
SendMessage(WindowHandle, WM_SETREDRAW, FALSE, 0);
CallWindowProc(oldWndProc, WindowHandle, WM_SETREDRAW, FALSE, 0);
}
}
return TRUE;
@@ -640,7 +644,9 @@ LRESULT CALLBACK PhpExtendedListViewWndProc(
return TRUE;
case ELVM_SETTRISTATECOMPAREFUNCTION:
{
context->TriStateCompareFunction = (PPH_COMPARE_FUNCTION)lParam;
PPH_EXTLV_SETCOMPAREFUNCTION compare = (PPH_EXTLV_SETCOMPAREFUNCTION)lParam;
context->TriStateCompareFunction = compare->CompareFunction;
}
return TRUE;
case ELVM_SORTITEMS:
+17 -1
View File
@@ -2017,6 +2017,22 @@ HFONT NTAPI PH_EXTLV_GET_ITEM_FONT(
);
typedef PH_EXTLV_GET_ITEM_FONT* PPH_EXTLV_GET_ITEM_FONT;
typedef struct _PH_EXTLV_SETCOMPAREFUNCTION
{
PPH_COMPARE_FUNCTION CompareFunction;
} PH_EXTLV_SETCOMPAREFUNCTION, *PPH_EXTLV_SETCOMPAREFUNCTION;
typedef struct _PH_EXTLV_SETITEMCOLORFUNCTION
{
PPH_EXTLV_GET_ITEM_COLOR ColorFunction;
} PH_EXTLV_SETITEMCOLORFUNCTION, *PPH_EXTLV_SETITEMCOLORFUNCTION;
typedef struct _PH_EXTLV_SETITEMFONTFUNCTION
{
PPH_EXTLV_GET_ITEM_FONT FontFunction;
} PH_EXTLV_SETITEMFONTFUNCTION, *PPH_EXTLV_SETITEMFONTFUNCTION;
PHLIBAPI
VOID
NTAPI
@@ -2044,10 +2060,10 @@ PhSetHeaderSortIcon(
// next 1122
#define ELVM_INIT (WM_APP + 1102)
#define ELVM_ADDFALLBACKCOLUMN (WM_APP + 1106)
#define ELVM_ADDFALLBACKCOLUMNS (WM_APP + 1109)
#define ELVM_RESERVED5 (WM_APP + 1120)
#define ELVM_INIT (WM_APP + 1102)
#define ELVM_SETCOLUMNWIDTH (WM_APP + 1121)
#define ELVM_SETCOMPAREFUNCTION (WM_APP + 1104)
#define ELVM_SETCONTEXT (WM_APP + 1103)