Ejemplo n.º 1
0
bool ResWriteMenuExItemNormal( const MenuItemNormal *curritem, const MenuExItemNormal *exdata,
                              bool use_unicode, WResFileID handle )
/*******************************************************************************************/
{
    bool        error;
    uint_16     tmp16;
    uint_32     tmp32;

    if( curritem->ItemFlags & MENUEX_POPUP ) {
        WRES_ERROR( WRS_BAD_PARAMETER );
        error = true;
    } else {
        error = ResWriteUint32( &(exdata->ItemType), handle );
        if( !error ) {
            error = ResWriteUint32( &(exdata->ItemState), handle );
        }
        if( !error ) {
            tmp32 = curritem->ItemID;
            error = ResWriteUint32( &tmp32, handle );
        }
        if( !error ) {
            tmp16 = curritem->ItemFlags;
            error = ResWriteUint16( &tmp16, handle );
        }
        if( !error ) {
            error = ResWriteString( curritem->ItemText, use_unicode, handle );
        }
        if( !error ) {
            error = ResPadDWord( handle );
        }
    }

    return( error );
}
Ejemplo n.º 2
0
bool ResWriteDialogBoxExControl32( DialogBoxExControl32 *control, FILE *fp )
/**************************************************************************/
{
    bool            error;

    error = ResWriteUint32( control->HelpId, fp );
    if( !error ) {
        error = ResWriteUint32( control->ExtendedStyle, fp );
    }
    if( !error ) {
        error = ResWriteUint32( control->Style, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(control->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteUint32( control->ID, fp );
    }
    if( !error ) {
        error = ResWriteDialogControlCommon32( control->ClassID, control->Text, control->ExtraBytes, fp );
    }

    if( !error ) {
        /* padding full record to dword boundary if necessary */
        error = ResWritePadDWord( fp );
    }
    return( error );
}
Ejemplo n.º 3
0
bool ResWriteDialogBoxHeader32( DialogBoxHeader32 *head, FILE *fp )
/*****************************************************************/
{
    bool            error;

    error = ResWriteUint32( head->Style, fp );
    if( !error ) {
        error = ResWriteUint32( head->ExtendedStyle, fp );
    }
    if( !error ) {
        error = ResWriteUint16( head->NumOfItems, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(head->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteDialogHeaderCommon32( head, fp, false );
    }
    /* if the font was set output the font name and point size */
    if( !error && (head->Style & DS_SETFONT) ) {
        error = ResWriteUint16( head->PointSize, fp );
        if( !error ) {
            error = ResWriteString( head->FontName, true, fp );
        }
    }

    if( !error ) {
        /* padding full record to dword boundary if necessary */
        error = ResWritePadDWord( fp );
    }
    return( error );
}
Ejemplo n.º 4
0
bool ResWriteDialogBoxExHeader32( DialogBoxHeader32 *head, DialogBoxExHeader32short *exhead, FILE *fp )
/*****************************************************************************************************/
{
    bool            error;

    /* Write out the miscellaneous two WORDs 0x0001, 0xFFFF */

    error = ResWriteUint16( 0x0001, fp );
    if( !error ) {
        error = ResWriteUint16( 0xFFFF, fp );
    }
    if( !error ) {
        error = ResWriteUint32( exhead->HelpId, fp );
    }
    if( !error ) {
        error = ResWriteUint32( head->ExtendedStyle, fp );
    }
    if( !error ) {
        error = ResWriteUint32( head->Style, fp );
    }
    if( !error ) {
        error = ResWriteUint16( head->NumOfItems, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(head->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteDialogHeaderCommon32( head, fp, true );
    }
    /* If the font was set, write the font information */
    if( !error && (head->Style & DS_SETFONT) ) {
        error = ResWriteUint16( head->PointSize, fp );
        if( !error ) {
            error = ResWriteUint16( exhead->FontWeight, fp );
        }
        if( !error ) {
            error = ResWriteUint8( exhead->FontItalic, fp );
        }
        if( !error ) {
            error = ResWriteUint8( exhead->FontCharset, fp );
        }
        if( !error ) {
            error = ResWriteString( head->FontName, true, fp );
        }
    }

    if( !error ) {
        /* padding full record to dword boundary if necessary */
        error = ResWritePadDWord( fp );
    }
    return( error );
}
Ejemplo n.º 5
0
bool ResWriteDialogBoxHeader( DialogBoxHeader *head, FILE *fp )
/*************************************************************/
{
    bool            error;

    error = ResWriteUint32( head->Style, fp );
    if( !error ) {
        error = ResWriteUint8( head->NumOfItems, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(head->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteNameOrOrdinal( head->MenuName, false, fp );
    }
    if( !error ) {
        error = ResWriteNameOrOrdinal( head->ClassName, false, fp );
    }
    if( !error ) {
        error = ResWriteString( head->Caption, false, fp );
    }
    /* if the font was set output the font name and point size */
    if( !error && (head->Style & DS_SETFONT) ) {
        error = ResWriteUint16( head->PointSize, fp );
        if( !error ) {
            error = ResWriteString( head->FontName, false, fp );
        }
    }
    return( error );
}
Ejemplo n.º 6
0
bool ResWriteDialogBoxControl( DialogBoxControl *control, FILE *fp )
/******************************************************************/
{
    bool            error;

    error = ResWriteDialogSizeInfo( &(control->SizeInfo), fp );
    if( !error ) {
        error = ResWriteUint16( control->ID, fp );
    }
    if( !error ) {
        error = ResWriteUint32( control->Style, fp );
    }

    /* if the ClassID is one of the predefined ones write it out as a byte */
    /* otherwise it is a string */
    if( !error ) {
        if( control->ClassID->Class & 0x80 ) {
            error = ResWriteUint8( control->ClassID->Class, fp );
        } else {
            error = ResWriteString( control->ClassID->ClassName, false, fp );
        }
    }

    if( !error ) {
        error = ResWriteNameOrOrdinal( control->Text, false, fp );
    }
    if( !error ) {
        error = ResWriteUint8( control->ExtraBytes, fp );
    }

    return( error );
}
Ejemplo n.º 7
0
void SemWriteRawDataItem( RawDataItem item )
/******************************************/
{
    uint_16     num16;
    uint_32     num32;
    bool        error;

    if( item.IsString ) {
        int     len = item.StrLen;

        if( item.WriteNull ) {
            ++len;
        }
        if( ResWriteStringLen( item.Item.String, item.LongItem, CurrResFile.handle, len ) ) {
            RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, LastWresErrStr() );
            ErrorHasOccured = true;
        }
        if( item.TmpStr ) {
            RCFREE( item.Item.String );
        }
    } else {
        if( !item.LongItem ) {
            if( (int_32)item.Item.Num < 0 ) {
                if( (int_32)item.Item.Num < SHRT_MIN ) {
                    RcWarning( ERR_RAW_DATA_TOO_SMALL, item.Item.Num, SHRT_MIN );
                }
            } else {
                if( item.Item.Num > USHRT_MAX ) {
                    RcWarning( ERR_RAW_DATA_TOO_BIG, item.Item.Num, USHRT_MAX );
                }
            }
        }
        if( !ErrorHasOccured ) {
            if( !item.LongItem ) {
                num16 = item.Item.Num;
                error = ResWriteUint16( &(num16), CurrResFile.handle );
            } else {
                num32 = item.Item.Num;
                error = ResWriteUint32( &(num32), CurrResFile.handle );
            }
            if( error ) {
                RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, LastWresErrStr() );
                ErrorHasOccured = true;
            }
        }
    }
}
Ejemplo n.º 8
0
bool MResWriteResourceHeader( MResResourceHeader *currhead, WResFileID handle, bool iswin32 )
/*******************************************************************************************/
{
    bool        error;

    if( !iswin32 ) {
        error = ResWriteNameOrOrdinal( currhead->Type, false, handle );
        if( !error ) {
            error = ResWriteNameOrOrdinal( currhead->Name, false, handle );
        }
        if( !error ) {
            error = ResWriteUint16( currhead->MemoryFlags, handle );
        }
        if( !error ) {
            error = ResWriteUint32( currhead->Size, handle );
        }
    } else {
        error = ResWriteUint32( currhead->Size, handle );
        if( !error ) {
            error = ResWriteUint32( MResFindHeaderSize( currhead, true ), handle  );
        }
        if( !error ) {
            error = ResWriteNameOrOrdinal( currhead->Type, true, handle );
        }
        if( !error ) {
            error = ResWriteNameOrOrdinal( currhead->Name, true, handle );
        }
        if( !error ) {
            error = ResWritePadDWord( handle );
        }
        if( !error ) {
            error = ResWriteUint32( currhead->DataVersion, handle );
        }
        if( !error ) {
            error = ResWriteUint16( currhead->MemoryFlags, handle );
        }
        if( !error ) {
            error = ResWriteUint16( currhead->LanguageId, handle );
        }
        if( !error ) {
            error = ResWriteUint32( currhead->Version, handle );
        }
        if( !error ) {
            error = ResWriteUint32( currhead->Characteristics, handle );
        }
    }

    return( error );
} /* MResWriteResourceHeader */
Ejemplo n.º 9
0
int MResWriteResourceHeader( MResResourceHeader *currhead, int handle, char iswin32 )
/***********************************************************************************/
{
    int         error;
    uint_32     headersize;
    uint_16     tmp16;
    uint_32     tmp32;

    if( !iswin32 ) {
        error = ResWriteNameOrOrdinal( currhead->Type, FALSE, handle );
        if (!error) {
            error = ResWriteNameOrOrdinal( currhead->Name, FALSE, handle );
        }
        if (!error) {
            tmp16 = currhead->MemoryFlags;
            error = ResWriteUint16( &tmp16, handle );
        }
        if (!error) {
            tmp32 = currhead->Size;
            error = ResWriteUint32( &tmp32, handle );
        }
    } else {
        tmp32 = currhead->Size;
        error = ResWriteUint32( &tmp32, handle );
        if( !error ) {
            headersize = MResFindHeaderSize( currhead, TRUE );
            error = ResWriteUint32( &headersize, handle  );
        }
        if( !error ) {
            error = ResWriteNameOrOrdinal( currhead->Type, TRUE, handle );
        }
        if( !error ) {
            error = ResWriteNameOrOrdinal( currhead->Name, TRUE, handle );
        }
        if( !error ) {
            error = ResPadDWord( handle );
        }
        if( !error ) {
            tmp32 = currhead->DataVersion;
            error = ResWriteUint32( &tmp32, handle );
        }
        if( !error ) {
            tmp16 = currhead->MemoryFlags;
            error = ResWriteUint16( &tmp16, handle );
        }
        if( !error ) {
            tmp16 = currhead->LanguageId;
            error = ResWriteUint16( &tmp16, handle );
        }
        if( !error ) {
            tmp32 = currhead->Version;
            error = ResWriteUint32( &tmp32, handle );
        }
        if( !error ) {
            tmp32 = currhead->Characteristics;
            error = ResWriteUint32( &tmp32, handle );
        }
    }

    return( error );
} /* MResWriteResourceHeader */