More fixes discovered based on Deedra's work.

This commit is contained in:
Storm Dragon committed 2026-10-23 16:08:58 -04:00
1 parent de31e5b513
commit 17052c5147
22 files changed
+561 -76

No files matched your search

+9 -3
View File
@@ -60,8 +60,10 @@ int list_view_index(HWND window, int *count) {
ListViewRow read_list_view(HWND window) {
ListViewRow row;
row.index = list_view_index(window, &row.count);
if (row.index < 0 || row.index >= row.count)
if (row.index < 0 || row.index >= row.count) {
row.available = row.count == 0;
return row;
}
DWORD_PTR state = 0;
if (query(window, LVM_GETITEMSTATE, row.index, LVIS_SELECTED, &state))
row.selected = state & LVIS_SELECTED;
@@ -77,6 +79,7 @@ ListViewRow read_list_view(HWND window) {
}
// Keep provider work and the protocol payload bounded even for huge tables.
if (columnCount > 8) columnCount = 8;
bool complete = true;
for (DWORD_PTR column = 0; column < columnCount; ++column) {
BYTE buffer[bufferSize] = {};
const auto textAddress = remote.address(textOffset);
@@ -92,9 +95,11 @@ ListViewRow read_list_view(HWND window) {
DWORD_PTR result = 0;
wchar_t text[textCapacity] = {};
if (!remote.write(buffer, sizeof(buffer)) ||
!query(window, LVM_GETITEMTEXTW, row.index, static_cast<LPARAM>(remote.address()), &result) ||
!remote.read(text, sizeof(text), textOffset))
!remote.query(window, LVM_GETITEMTEXTW, row.index, &result) ||
!remote.read(text, sizeof(text), textOffset)) {
complete = false;
break;
}
text[textCapacity - 1] = L'\0';
if (!text[0]) continue;
char utf8[textCapacity * 4] = {};
@@ -103,6 +108,7 @@ ListViewRow read_list_view(HWND window) {
if (!row.text.empty()) row.text += ", ";
row.text += utf8;
}
row.available = complete;
return row;
}