HXBOOL CWinRegKey::GetNextKey(CWinRegKey& rwrkNext) { if(!m_bOpen) { return FALSE; } char szName[128]; /* Flawfinder: ignore */ UINT32 ulSizeName=128; char szClass[128]; /* Flawfinder: ignore */ UINT32 ulSizeClass=128; FILETIME ftLastWrite; if ( RegEnumKeyEx ( m_hkThis, m_dwKeyEnumPos, OS_STRING2(szName, ulSizeName), &ulSizeName, NULL, OS_STRING2(szClass, ulSizeClass), &ulSizeClass, &ftLastWrite ) == ERROR_SUCCESS ) { ++m_dwKeyEnumPos; rwrkNext.SetRootKey(m_hkThis); rwrkNext.SetRelativePath(szName); rwrkNext.SetDesiredAccess(m_rsAccess); return TRUE; } return FALSE; }
void CWinUninstFind::DoReadStandardValues() { assert(!IsEndOfFind()); if (IsEndOfFind()) return; m_dwSysmteComponent = 0; m_strDisplayName = L""; m_strPublisher = L""; m_strUninstallString = L""; CString strKeyName = m_hRegKeyFind.GetFullRegPath(); CWinRegKey hRegKeyUninstall; LONG lRet = hRegKeyUninstall.Open(m_hRegKeyFind.m_hKeyParent, strKeyName, KEY_QUERY_VALUE); if (ERROR_SUCCESS == lRet) { // ..\\Uninstall\\..\\[DisplayName] LONG lRet = hRegKeyUninstall.QueryDWORDValue(WINMOD_REGVALUE_UNINST_SYSTEMCOMPONENT, m_dwSysmteComponent); if (ERROR_SUCCESS != lRet) m_dwSysmteComponent = 0; // no return lRet = hRegKeyUninstall.ExQueryStringValue(WINMOD_REGVALUE_UNINST_DISPLAYNAME, m_strDisplayName); if (ERROR_SUCCESS != lRet) m_strDisplayName = L""; // no return lRet = hRegKeyUninstall.ExQueryStringValue(WINMOD_REGVALUE_UNINST_PUBLISHER, m_strPublisher); if (ERROR_SUCCESS != lRet) m_strPublisher = L""; // no return lRet = hRegKeyUninstall.ExQueryStringValue(WINMOD_REGVALUE_UNINST_UNINSTALLSTRING, m_strUninstallString); if (ERROR_SUCCESS != lRet) m_strUninstallString = L""; // no return } }
HX_RESULT CWinRegKey::DeleteSubKey(const char* szName) { if(!m_bOpen) { return HXR_UNEXPECTED; } HX_RESULT pnrRes = HXR_FAIL; CWinRegKey wrkExpired; CWinRegKey wrkSub; wrkExpired.SetRootKey(m_hkThis); wrkExpired.SetRelativePath(szName); wrkExpired.SetDesiredAccess(KEY_ENUMERATE_SUB_KEYS|KEY_CREATE_SUB_KEY); if (SUCCEEDED(pnrRes = wrkExpired.Open())) { wrkExpired.ResetKeyEnumerator(); while(wrkExpired.GetNextKey(wrkSub)) { wrkExpired.DeleteSubKey(wrkSub.GetRelativePath()); wrkExpired.ResetKeyEnumerator(); } wrkExpired.Close(); pnrRes = HRESULT_FROM_WIN32(RegDeleteKey(m_hkThis, OS_STRING(szName))); } return pnrRes; }