Esempio n. 1
0
WdeDialogBoxHeader *WdeMem2DialogBoxExHeader( uint_8 **data )
{
    uint_16             miscbytes[2] = { 0x0001, 0xFFFF };
    WdeDialogBoxHeader  *dbh;
    Bool                ok;

    dbh = NULL;

    if ( !data || !*data ) {
        return(NULL);
    }

    dbh = WdeAllocDialogBoxHeader();
    if ( dbh == NULL ) {
        return(NULL);
    }

    dbh->is32bit    = TRUE;
    dbh->is32bitEx  = TRUE;

    /* skip the miscellaneous two WORDs 01 00 FF FF */
    *data += sizeof(miscbytes);

    memcpy( &dbh->HelpId, *data, sizeof(uint_32) );
    *data += sizeof(uint_32);

    memcpy( &dbh->ExtendedStyle, *data, sizeof(uint_32) );
    *data += sizeof(uint_32);

    memcpy( &dbh->Style, *data, sizeof(uint_32) );
    *data += sizeof(uint_32);

    memcpy( &dbh->NumOfItems, *data, sizeof(uint_16) );
    *data += sizeof(uint_16);

    memcpy( &dbh->Size, *data, sizeof(DialogSizeInfo) );
    *data += sizeof(DialogSizeInfo);

    SETHDR_MENUNAME(dbh, WdeMem2NameOrOrdinal( data, TRUE ) );
    ok = ( GETHDR_MENUNAME(dbh) != NULL );

    if( ok ) {
        SETHDR_CLASSNAME( dbh, WdeMem2NameOrOrdinal( data, TRUE ) );
        ok = ( GETHDR_CLASSNAME(dbh) != NULL );
    }

    if( ok ) {
        SETHDR_CAPTION( dbh, WdeMem2String( data, TRUE ) );
        ok = ( GETHDR_CAPTION(dbh) != NULL );
    }

    if( ok ) {
        if( GETHDR_STYLE(dbh) & DS_SETFONT ) {
            dbh->FontWeightDefined = TRUE;
            dbh->FontItalicDefined = TRUE;
            SETHDR_POINTSIZE( dbh, *((uint_16 *)*data) );
            *data += sizeof(uint_16);
            SETHDR_FONTWEIGHT( dbh, *((uint_16 *)*data) );
            *data += sizeof(uint_16);
            SETHDR_FONTITALIC( dbh, *((uint_16 *)*data) );
            *data += sizeof(uint_16);
            SETHDR_FONTNAME( dbh, WdeMem2String( data, TRUE ) );
            ok = ( GETHDR_FONTNAME(dbh) != NULL );
        }
    }

    if( !ok ) {
        if( dbh ) {
            WdeFreeDialogBoxHeader ( &dbh );
        }
    }

    return( dbh );
}
Esempio n. 2
0
WdeDialogBoxHeader *WdeMem2DialogBoxHeader( const uint_8 **pdata, bool is32bit, bool is32bitEx )
{
    WdeDialogBoxHeader  *dbh;
    bool                ok;
    const uint_8        *data;

    dbh = NULL;
    data = NULL;

    ok = (pdata != NULL && *pdata != NULL);

    if( ok ) {
        dbh = WdeAllocDialogBoxHeader();
        ok = (dbh != NULL);
    }

    if( ok ) {
        data = *pdata;
        dbh->symbol = NULL;
        dbh->helpsymbol = NULL;
        dbh->is32bit = is32bit;
        dbh->is32bitEx = is32bitEx;
        if( is32bitEx ) {
            /* skip the miscellaneous two WORDs 0x0001, 0xFFFF */
            data += 2 * sizeof( uint_16 );
            U32FromMem( data, GETHDR_HELPID( dbh ) );
            U32FromMem( data, GETHDR_EXSTYLE( dbh ) );
            U32FromMem( data, GETHDR_STYLE( dbh ) );
        } else if( is32bit ) {
            U32FromMem( data, GETHDR_STYLE( dbh ) );
            U32FromMem( data, GETHDR_EXSTYLE( dbh ) );
        } else {
            U32FromMem( data, GETHDR_STYLE( dbh ) );
        }
        if( is32bit ) {
            U16FromMem( data, GETHDR_NUMITEMS( dbh ) );
        } else {
            U8FromMem( data, GETHDR_NUMITEMS( dbh ) );
        }
        U16FromMem( data, GETHDR_SIZEX( dbh ) );
        U16FromMem( data, GETHDR_SIZEY( dbh ) );
        U16FromMem( data, GETHDR_SIZEW( dbh ) );
        U16FromMem( data, GETHDR_SIZEH( dbh ) );

        SETHDR_MENUNAME( dbh, WdeMem2NameOrOrdinal( &data, is32bit ) );
        ok = (GETHDR_MENUNAME( dbh ) != NULL);
    }

    if( ok ) {
        SETHDR_CLASSNAME( dbh, WdeMem2NameOrOrdinal( &data, is32bit ) );
        ok = (GETHDR_CLASSNAME( dbh ) != NULL);
    }

    if( ok ) {
        SETHDR_CAPTION( dbh, WdeMem2String( &data, is32bit ) );
        ok = (GETHDR_CAPTION( dbh ) != NULL);
    }

    if( ok ) {
        if( GETHDR_STYLE( dbh ) & DS_SETFONT ) {
            U16FromMem( data, GETHDR_POINTSIZE( dbh ) );
            if( is32bitEx ) {
                U16FromMem( data, GETHDR_FONTWEIGHT( dbh ) );
                U8FromMem( data, GETHDR_FONTITALIC( dbh ) );
                U8FromMem( data, GETHDR_FONTCHARSET( dbh ) );
            }
            SETHDR_FONTNAME( dbh, WdeMem2String( &data, is32bit ) );
            ok = (GETHDR_FONTNAME( dbh ) != NULL);
        } else {
            SETHDR_POINTSIZE( dbh, 0 );
            SETHDR_FONTNAME( dbh, NULL );
        }
    }

    if( dbh != NULL ) {
        *pdata = data;
        if( !ok ) {
            WdeFreeDialogBoxHeader( &dbh );
        }
    }
    return( dbh );
}
Esempio n. 3
0
WdeDialogBoxHeader *WdeMem2DialogBoxHeader( uint_8 **data, Bool is32bit )
{
    DialogBoxHeader32   *h32;
    DialogBoxHeader     *h16;
    WdeDialogBoxHeader  *dbh;
    int                 fixedbytes;
    Bool                ok;

    dbh = NULL;

    ok = ( data && *data );

    if( ok ) {
        dbh = WdeAllocDialogBoxHeader();
        ok = ( dbh != NULL );
    }

    if( ok ) {
        dbh->symbol      = NULL;
        dbh->helpsymbol  = NULL;
        dbh->is32bit     = is32bit;
        dbh->is32bitEx   = FALSE;
        if( is32bit ) {
            fixedbytes = offsetof( DialogBoxHeader32, MenuName );
            h32 = (DialogBoxHeader32 *)*data;
            dbh->Style = h32->Style;
            dbh->ExtendedStyle = h32->ExtendedStyle;
            dbh->NumOfItems = h32->NumOfItems;
            dbh->Size = h32->Size;
        } else {
            fixedbytes = offsetof( DialogBoxHeader, MenuName );
            h16 = (DialogBoxHeader *)*data;
            dbh->Style = h16->Style;
            dbh->NumOfItems = h16->NumOfItems;
            dbh->Size = h16->Size;
        }
        *data += fixedbytes;
        SETHDR_MENUNAME(dbh, WdeMem2NameOrOrdinal( data, is32bit ) );
        ok = ( GETHDR_MENUNAME(dbh) != NULL );
    }

    if( ok ) {
        SETHDR_CLASSNAME( dbh, WdeMem2NameOrOrdinal( data, is32bit ) );
        ok = ( GETHDR_CLASSNAME(dbh) != NULL );
    }

    if( ok ) {
        SETHDR_CAPTION( dbh, WdeMem2String( data, is32bit ) );
        ok = ( GETHDR_CAPTION(dbh) != NULL );
    }

    if( ok ) {
        if( GETHDR_STYLE(dbh) & DS_SETFONT ) {
            SETHDR_POINTSIZE( dbh, *( (uint_16 *)*data ) );
            *data += sizeof(uint_16);
            SETHDR_FONTNAME( dbh, WdeMem2String( data, is32bit ) );
            ok = ( GETHDR_FONTNAME(dbh) != NULL );
        } else {
            SETHDR_POINTSIZE( dbh, 0 );
            SETHDR_FONTNAME( dbh, NULL );
        }
    }

    if( !ok ) {
        if( dbh ) {
            WdeFreeDialogBoxHeader ( &dbh );
        }
    }

    return( dbh );
}