Beispiel #1
0
STATIC int writeMisc32( obj_rec *objr, pobj_state *state ) {
    /*
        For 32-bit records which are the same under Intel, PharLap, and MS OMFs
    */
    uint_8  *ptr;
    uint_16 len;
    uint_8  cmd;
    uint_16 save;

    /**/myassert( objr != NULL );
    /**/myassert( objr->data != NULL );
    /**/myassert( state != NULL );
    /**/myassert( state->pass == POBJ_WRITE_PASS );
    save = ObjRTell( objr );
    ObjRSeek( objr, 0 );
    len = ObjRemain( objr );
    ptr = ObjGet( objr, len );
    cmd = objr->command;
    if( objr->is_32 || objr->is_phar ) {
        cmd |= 0x01;
    }
    ObjWriteRec( state->file_out, cmd, len, ptr );
    ObjRSeek( objr, save );
    return( 0 );
}
Beispiel #2
0
STATIC void id32Block( obj_rec *objr, OBJ_WFILE *out, int_16 *delta,
                       uint_16 first_block_offset ) {
    /*
        Since LIDATAs are different under PharLap and MicroSoft 386 formats,
        we have to do some magic.
    */
    uint_16 rpt_count;
    uint_16 blk_count;
    uint_8  data_count;
    uint_8  *ptr;

    rpt_count = ObjGet16( objr );
    ObjWrite32( out, rpt_count );
    *delta += 2;    /* ok, everything from here on will be at +2 offset */
    LifixAdd( &lifList, ObjRTell( objr ) - first_block_offset, *delta );
    blk_count = ObjGet16( objr );
    ObjWrite16( out, blk_count );
    if( blk_count == 0 ) {
        data_count = ObjGet8( objr );
        ObjWrite8( out, data_count );
        ptr = ObjGet( objr, data_count );
        ObjWrite( out, ptr, data_count );
    } else {
        for( ; blk_count != 0; --blk_count ) {
            id32Block( objr, out, delta, first_block_offset );
        }
    }
}
Beispiel #3
0
STATIC int writeLedata( obj_rec *objr, pobj_state *state ) {

    OBJ_WFILE   *out;
    uint_16     save;
    uint_8      *ptr;
    uint_16     len;
    int         is32;

    /**/myassert( objr != NULL );
    /**/myassert( objr->command == CMD_LEDATA );
    /**/myassert( state != NULL );
    /**/myassert( state->pass == POBJ_WRITE_PASS );
#if ( _WOMP_OPT & _WOMP_WATFOR ) == 0
    LifixDestroy( &lifList );
    LifixInit( &lifList );
#endif
    out = state->file_out;
    is32 = objr->is_32 || objr->is_phar;
    ObjWBegRec( out, is32 ? CMD_LEDA32 : CMD_LEDATA );
    ObjWriteIndex( out, objr->d.ledata.idx );
    if( is32 ) {
        ObjWrite32( out, objr->d.ledata.offset );
    } else {
        ObjWrite16( out, (uint_16)objr->d.ledata.offset );
    }
    save = ObjRTell( objr );
    len = ObjRemain( objr );
    ptr = ObjGet( objr, len );
    /**/myassert( len <= 1024 );
    ObjWrite( out, ptr, len );
    ObjWEndRec( out );
    ObjRSeek( objr, save );
    return( 0 );
}
Beispiel #4
0
STATIC int writeComdat( obj_rec *objr, pobj_state *state ) {

    OBJ_WFILE   *out;
    uint_8      *ptr;
    uint_16     len;
    uint_16     save;
    int         is32;

    /**/myassert( objr != NULL );
    /**/myassert( objr->command == CMD_COMDAT );
    /**/myassert( state != NULL );
    /**/myassert( state->pass == POBJ_WRITE_PASS );
    save = ObjRTell( objr );
    is32 = objr->is_32 || objr->is_phar;
    if( is32 ) {
        objr->command |= 1;
    }
    out = state->file_out;
    ObjWBegRec( out, objr->command );
    ObjWrite8( out, objr->d.comdat.flags );
    ObjWrite8( out, objr->d.comdat.attributes );
    ObjWrite8( out, objr->d.comdat.align );
    if( is32 ) {
        ObjWrite32( out, objr->d.comdat.offset );
    } else {
        ObjWrite16( out, (uint_16)objr->d.comdat.offset );
    }
    ObjWriteIndex( out, objr->d.comdat.type_idx );
    if( ( objr->d.comdat.attributes & COMDAT_ALLOC_MASK ) == COMDAT_EXPLICIT ) {
        writeBase( objr, out );
    }
    ObjWriteIndex( out, objr->d.comdat.public_name_idx );
    if( ( objr->d.comdat.flags & COMDAT_ITERATED ) == 0 || objr->is_phar == 0 ) {
        /* record is already in ms omf format */
        len = ObjRemain( objr );
        ptr = ObjGet( objr, len );
        /**/    myassert( len <= 1024 );
        ObjWrite( out, ptr, len );
    } else {
        int_16 delta;
        uint_16 first_block_offset;

        delta = 0;  /* id32Block needs to play with this */
        first_block_offset = ObjRTell( objr );
        while( !ObjEOR( objr ) ) {
            id32Block( objr, out, &delta, first_block_offset );
        }
    }
    ObjWEndRec( out );
    ObjRSeek( objr, save );
    return( 0 );
}
Beispiel #5
0
BOOL 
Foobar::COM_ConnectServer()
{
	HRESULT hr;
	/***** Attach to the running COM instance... *****/
	IDispatch	*pDisp = NULL;
	if(m_comAppH) {
		//try Foobar COMServer2Helper (fast way)
		CALL( m_comAppH->get_Server(&pDisp));
		hr = pDisp->QueryInterface(__uuidof(m_comApp), (void**)&m_comApp);
		RELEASE(pDisp,TRUE);
	}
	else {
		//try GetActive Foobar Object (COMServer2Helper.exe not install right)
		CALL( ObjGet(CLSID_Application07, __uuidof(m_comApp), (void**)&m_comApp));
	}
	if(SUCCEEDED(hr)) {
		DEBUGOUT("Foobar:\t\tServer = ","on");
		// ***** get the Fooar Playback interface...    *****
		CALL( m_comApp->get_Playback(&m_comPlayback) );
		if (m_comPlayback == NULL)
			goto FAILURE;
		// ***** Instantiate an IMIM_fooEventS object. *****
		if(m_comPlaybackEventSink = new IMIM_fooEventS(*this, m_comPlayback, &Foobar::COM_OnEventInvoke)) {

			VARIANT_BOOL bState = VARIANT_FALSE;
			m_comPlayback->get_IsPlaying(&bState);

			m_state = (bState == VARIANT_TRUE) ? PL_PLAYING : PL_STOPPED;
			if(SetActivePlayer(m_index, m_index))
				NotifyInfoChanged();
		}
	}
	else {
		DEBUGOUT("Foobar:\t\tServer = ","off");
		RELEASE(pDisp,TRUE);
		m_state = PL_OFFLINE;
		return FALSE;
	}
	return TRUE;

FAILURE:
  #ifdef DEBUG
	_com_error err(hr);
	OutputDebugString(_T("Foobar:\t\tERROR = COM_ConnectServer()\n\t\t\t"));
	OutputDebugString(err.ErrorMessage());
	OutputDebugString(_T("\n)"));
  #endif
	RELEASE(pDisp,TRUE);
	COM_ReleaseServer();
	return FALSE;
}
Beispiel #6
0
STATIC int writeLidata( obj_rec *objr, pobj_state *state ) {

    OBJ_WFILE   *out;
    uint_16     save;
    uint_8      *ptr;
    uint_16     len;
    int         is32;

    /**/myassert( objr != NULL );
    /**/myassert( objr->command == CMD_LIDATA );
    /**/myassert( state != NULL );
    /**/myassert( state->pass == POBJ_WRITE_PASS );
    LifixDestroy( &lifList );
    LifixInit( &lifList );
    out = state->file_out;
    save = ObjRTell( objr );
    is32 = objr->is_32 || objr->is_phar;
    ObjWBegRec( out, is32 ? CMD_LIDA32 : CMD_LIDATA );
    ObjWriteIndex( out, objr->d.lidata.idx );
    if( is32 ) {
        ObjWrite32( out, objr->d.lidata.offset );
    } else {
        ObjWrite16( out, (uint_16)objr->d.lidata.offset );
    }
    if( objr->is_phar == 0 ) {
        /* ok, already in our format */
        len = ObjRemain( objr );
        ptr = ObjGet( objr, len );
        ObjWrite( out, ptr, len );
    } else {
        int_16 delta;
        uint_16 first_block_offset;

        delta = 0;  /* id32Block needs to play with this */
        first_block_offset = ObjRTell( objr );
        while( !ObjEOR( objr ) ) {
            id32Block( objr, out, &delta, first_block_offset );
        }
    }
    ObjWEndRec( out );
    ObjRSeek( objr, save );
    return( 0 );
}
Beispiel #7
0
STATIC int writeComent( obj_rec *objr, pobj_state *state ) {

    uint_8  *ptr;
    uint_16 len;
    uint_16 save;
    OBJ_WFILE *out;

    /**/myassert( objr != NULL );
    /**/myassert( objr->data != NULL );
    /**/myassert( state != NULL );
    /**/myassert( state->pass == POBJ_WRITE_PASS );
    out = state->file_out;
    ObjWBegRec( out, CMD_COMENT );
    ObjWrite8( out, objr->d.coment.attr );
    ObjWrite8( out, objr->d.coment.class );
    save = ObjRTell( objr );
    len = ObjRemain( objr );
    ptr = ObjGet( objr, len );
    ObjWrite( out, ptr, len );
    ObjRSeek( objr, save );
    ObjWEndRec( out );
    return( 0 );
}