  We consider a twisted version of the four-dimensional N=4 supersymmetric
Yang-Mills theory with gauge groups SU(2) and SO(3), and bare masses for two of
its chiral multiplets, thereby breaking N=4 down to N=2. Using the
wall-crossing technique introduced by Moore and Witten within the u-plane
approach to twisted topological field theories, we compute the partition
function and all the topological correlation functions for the case of
simply-connected spin four-manifolds of simple type. By including 't Hooft
fluxes, we analyse the properties of the resulting formulae under duality
transformations. The partition function transforms in the same way as the one
first presented by Vafa and Witten for another twist of the N=4 supersymmetric
theory in their strong coupling test of S-duality. Both partition functions
coincide on K3. The topological correlation functions turn out to transform
covariantly under duality, following a simple pattern which seems to be
inherent in a general type of topological quantum field theories.
