void CfgTest::WaitForSyncResolveAll(CFGDB_HANDLE cdhDb, RESOLUTION_CHOICE rcChoice) { HRESULT hr = S_OK; WaitForAutoSync(cdhDb); Assert::Equal<int>(1, m_pContext->m_backgroundConflicts.size()); if (cdhDb != m_pContext->m_backgroundConflicts.front().cdHandle) { hr = E_FAIL; ExitOnFailure(hr, "Conflicts found in different database than expected"); } CONFLICT_PRODUCT *pcplProductConflictList = m_pContext->m_backgroundConflicts.front().rgcpProduct; DWORD dwProductConflictCount = m_pContext->m_backgroundConflicts.front().cProduct; if (0 == dwProductConflictCount) { if (NULL != pcplProductConflictList) { hr = E_FAIL; ExitOnFailure(hr, "There should have been conflicts after syncing, but none were found, and in addition the list wasn't NULL!"); } hr = E_FAIL; ExitOnFailure(hr, "There should have been conflicts after syncing, but none were found!"); } for (DWORD dwProductIndex = 0; dwProductIndex < dwProductConflictCount; ++dwProductIndex) { for (DWORD dwValueIndex = 0; dwValueIndex < pcplProductConflictList[dwProductIndex].cValues; ++dwValueIndex) { pcplProductConflictList[dwProductIndex].rgrcValueChoices[dwValueIndex] = rcChoice; } } hr = CfgResolve(cdhDb, pcplProductConflictList, dwProductConflictCount); ExitOnFailure(hr, "Failed to resolve values"); LExit: if (NULL != pcplProductConflictList) { CfgReleaseConflictProductArray(pcplProductConflictList, dwProductConflictCount); dwProductConflictCount = 0; m_pContext->m_backgroundConflicts.clear(); } }
void BackgroundConflictsFoundCallback(CFGDB_HANDLE cdHandle, CONFLICT_PRODUCT *rgcpProduct, DWORD cProduct, LPVOID pvContext) { TestContext *pContext = (TestContext *)pvContext; BackgroundConflicts conflicts; conflicts.cdHandle = cdHandle; conflicts.rgcpProduct = rgcpProduct; conflicts.cProduct = cProduct; for (DWORD i = 0; i < pContext->m_backgroundConflicts.size(); ++i) { if (pContext->m_backgroundConflicts[i].cdHandle == cdHandle) { // We're getting new conflicts for the same DB, so release the old results and overwrite our array CfgReleaseConflictProductArray(pContext->m_backgroundConflicts[i].rgcpProduct, pContext->m_backgroundConflicts[i].cProduct); pContext->m_backgroundConflicts[i] = conflicts; return; } } pContext->m_backgroundConflicts.push_back(conflicts); }
void UtilFreeDatabase( BROWSE_DATABASE *pDatabase ) { ::DeleteCriticalSection(&pDatabase->cs); ReleaseStr(pDatabase->prodCurrent.sczName); ReleaseStr(pDatabase->prodCurrent.sczVersion); ReleaseStr(pDatabase->prodCurrent.sczPublicKey); ReleaseStr(pDatabase->sczPath); ReleaseStr(pDatabase->sczName); ReleaseStr(pDatabase->sczStatusMessage); ReleaseStr(pDatabase->sczCurrentProductDisplayName); ReleaseStr(pDatabase->sczValueName); CfgReleaseEnumeration(pDatabase->cehDatabaseList); CfgReleaseEnumeration(pDatabase->cehProductList); CfgReleaseEnumeration(pDatabase->cehValueList); CfgReleaseEnumeration(pDatabase->cehValueHistory); CfgReleaseConflictProductArray(pDatabase->pcplConflictProductList, pDatabase->dwConflictProductCount); }