Beispiel #1
0
static bool writeCurDir( FullCurDir *dir, WResID *name, ResMemFlags flags,
                        int *err_code )
/****************************************************************************/
{
    bool                error;
    FullCurDirEntry *   entry;
    ResLocation         loc;

    loc.start = SemStartResource();
    error = ResWriteIconCurDirHeader( &(dir->Header), CurrResFile.handle );

    for( entry = dir->Head; !error && entry != NULL; entry = entry->Next ) {
        error = ResWriteCurDirEntry( &(entry->Entry.Res), CurrResFile.handle );
    }

    if( !error ) {
        loc.len = SemEndResource( loc.start );
#ifdef PREPROC_BUG
        SemAddResourceFree( name, WResIDFromNum( (long)(pointer_int)RT_GROUP_CURSOR ),
                         flags, loc );
#else
        SemAddResourceFree( name, WResIDFromNum( (long)12 ),
                         flags, loc );
#endif
    } else {
        *err_code = LastWresErr();
    }

    return( error );
}
Beispiel #2
0
void SemOS2WriteAccelTable( WResID *name, ResMemFlags flags, uint_32 codepage,
                                                FullAccelTableOS2 *acctable )
/****************************************************************************/
{
    ResLocation     loc;
    bool            error;
    int             err_code;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        error = writeAccelTableEntries( acctable, CurrResFile.fid, codepage );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_ACCELTABLE ), flags, loc );
    } else {
        RESFREE( name );
    }

    SemOS2FreeAccelTable( acctable );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = true;
    SemOS2FreeAccelTable( acctable );
    return;
}
Beispiel #3
0
void SemOS2WriteMenu( WResID *name, ResMemFlags flags, FullMenuOS2 *menu,
                   YYTOKENTYPE tokentype, uint_32 codepage )
/***********************************************************************/
{
    ResLocation     loc;
    int             error;
    int             err_code;

    tokentype = tokentype;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        error = SemOS2WriteSubMenu( menu, &err_code, codepage );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_MENU ), flags, loc );
    } else {
        RCFREE( name );
    }

    SemOS2FreeSubMenu( menu );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = TRUE;
    SemOS2FreeSubMenu( menu );
    return;
}
void SemOS2WriteHelpSubTable( WResID * name, int numWords,
                                     ResMemFlags flags,
                                     FullHelpSubTableOS2 * helptable )
/********************************************************************/
{
    ResLocation     loc;
    bool            error;
    int             err_code;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        if( helptable != NULL ) {
            helptable->numWords = numWords;
        }
        error = SemOS2WriteHelpSubTableEntries( helptable, CurrResFile.handle );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_HELPSUBTABLE ), flags, loc );
    } else {
        RCFREE( name );
    }

    SemOS2FreeHelpSubTable( helptable );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = true;
    SemOS2FreeHelpSubTable( helptable );
    return;

}
Beispiel #5
0
extern void SemOS2WriteHelpTable( WResID * name, ResMemFlags flags,
                                   FullHelpTableOS2 * helptable )
/******************************************************************/
{
    ResLocation     loc;
    int             error;
    int             err_code;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        error = SemOS2WriteHelpTableEntries( helptable, CurrResFile.handle );
        if(error) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_HELPTABLE ), flags, loc );
    } else {
        RcMemFree( name );
    }

    SemOS2FreeHelpTable( helptable );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
             strerror( err_code ) );
    ErrorHasOccured = TRUE;
    SemOS2FreeHelpTable( helptable );
    return;

}
Beispiel #6
0
static RcStatus copyBitmap( BitmapFileHeader *head, WResFileID handle,
                            WResID *name, ResMemFlags flags, int *err_code )
/**************************************************************************/
{
    RcStatus            ret;
    char *              buffer;
    ResLocation         loc;
    WResFileOffset      pos;

    buffer = RCALLOC( BITMAP_BUFFER_SIZE );

    loc.start = SemStartResource();

    pos = RCTELL( handle );
    if( pos == -1 ) {
        ret = RS_READ_ERROR;
        *err_code = errno;
    } else {
        ret = CopyData( pos, head->Size - sizeof(BitmapFileHeader),
                          handle, buffer, BITMAP_BUFFER_SIZE, err_code );
    }

    loc.len = SemEndResource( loc.start );
    /* add the bitmap to the RES file directory */
    SemAddResourceFree( name, WResIDFromNum( (long)(pointer_int)RT_BITMAP ), flags, loc );

    RCFREE( buffer );

    return( ret );
} /* copyBitmap */
Beispiel #7
0
extern void SemOS2AddDlgincResource( WResID *name, char *filename )
/*****************************************************************/
{
    ResLocation loc;
    int         error, err_code;

    loc.start = SemStartResource();
    error = ResWriteString( filename, FALSE, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }
    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DLGINCLUDE ),
                        MEMFLAG_DISCARDABLE | MEMFLAG_MOVEABLE | MEMFLAG_PURE,
                        loc );
    RcMemFree( filename );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
             strerror( err_code ) );
    ErrorHasOccured = TRUE;
    RcMemFree( filename );
    return;
}
Beispiel #8
0
static RcStatus copyFont( FontInfo * info, WResFileID handle, WResID * name,
                                ResMemFlags flags, int *err_code )
/************************************************************************/
{
    RcStatus            ret;
    char *              buffer;
    ResLocation         loc;
    long                pos;

    buffer = RCALLOC( FONT_BUFFER_SIZE );

    loc.start = SemStartResource();

    if( ResWriteFontInfo( info, CurrResFile.handle ) ) {
        ret = RS_WRITE_ERROR;
        *err_code = LastWresErr();
    } else {
        pos = RCTELL( handle );
        if( pos == -1 ) {
            ret = RS_READ_ERROR;
            *err_code = errno;
        } else {
            ret = SemCopyDataUntilEOF( pos, handle, buffer,
                                         FONT_BUFFER_SIZE, err_code );
        }
    }

    loc.len = SemEndResource( loc.start );
    /* add the font to the RES file directory */
    SemAddResourceFree( name, WResIDFromNum( (long)RT_FONT ), flags, loc );

    RCFREE( buffer );

    return( ret );
} /* copyFont */
Beispiel #9
0
/* The OS/2 dialog templates present us with a problem because the
   template items contain a number of offsets that are not known until
   the template is processed; this means we cannot just start spitting
   the data into a file. Instead we build an in-memory image of the
   resource (the size must be < 64K) and then dump the entire resource
   into the file - which certainly shouldn't hurt performance either.
*/
extern void SemOS2WriteDialogTemplate( WResID *name, ResMemFlags flags,
                                       uint_32 codepage,
                                       FullDiagCtrlListOS2 *ctrls )
/*********************************************************************/
{
    ResLocation              loc;
    int                      err_code;
    int                      error;
    int                      size;
    DialogHeaderOS2          *head = NULL;
    char                     *tmpl;
    char                     *ptr;

    size = sizeof( DialogHeaderOS2 ) + SemOS2CalcControlSize( ctrls );
    if( size > 65536 ) {
        // TODO: Error, template is too big
    }

    tmpl = RcMemMalloc( size );

    head = (DialogHeaderOS2 *)tmpl;
    InitOS2DialogBoxHeader( head, codepage );
    head->Size = size;
    ptr = tmpl + sizeof( DialogHeaderOS2 );

    // Create the DLGTITEM array in memory
    ptr = SemOS2BuildTemplateArray( ptr, ctrls );

    // Dump all other data into memory and update the offsets
    SemOS2DumpTemplateData( tmpl, ptr, ctrls );

    // Write the resource to file
    loc.start = SemStartResource();

    error = ResOS2WriteDlgTemplate( tmpl, size, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }

    RcMemFree( tmpl );

    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DIALOG ), flags, loc );

    SemOS2FreeDiagCtrlList( ctrls );

    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
                strerror( err_code )  );
    ErrorHasOccured = TRUE;
    SemOS2FreeDiagCtrlList( ctrls );
    return;
} /* SemOS2WriteDialogTemplate */
Beispiel #10
0
static RcStatus copyCursors( FullCurDir * dir, WResFileID handle,
                             ResMemFlags flags, int *err_code )
/***********************************************************************/
/* This function uses the same size of buffers to copy info as for icons */
{
    RcStatus            ret = RS_OK; // should this be RS_PARAM_ERROR ??
    char *              buffer;
    FullCurDirEntry *   entry;
    CurFileDirEntry     fileentry;
    CurHotspot          hotspot;
    BitmapInfoHeader    dibhead;
    ResLocation         loc;

    buffer = RCALLOC( BUFFER_SIZE );

    for( entry = dir->Head; entry != NULL; entry = entry->Next ) {
        /* copy the cursor */
        loc.start = SemStartResource();

        hotspot.X = entry->Entry.Cur.XHotspot;
        hotspot.Y = entry->Entry.Cur.YHotspot;
        if( ResWriteCurHotspot( &hotspot, CurrResFile.handle ) ) {
            ret = RS_WRITE_ERROR;
            *err_code = LastWresErr();
            break;
        }

        /* NOTE: the dibhead structure is filled in as a result of this call */
        ret = copyOneCursor( &(entry->Entry.Cur), handle, buffer,
                        BUFFER_SIZE, &(dibhead), err_code );
        if( ret != RS_OK )
            break;

        loc.len = SemEndResource( loc.start );
        /* add the cursor to the RES file directory */
        SemAddResourceFree( WResIDFromNum( CurrResFile.NextCurOrIcon ),
                WResIDFromNum( (long)(pointer_int)RT_CURSOR ), flags, loc );
        /* change the reference in the cursor directory */
        fileentry = entry->Entry.Cur;
        entry->IsCurFileEntry = false;
        entry->Entry.Res.Width = dibhead.Width;
        entry->Entry.Res.Height = dibhead.Height;
        entry->Entry.Res.Planes = dibhead.Planes;
        entry->Entry.Res.BitCount = dibhead.BitCount;
        /* the hotspot data is now part of the components */
        entry->Entry.Res.Length = fileentry.Length + sizeof(CurHotspot);
        entry->Entry.Res.CurID = CurrResFile.NextCurOrIcon;
        CurrResFile.NextCurOrIcon += 1;
    }

    RCFREE( buffer );

    return( ret );
} /* copyCursors */
Beispiel #11
0
void SemWriteMenu( WResID *name, ResMemFlags flags, FullMenu *menu,
                   uint_16 tokentype )
/********************************************************************/
{
    MenuHeader      head;
    ResLocation     loc;
    int             error = 0;
    int             err_code;
    uint_8          headerdata[ RES_HEADER_SIZE ];


    if(!ErrorHasOccured) {
        if( tokentype == Y_MENU ) {
            head.Version = 0;    /* currently these fields are both 0 */
            head.HeaderSize = 0;
            loc.start = SemStartResource();
            error = ResWriteMenuHeader( &head, CurrResFile.handle );
        } else if( tokentype == Y_MENU_EX ) {
            head.Version = RES_HEADER_VERSION;
            head.HeaderSize = RES_HEADER_SIZE;
            memset( headerdata, 0, head.HeaderSize );
            ResPadDWord( CurrResFile.handle );
            loc.start = SemStartResource();
            error = ResWriteMenuExHeader( &head, CurrResFile.handle, headerdata );
        } else {
            loc.start = 0;      // Is this valid?
        }
        if(error) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        error = SemWriteSubMenu( menu, &err_code, tokentype );
        if( !error && CmdLineParms.MSResFormat &&
                      CmdLineParms.TargetOS == RC_TARGET_OS_WIN32 ) {
            error = ResPadDWord( CurrResFile.handle );
        }
        if(error) goto OutputWriteError;
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( RT_MENU ), flags, loc );
    } else {
        RcMemFree( name );
    }

    SemFreeSubMenu( menu );
    return;


OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
             strerror( err_code ) );
    ErrorHasOccured = TRUE;
    SemFreeSubMenu( menu );
    return;
}
Beispiel #12
0
void SemOS2WriteFontDir( void )
/*****************************/
{
    FullFontDirEntry *  currentry;
    ResLocation         loc;
    bool                error;

    if( CurrResFile.FontDir == NULL ) {
        return;
    }

    loc.start = SemStartResource();

    error = ResWriteUint16( &(CurrResFile.FontDir->NumOfFonts),
                        CurrResFile.handle );
    if( error)
        goto OUTPUT_WRITE_ERROR;

    for( currentry = CurrResFile.FontDir->Head; currentry != NULL;
                currentry = currentry->Next ) {
        error = ResWriteFontDirEntry( &(currentry->Entry), CurrResFile.handle );
        if( error ) {
            goto OUTPUT_WRITE_ERROR;
        }
    }

    loc.len = SemEndResource( loc.start );

    SemAddResourceFree( WResIDFromStr( FONT_DIR_NAME ),
                WResIDFromNum( (long)RT_FONTDIR ), FONT_DIR_FLAGS, loc );

    FreeFontDir( CurrResFile.FontDir );
    CurrResFile.FontDir = NULL;

    return;


OUTPUT_WRITE_ERROR:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, LastWresErrStr() );
    ErrorHasOccured = true;
    FreeFontDir( CurrResFile.FontDir );
    CurrResFile.FontDir = NULL;
    return;
}
Beispiel #13
0
void SemWINAddMessageTable( WResID *name, ScanString *filename ) {
/****************************************************************/

    ResLocation         start;

    if( CmdLineParms.TargetOS == RC_TARGET_OS_WIN32 ) {
        start = SemCopyRawFile( filename->string );
        RCFREE( filename->string );
        RCFREE( filename );
        SemAddResourceFree( name, WResIDFromNum( (long)(pointer_int)RT_MESSAGETABLE ),
                            MEMFLAG_MOVEABLE | MEMFLAG_PURE, start );
    } else {
        RcError( ERR_NT_KEYWORD, SemWINTokenToString( Y_MESSAGETABLE ) );
        ErrorHasOccured = true;
        RCFREE( name );
        RCFREE( filename->string );
        RCFREE( filename );
    }
}
Beispiel #14
0
static RcStatus copyIcons( FullIconDir * dir, WResFileID handle,
                            ResMemFlags flags, int *err_code )
/**************************************************************/
{
    RcStatus            ret;
    char *              buffer;
    FullIconDirEntry *  entry;
    BitmapInfoHeader    dibhead;
    ResLocation         loc;

    ret = RS_OK;
    buffer = RCALLOC( BUFFER_SIZE );

    for( entry = dir->Head; entry != NULL; entry = entry->Next ) {
        /* copy the icon */
        loc.start = SemStartResource();

        /* NOTE: the dibhead structure is filled in as a result of this call */
        ret = copyOneIcon( &(entry->Entry.Ico), handle, buffer, BUFFER_SIZE, &(dibhead), err_code );
        if( ret != RS_OK )
            break;

        loc.len = SemEndResource( loc.start );
        /* add the icon to the RES file directory */
        SemAddResourceFree( WResIDFromNum( CurrResFile.NextCurOrIcon ),
                WResIDFromNum( (long)(pointer_int)RT_ICON ), flags, loc );
        /* change the reference in the ICON directory */
        entry->IsIcoFileEntry = false;
        entry->Entry.Res.IconID = CurrResFile.NextCurOrIcon;
        entry->Entry.Res.Info.Planes = dibhead.Planes;
        entry->Entry.Res.Info.BitCount = dibhead.BitCount;
        CurrResFile.NextCurOrIcon += 1;
    }

    RCFREE( buffer );

    return( ret );
} /* copyIcons */
Beispiel #15
0
void SemWriteToolBar( WResID *name, ToolBar *toolbar,
                      unsigned long item1, unsigned long item2,
                      ResMemFlags flags ) {

    ResLocation              loc;
    unsigned                 cnt;
    ToolBarItems            *cur;

    if(!ErrorHasOccured) {
        loc.start = SemStartResource();
        cnt = ( toolbar->nodecnt - 1 ) * TB_ITEM_CNT;
        cnt += toolbar->last->cnt;
        ResWriteToolBarHeader( CurrResFile.handle, item1, item2, cnt );
        cur = &toolbar->first;
        while( cur != NULL ) {
            ResWriteToolBarItems( CurrResFile.handle, cur->items, cur->cnt );
            cur = cur->next;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( RT_TOOLBAR ), flags, loc );
    }
    semFreeToolBar( toolbar );
}
Beispiel #16
0
static bool writeCurDir( FullCurDir *dir, WResID *name, ResMemFlags flags,
                        int *err_code )
/****************************************************************************/
{
    bool                error;
    FullCurDirEntry *   entry;
    ResLocation         loc;

    loc.start = SemStartResource();
    error = ResWriteIconCurDirHeader( &(dir->Header), CurrResFile.fid );

    for( entry = dir->Head; !error && entry != NULL; entry = entry->Next ) {
        error = ResWriteCurDirEntry( &(entry->Entry.Res), CurrResFile.fid );
    }

    if( !error ) {
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( RESOURCE2INT( RT_GROUP_CURSOR ) ), flags, loc );
    } else {
        *err_code = LastWresErr();
    }

    return( error );
}
Beispiel #17
0
void SemOS2AddSingleLineResource( WResID *name, YYTOKENTYPE type,
                       FullOptFlagsOS2 *fullflags, char *filename )
/*****************************************************************/
{
    ResLocation     start;
    ResMemFlags     flags, flagsMDP, flagsMP;
    char            full_filename[_MAX_PATH];
    static bool     firstIcon = true;

    if( ErrorHasOccured ) {
        RCFREE( name );
        RCFREE( filename );
        return;
    }

    if( RcFindResource( filename, full_filename ) == -1 ) {
        RcError( ERR_CANT_FIND_FILE, filename );
        goto HANDLE_ERROR;
    }

    if( AddDependency( full_filename ) )
        goto HANDLE_ERROR;

    flagsMDP = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE | MEMFLAG_PURE;
    flagsMP  = MEMFLAG_MOVEABLE | MEMFLAG_PURE;

    switch( type ) {
    case Y_DEFAULTICON:
        /* DEFAULTICON doesn't have a name, let's make our own */
        name = (WResID*)RCALLOC( sizeof( WResID ) );
        name->IsName = false;
        name->ID.Num = 999;
        firstIcon    = true;    /* Trigger a warning if we have one already */
        /* Note the fallthrough! */
    case Y_POINTER:
    case Y_ICON:
        if( fullflags != NULL ) {
            SemOS2CheckResFlags( fullflags, 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, 0 );
            flags = fullflags->flags;
        } else {
            flags = flagsMDP;
        }

        /* Duplicate the first icon encountered as the default icon IFF it
           has resource ID equal to 1
        */
        if( firstIcon && !name->IsName && (name->ID.Num == 999 || name->ID.Num == 1) ) {
            WResID      *id;

            id = (WResID*)RCALLOC( sizeof( WResID ) );
            if( id == NULL )
                break;

            firstIcon  = false;
            id->IsName = false;
            id->ID.Num = 22;
            start = SemCopyRawFile( filename );
            SemAddResourceFree( name, WResIDFromNum( OS2_RT_POINTER ), flags, start );

            start = SemCopyRawFile( filename );
            SemAddResourceFree( id, WResIDFromNum( OS2_RT_DEFAULTICON ), flagsMDP, start );
        } else {
            start = SemCopyRawFile( filename );
            SemAddResourceFree( name, WResIDFromNum( OS2_RT_POINTER ), flags, start );
        }
        break;

    case Y_BITMAP:
        if( fullflags != NULL ) {
            SemOS2CheckResFlags( fullflags, 0, MEMFLAG_MOVEABLE, MEMFLAG_PURE );
            flags = fullflags->flags;
        } else {
            flags = flagsMP;
        }
        start = SemCopyRawFile( filename );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_BITMAP ), flags, start );
        break;

    case Y_FONT:
        if( fullflags != NULL ) {
            SemOS2CheckResFlags( fullflags, 0, MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE, MEMFLAG_PURE );
            flags = fullflags->flags;
        } else {
            flags = flagsMDP;
        }
        AddFontResources( name, flags, full_filename );
        break;
    default:
        RCFREE( name );
        break;
    }

    RCFREE( filename );

    return;

HANDLE_ERROR:
    ErrorHasOccured = true;
    RCFREE( name );
    RCFREE( filename );
} /* SemOS2AddSingleLineResource */
Beispiel #18
0
void SemWINWriteVerInfo( WResID * name, ResMemFlags flags,
                        VerFixedInfo * info, FullVerBlockNest * nest )
/********************************************************************/
{
    WResLangType    lang;
    VerBlockHeader  root;
    ResLocation     loc;
    int             padding;
    bool            error;
    bool            use_unicode;
    uint_8          os;
    int             err_code;

    if( CmdLineParms.TargetOS == RC_TARGET_OS_WIN32 ) {
        use_unicode = true;
        os = WRES_OS_WIN32;
    } else {
        use_unicode = false;
        os = WRES_OS_WIN16;
    }
    root.Key = "VS_VERSION_INFO";
    root.ValSize = sizeof(VerFixedInfo);
    root.Type = 0;
    padding = RES_PADDING( root.ValSize, sizeof(uint_32) );
    root.Size = ResSizeVerBlockHeader( &root, use_unicode, os )
                    + root.ValSize + padding + CalcNestSize( nest );
    /* pad the start of the resource so that padding within the resource */
    /* is easier */
    error = ResPadDWord( CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();

        error = ResWriteVerBlockHeader( &root, use_unicode, os,
                                        CurrResFile.handle);
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }

        error = ResWriteVerFixedInfo( info, CurrResFile.handle );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }

        if( ResSeek( CurrResFile.handle, padding, SEEK_CUR ) == -1 )  {
            err_code = LastWresErr();
            goto OutputWriteError;
        }

        error = SemWriteVerBlockNest( nest, CurrResFile.handle, &err_code );
        if( error)
            goto OutputWriteError;

        loc.len = SemEndResource( loc.start );

        /* version info resources must be language neutral */

        lang.lang = DEF_LANG;
        lang.sublang = DEF_SUBLANG;
        SemWINSetResourceLanguage( &lang, false );
        SemAddResourceFree( name, WResIDFromNum( RT_VERSIONINFO ), flags, loc );
    } else {
        RCFREE( name );
    }

    RCFREE( info );
    FreeVerBlockNest( nest );

    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
                strerror( err_code )  );
    ErrorHasOccured = true;
    RCFREE( info );
    FreeVerBlockNest( nest );
    return;
}