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; }