  For a general time-inhomogenous diffusion process $X$ and a boundary function
$g,$ we analyse the probability $F(g)$ that $X$ stays beneath the boundary $g$
during a given finite time interval. We prove that, for $g \in C^2,$ the
functional $F(g)$ is G\^ateaux-differentiable in directions $h \in H \cup C^2,$
where $H$ is the Cameron--Martin space, and derive a compact representation for
the derivative of $F$. It is shown that, in the time-homogenous case, this
representation coincides with the representation in terms of Brownian meander
functionals obtained in this special case by Borovkov & Downes (2010). Our
results can be useful when approximating $F(g)$ with computable values
$F(\widehat{g})$ for special boundaries $\widehat{g}$ that are close to $g.$ We
also obtain auxiliary results that can be of independent interest as well:
(i)~a probabilistic expression for the limiting spatial derivative of the
boundary crossing probability with respect to the initial value of the process,
as the initial value approaches the boundary, and (ii) a martingale
representation for the indicator of the boundary non-crossing event for
time-dependent boundaries.
