  We evaluate the Hadamard function and the vacuum expectation value of the
current density for a massive complex scalar field in the generalized geometry
of a straight cosmic string with a finite core enclosing an arbitrary
distributed magnetic flux along the string axis. For the interior geometry, a
general cylindrically symmetric static metric tensor is used with finite
support. In the region outside the core, both the Hadamard function and the
current density are decomposed into the idealized zero-thickness cosmic string
and core-induced contributions. The only nonzero component corresponds to the
azimuthal current. The zero-thickness part of the latter is a periodic function
of the magnetic flux inside the core, with the period equal to the quantum
flux. As a consequence of the direct interaction of the quantum field with the
magnetic field inside the penetrable core, the core-induced contribution, in
general, is not a periodic function of the flux. In addition, the vacuum
current, in general, is not a monotonic function of the distance from the
string and may change the sign. For a general model of the core interior, we
also evaluate the magnetic fields generated by the vacuum current. As
applications of the general results, we have considered an impenetrable core
modeled by Robin boundary condition, a core with the Minkowski-like interior
and a core with a constant positive curvature space. Various exactly solvable
distributions of the magnetic flux are discussed.
