The structure of stars with massive envelopes (M(env) greater than or similar to 14 M.) and degenerate neutron cores is discussed. In such stars, most of the luminosity arises from thermonuclear reactions taking place at the base of the convective envelope. The proton-rich material in this region, continuously linked to the outer regions by convection, provides an ideal site for the rp-process. In addition, material may repeatedly pass through the burning zone, with large intervals between each passage, allowing the formation of heavy nuclei up to A approximately 150. Evolutionary calculations are presented of the structure of such stars and of the nucleosynthesis in their envelopes. A lower mass limit of approximately 14 M. is found for stars of this type. Assuming a lifetime of greater than or similar to 10(5) significant fraction, approximately 5 per cent, of the envelope mass is converted to metals beyond iron, and, for a restricted range of masses (depending on the somewhat uncertain details of envelope convection), some of the p-nuclei are produced in relative abundances reminiscent of those found for the Solar system. The abundance peak at molybdenum is, however, not reproduced. If Thorne-Zytkow objects are a later stage in the evolution of massive X-ray binaries then, even if only a small fraction of Thorne-Zytkow objects produce the more massive p-nuclei, the progenitor population is sufficiently large to account for the observed abundances of some of these nuclei.