static void WriteOS2Data( unsigned_32 stub_len, os2_exe_header *exe_head ) /************************************************************************/ /* copy code from extra memory to loadfile. */ { group_entry *group; unsigned group_num; unsigned long off; segment_record segrec; unsigned_32 seg_addr; unsigned long relocsize; DEBUG(( DBG_BASE, "Writing data" )); group_num = 0; for( group = Groups; group != NULL; group = group->next_group ) { if( group->totalsize == 0 ) continue; // DANGER DANGER DANGER <--!!! segrec.info = group->segflags; // write segment segrec.min = MAKE_EVEN( group->totalsize ); segrec.size = MAKE_EVEN( group->size ); if( segrec.size != 0 ) { off = NullAlign( 1 << FmtData.u.os2.segment_shift ); seg_addr = off >> FmtData.u.os2.segment_shift; if( seg_addr > 0xffff ) { LnkMsg( ERR+MSG_ALIGN_TOO_SMALL, NULL ); }; segrec.address = (unsigned_16)seg_addr; WriteGroupLoad( group ); NullAlign( 2 ); // segment must be even length relocsize = WriteOS2Relocs( group ); if( relocsize != 0 ) { segrec.info |= SEG_RELOC; } } else {
static unsigned_32 WriteDOSRootRelocs( unsigned_32 mz_hdr_size ) /**************************************************************/ /* write all relocs to the file */ { unsigned long header_size; DumpRelocList( Root->reloclist ); NullAlign( 0x10 ); header_size = (unsigned long)Root->relocs * sizeof( dos_addr ) + mz_hdr_size; return( MAKE_PARA( header_size ) ); }