Beispiel #1
0
static bool ResWriteDialogHeaderCommon32( DialogBoxHeader32 *head, FILE *fp, bool add_quotes )
/********************************************************************************************/
{
    bool    error;
    size_t  len;
    char    *newname;

    if( add_quotes ) {
        if( head->MenuName != NULL && head->MenuName->name[0] != '\0' ) {
            len = strlen( head->MenuName->name );
            newname = WRESALLOC( len + 3 );
            newname[0] = '"';
            strcpy( newname + 1, head->MenuName->name );
            newname[len + 1] = '"';
            newname[len + 2] = '\0';
            head->MenuName = ResStrToNameOrOrd( newname );
            WRESFREE( newname );
        }
    }

    error = ResWriteNameOrOrdinal( head->MenuName, true, fp );
    if( !error ) {
        error = ResWriteNameOrOrdinal( head->ClassName, true, fp );
    }
    if( !error ) {
        error = ResWriteString( head->Caption, true, fp );
    }

    return( error );
}
Beispiel #2
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 );
}
Beispiel #3
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 */
Beispiel #4
0
static bool ResWriteDialogControlCommon32( ControlClass *class_id, ResNameOrOrdinal *text,
                                                  uint_16 extra_bytes, FILE *fp )
/****************************************************************************************/
{
    bool      error;

    /* if the ClassID is one of the predefined ones write it out as a byte */
    /* otherwise it is a string */
    if( class_id->Class & 0x80 ) {
        /*the class number is prefixed by 0xFFFF to distinguish it
         * from a string */
        error = ResWriteUint16( (uint_16)-1, fp );
        if( !error ) {
            error = ResWriteUint16( class_id->Class, fp );
        }
    } else {
        error = ResWriteString( class_id->ClassName, true, fp );
    }
    if( !error ) {
        error = ResWriteNameOrOrdinal( text, true, fp );
    }

    if( !error ) {
        error = ResWriteUint16( extra_bytes, fp );
    }

    return( error );
}
Beispiel #5
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 );
}
Beispiel #6
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 */