Skip to content

Commit 3319a16

Browse files
authored
[REGEDIT] Fix column string sort (reactos#8590)
JIRA issue: CORE-20434 Fix 3rd bug of CORE-20434. - Sort the columns as strings when REG_SZ, REG_EXPAND_SZ, and REG_MULTI_SZ.
1 parent 78c645e commit 3319a16

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

base/applications/regedit/listview.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,27 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
438438
return ((int)qw2 - (int)qw1);
439439
}
440440

441+
case REG_SZ:
442+
case REG_EXPAND_SZ:
443+
case REG_MULTI_SZ:
444+
{
445+
INT nCompare;
446+
size_t nCommonLength = min(l->val_len, r->val_len) / sizeof(WCHAR);
447+
if (pSortInfo->bSortAscending)
448+
{
449+
nCompare = StrCmpNW((WCHAR*)l->val, (WCHAR*)r->val, nCommonLength);
450+
if (nCompare == 0)
451+
nCompare = l->val_len - r->val_len;
452+
}
453+
else
454+
{
455+
nCompare = StrCmpNW((WCHAR*)r->val, (WCHAR*)l->val, nCommonLength);
456+
if (nCompare == 0)
457+
nCompare = r->val_len - l->val_len;
458+
}
459+
return nCompare;
460+
}
461+
441462
default:
442463
{
443464
INT nCompare = 0;

0 commit comments

Comments
 (0)