inline int updateTableCounts(IAccessibleTableCell* tableCell, VBufStorage_buffer_t* tableBuffer) { IUnknown* unk = NULL; if (tableCell->get_table(&unk) != S_OK || !unk) return 0; IAccessible2* acc = NULL; HRESULT res; res = unk->QueryInterface(IID_IAccessible2, (void**)&acc); unk->Release(); if (res != S_OK || !acc) return 0; int docHandle, id; if (acc->get_windowHandle((HWND*)&docHandle) != S_OK || acc->get_uniqueID((long*)&id) != S_OK) { acc->Release(); return 0; } VBufStorage_controlFieldNode_t* node = tableBuffer->getControlFieldNodeWithIdentifier(docHandle, id); if (!node) { acc->Release(); return 0; } IAccessibleTable2* table = NULL; if (acc->QueryInterface(IID_IAccessibleTable2, (void**)&table) != S_OK || !table) { acc->Release(); return 0; } fillTableCounts<IAccessibleTable2>(node, acc, table); table->Release(); acc->Release(); return id; }