src/Cedar/SW.c
// Uninstall all the old MSI products

Uninstall all the old MSI products
Uninstall all the old MSI products
bool SwUninstallOldMsiInstalled(HWND hWnd, WIZARD_PAGE* wp, SW_COMPONENT* c, bool* reboot_required)
{
	UINT i;
	bool dummy_bool = false;
	if (c == NULL || wp == NULL)
	{
		return true;
	}
	if (reboot_required == NULL)
	{
		reboot_required = &dummy_bool;
	}
	*reboot_required = false;
	if (c->OldMsiList == NULL)
	{
		return true;
	}
	for (i = 0;i < c->NumOldMsi;i++)
	{
		SW_OLD_MSI* m = &c->OldMsiList[i];
		wchar_t tmp[MAX_SIZE];
		if (MsGetMsiInstalledDir(m->ComponentCode, tmp, sizeof(tmp)))
		{
			bool rr = false;
			wchar_t msg[MAX_SIZE];
		LABEL_RETRY:
			UniFormat(msg, sizeof(msg), _UU("SW_PERFORM_MSG_UNINSTALL_MSI"), c->Title);
			SwPerformPrint(wp, msg);
			if (MsMsiUninstall(m->ProductCode, hWnd, &rr) == false)
			{
				UniFormat(msg, sizeof(msg), _UU("SW_MSI_UNINSTALL_FAILED"), c->Title, m->ProductCode);
				if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, msg) == IDRETRY)
				{
					goto LABEL_RETRY;
				}
				return false;
			}
			else
			{
				if (rr)
				{
					*reboot_required = true;
					return true;
				}
			}
		}
	}
	return true;
}
bool SwUninstallOldMsiInstalled ( HWND hWnd , WIZARD_PAGE * wp , SW_COMPONENT * c , bool * reboot_required ) { UINT i ; bool dummy_bool = false ; if ( c == NULL || wp == NULL ) { return true ; } if ( reboot_required == NULL ) { reboot_required = & dummy_bool ; } * reboot_required = false ; if ( c -> OldMsiList == NULL ) { return true ; } for ( i = 0 ; i < c -> NumOldMsi ; i ++ ) { SW_OLD_MSI * m = & c -> OldMsiList [ i ] ; wchar_t tmp [ MAX_SIZE ] ; if ( MsGetMsiInstalledDir ( m -> ComponentCode , tmp , sizeof ( tmp ) ) ) { bool rr = false ; wchar_t msg [ MAX_SIZE ] ; LABEL_RETRY : UniFormat ( msg , sizeof ( msg ) , _UU ( " " ) , c -> Title ) ; SwPerformPrint ( wp , msg ) ; if ( MsMsiUninstall ( m -> ProductCode , hWnd , & rr ) == false ) { UniFormat ( msg , sizeof ( msg ) , _UU ( " " ) , c -> Title , m -> ProductCode ) ; if ( SwPerformMsgBox ( wp , MB_ICONEXCLAMATION | MB_RETRYCANCEL , msg ) == IDRETRY ) { goto LABEL_RETRY ; } return false ; } else { if ( rr ) { * reboot_required = true ; return true ; } } } } return true ; }
Uninstall all the old MSI products
Uninstall all the old MSI products
// Validate arguments
