A technique based on a tree-cotree decomposition, called Spanning Tree Technique (STT) in this paper, has been shown to be simple and efficient to compute the generalized source magnetic fields for h-oriented magnetostatic formulations when solenoidal source electric currents over the faces of the mesh are given as input. Yet, it has been recently shown that STT may frequently fail in practice.Other techniques, which circumvent STT problems, have been proposed in literature. However, all of them greatly worsen the computational complexity and memory requirements regarding the source field computation.The aim of this paper is to present a generalization of STT called Extended Spanning Tree Technique (ESTT), which is provably general and it retains the STT computational efficiency.