static SECURITY_STATUS nla_update_package_name(rdpNla* nla)
{
	BOOL rc;
	SECURITY_STATUS status;
	PSecPkgInfo pPackageInfo;

	if (!nla || !nla->table)
	{
		WLog_ERR(TAG, "[%s] nla->table=%p->%p", __FUNCTION__, nla, nla ? nla->table : NULL);
		return ERROR_INTERNAL_ERROR;
	}

	if (!nla->table->QuerySecurityPackageInfo || !nla->table->FreeContextBuffer)
	{
		WLog_ERR(TAG, "[%s] QuerySecurityPackageInfo=%p, FreeContextBuffer=%p", __FUNCTION__,
		         nla->table->QuerySecurityPackageInfo, nla->table->FreeContextBuffer);
		return ERROR_INTERNAL_ERROR;
	}
	status = nla->table->QuerySecurityPackageInfo(NLA_PKG_NAME, &pPackageInfo);

	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "QuerySecurityPackageInfo status %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(status), status);
		return status;
	}

	nla->cbMaxToken = pPackageInfo->cbMaxToken;
	rc = nla_set_package_name(nla, pPackageInfo->Name);
	status = nla->table->FreeContextBuffer(pPackageInfo);
	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "FreeContextBuffer status %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(status), status);
		return status;
	}
	if (!rc)
		return ERROR_WINS_INTERNAL;

	return status;
}
static SECURITY_STATUS nla_update_package_name(rdpNla* nla)
{
	BOOL rc;
	SECURITY_STATUS status;
	PSecPkgInfo pPackageInfo;

	if (!nla || !nla->table)
	{
		WLog_ERR(TAG, "[%s] nla->table=%p->%p", __FUNCTION__, nla, nla ? nla->table : NULL);
		return ERROR_INTERNAL_ERROR;
	}

	if (!nla->table->QuerySecurityPackageInfo || !nla->table->FreeContextBuffer)
	{
		WLog_ERR(TAG, "[%s] QuerySecurityPackageInfo=%p, FreeContextBuffer=%p", __FUNCTION__,
		         nla->table->QuerySecurityPackageInfo, nla->table->FreeContextBuffer);
		return ERROR_INTERNAL_ERROR;
	}
	status = nla->table->QuerySecurityPackageInfo(NLA_PKG_NAME, &pPackageInfo);

	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "QuerySecurityPackageInfo status %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(status), status);
		return status;
	}

	nla->cbMaxToken = pPackageInfo->cbMaxToken;
	rc = nla_set_package_name(nla, pPackageInfo->Name);
	status = nla->table->FreeContextBuffer(pPackageInfo);
	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "FreeContextBuffer status %s [0x%08" PRIX32 "]",
		         GetSecurityStatusString(status), status);
		return status;
	}
	if (!rc)
		return ERROR_WINS_INTERNAL;

	return status;
}