static SECURITY_STATUS nla_initialize_security_context(rdpNla* nla, BOOL initial,
                                                       SecBufferDesc* pInputBufferDesc,
                                                       SecBufferDesc* pOutputBufferDesc)
{
	SECURITY_STATUS status;
	PCtxtHandle ctx = NULL;

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

	status = nla->table->InitializeSecurityContext(
	    &nla->credentials, ctx, nla->ServicePrincipalName, nla->fContextReq, 0,
	    SECURITY_NATIVE_DREP, pInputBufferDesc, 0, &nla->context, pOutputBufferDesc,
	    &nla->pfContextAttr, &nla->expiration);

	switch (status)
	{
		case SEC_E_INCOMPLETE_MESSAGE:
		case SEC_E_OK:
		case SEC_I_COMPLETE_AND_CONTINUE:
		case SEC_I_COMPLETE_NEEDED:
		case SEC_I_CONTINUE_NEEDED:
		case SEC_I_INCOMPLETE_CREDENTIALS:
			WLog_DBG(TAG, " InitializeSecurityContext status %s [0x%08" PRIX32 "]",
			         GetSecurityStatusString(status), status);
			break;

		default:
			WLog_WARN(TAG, " InitializeSecurityContext failure status %s [0x%08" PRIX32 "]",
			          GetSecurityStatusString(status), status);
			break;
	}

	return status;
}
static SECURITY_STATUS nla_initialize_security_context(rdpNla* nla, BOOL initial,
                                                       SecBufferDesc* pInputBufferDesc,
                                                       SecBufferDesc* pOutputBufferDesc)
{
	SECURITY_STATUS status;
	PCtxtHandle ctx = NULL;

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

	status = nla->table->InitializeSecurityContext(
	    &nla->credentials, ctx, nla->ServicePrincipalName, nla->fContextReq, 0,
	    SECURITY_NATIVE_DREP, pInputBufferDesc, 0, &nla->context, pOutputBufferDesc,
	    &nla->pfContextAttr, &nla->expiration);

	switch (status)
	{
		case SEC_E_INCOMPLETE_MESSAGE:
		case SEC_E_OK:
		case SEC_I_COMPLETE_AND_CONTINUE:
		case SEC_I_COMPLETE_NEEDED:
		case SEC_I_CONTINUE_NEEDED:
		case SEC_I_INCOMPLETE_CREDENTIALS:
			WLog_DBG(TAG, " InitializeSecurityContext status %s [0x%08" PRIX32 "]",
			         GetSecurityStatusString(status), status);
			break;

		default:
			WLog_WARN(TAG, " InitializeSecurityContext failure status %s [0x%08" PRIX32 "]",
			          GetSecurityStatusString(status), status);
			break;
	}

	return status;
}