(17) Let the quadratic function $f(x)$ have a maximum value of 12 on the interval $[-1,4]$, and the solution set of the inequality $f(x)<0$ with respect to $x$ is $(0,5)$.
(1) Find the analytical expression of the function $f(x)$;
(2) If for any $x \in \mathbf{R}$, the inequality $f(2-2 \cos x)<f(1-\cos x-m)$ always holds, find the range of the real number $m$.
(17 (1) According to the problem, let
$$
f(x)=a x(x-5)(a>0),
$$

which is
$$
f(x)=a\left(x-\frac{5}{2}\right)^{2}-\frac{25}{4} a .
$$

Since $f(x)$ has a maximum value of 12 on $[-1,4]$, and $a>0$, the maximum value of $f(x)$ is obtained when $x=-1$, i.e., $f(-1)=6 a=12$, giving $a=2$. Therefore, $f(x)=2 x^{2}-10 x$.
(2) Let $t=1-\cos x(0 \leqslant t \leqslant 2)$, then the original inequality is transformed into $f(2 t)-\frac{5}{4}$ when $-m2,\end{array}\right.$ solving gives $m>1$.
When $-m=\frac{m+5}{3}$, i.e., $m=-\frac{5}{4}$, $\left(t-\frac{5}{4}\right)^{2}\frac{m+5}{3}$, i.e., $m2,\end{array}\right.$ solving gives $m<-5$.
In summary, the range of real number $m$ is $(-\infty,-5) \cup(1,+\infty)$.