Exemplo n.º 1
0
HDDEDATA WdeCreateResNameData( WResID *name, bool is32bit )
{
    HDDEDATA    hdata;
    void        *data;
    uint_32     size;

    hdata = (HDDEDATA)NULL;

    if( WRWResID2Mem( name, &data, &size, is32bit ) ) {
        hdata = DdeCreateDataHandle( IdInst, (LPBYTE)data, size, 0,
                                     hNameItem, WdeDataClipbdFormat, 0 );
        WRMemFree( data );
    }

    return( hdata );
}
Exemplo n.º 2
0
WREClipData *WRECreateClipData( WRECurrentResInfo *curr )
{
    WREClipData *cdata;
    uint_32     cdata_size;
    BYTE        *rdata;
    uint_32     rdata_size;
    void        *name;
    uint_32     name_size;
    uint_16     type;
    bool        ok;

    cdata = NULL;
    rdata = NULL;
    name = NULL;

    ok = (curr != NULL && curr->type != NULL && curr->res != NULL && curr->lang != NULL);

    if( ok ) {
        type = 0;
        if( !curr->type->Info.TypeName.IsName ) {
            type = curr->type->Info.TypeName.ID.Num;
        }
        ok = (type != 0);
    }

    if( ok ) {
        ok = WRWResID2Mem( &curr->res->Info.ResName, &name, &name_size,
                           curr->info->is32bit );
    }

    if( ok ) {
        if( type == RESOURCE2INT( RT_GROUP_ICON ) ) {
            ok = WRECreateIconDataFromGroup( curr, &rdata, &rdata_size );
        } else if( type == RESOURCE2INT( RT_GROUP_CURSOR ) ) {
            ok = WRECreateCursorDataFromGroup( curr, &rdata, &rdata_size );
        } else {
            rdata = WREGetCurrentResData( curr );
            rdata_size = curr->lang->Info.Length;
            ok = (rdata != NULL && rdata_size != 0);
        }
    }

    if( ok ) {
        cdata_size = sizeof( WREClipData ) + name_size + rdata_size - 1;
        cdata = (WREClipData *)WRMemAlloc( cdata_size );
        ok = (cdata != NULL);
    }

    if( ok ) {
        cdata->clip_size = cdata_size;
        cdata->data_size = rdata_size;
        cdata->data_offset = cdata_size - rdata_size;
        cdata->type = type;
        cdata->memflags = curr->lang->Info.MemoryFlags;
        cdata->is32bit = curr->info->is32bit;
        memcpy( &cdata->name[0], name, name_size );
        memcpy( &cdata->name[name_size], rdata, rdata_size );
    } else {
        if( cdata != NULL ) {
            WRMemFree( cdata );
            cdata = NULL;
        }
    }

    if( rdata != NULL ) {
        WRMemFree( rdata );
    }

    if( name != NULL ) {
        WRMemFree( name );
    }

    return( cdata );
}