Example #1
0
int PolylineTest::readFileMoniker()
{
	ComPtr<IStorage> pStorage;
	ComPtr<IStream> pStream;
	auto hr = StgOpenStorageEx(kMonikerFileName,
		STGM_READ | STGM_SHARE_EXCLUSIVE | STGM_DIRECT, STGFMT_STORAGE, 0, NULL, 0, IID_IStorage, (void**)&pStorage);
	if (FAILED(hr))
		return hr;
	hr = pStorage->OpenStream(kStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
	if (FAILED(hr))
		return hr;
	ComPtr<IMoniker> moniker;
	OleLoadFromStream(pStream, IID_IMoniker, (void**)&moniker);
	IBindCtx* pbc;
	CreateBindCtx(0, &pbc);
	ComPtr<IPolyline> polyline;
	hr = moniker->BindToObject(pbc, NULL, IID_IPolyline, (void**)&polyline);
	if (FAILED(hr)) {
		return -1;
	}
	ComPtr<IPolyline> polyline2;
	hr = moniker->BindToObject(pbc, NULL, IID_IPolyline, (void**)&polyline2);
	if (FAILED(hr)) {
		return -1;
	}
	outputPoints(polyline);
	outputPoints(polyline2);
	polyline->put_Color(RGB(0xff, 0x00, 0x00));
	COLORREF value;
	polyline->get_Color(&value);
	assert(value == RGB(0xff, 0x00, 0x00));
	return 0;
}
Example #2
0
int BookServerTest::readFileMoniker()
{
	ComPtr<IStorage> pStorage;
	ComPtr<IStream> pStream;
	auto hr = StgOpenStorageEx(kMonikerFileName,
		STGM_READ | STGM_SHARE_EXCLUSIVE | STGM_DIRECT, STGFMT_STORAGE, 0, NULL, 0, IID_IStorage, (void**)&pStorage);
	if (FAILED(hr))
		return hr;
	hr = pStorage->OpenStream(kStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
	if (FAILED(hr))
		return hr;
	ComPtr<IMoniker> moniker;
	OleLoadFromStream(pStream, IID_IMoniker, (void**)&moniker);
	IBindCtx* pbc;
	CreateBindCtx(0, &pbc);
	ComPtr<IBook> book;
	hr = moniker->BindToObject(pbc, NULL, IID_IBook, (void**)&book);
	if (FAILED(hr)) {
		return -1;
	}
	ComBSTR name;
	book->get_name(&name);
	assert(name == kBookName);
	return 0;
}
Example #3
0
File: link.c Project: GYGit/reactos
static HRESULT WINAPI IPersistStream_fnLoad(IPersistStream* iface,
        IStream* pStm)
{
    HRESULT r;
    DWORD hdr[2];
    DWORD read;
    HlinkImpl *This = impl_from_IPersistStream(iface);

    r = IStream_Read(pStm, hdr, sizeof(hdr), &read);
    if (read != sizeof(hdr) || (hdr[0] != HLINK_SAVE_MAGIC))
    {
        r = E_FAIL;
        goto end;
    }
    if (hdr[1] & ~HLINK_SAVE_ALL)
        FIXME("unknown flag(s) 0x%x\n", hdr[1] & ~HLINK_SAVE_ALL);

    if (hdr[1] & HLINK_SAVE_TARGET_FRAME_PRESENT)
    {
        TRACE("loading target frame name\n");
        r = read_hlink_string(pStm, &This->TargetFrameName);
        if (FAILED(r)) goto end;
    }

    if (hdr[1] & HLINK_SAVE_FRIENDLY_PRESENT)
    {
        TRACE("loading target friendly name\n");
        if (!(hdr[1] & 0x4))
            FIXME("0x4 flag not present with friendly name flag - not sure what this means\n");
        r = read_hlink_string(pStm, &This->FriendlyName);
        if (FAILED(r)) goto end;
    }

    if (hdr[1] & HLINK_SAVE_MONIKER_PRESENT)
    {
        TRACE("loading moniker\n");
        r = OleLoadFromStream(pStm, &IID_IMoniker, (LPVOID*)&(This->Moniker));
        if (FAILED(r))
            goto end;
        This->absolute = (hdr[1] & HLINK_SAVE_MONIKER_IS_ABSOLUTE) != 0;
    }

    if (hdr[1] & HLINK_SAVE_LOCATION_PRESENT)
    {
        TRACE("loading location\n");
        r = read_hlink_string(pStm, &This->Location);
        if (FAILED(r)) goto end;
    }

end:
    TRACE("Load Result 0x%x (%p)\n", r, This->Moniker);

    return r;
}
Example #4
0
// Erzeugen und initialisieren eines PropertyActionChoice-Objektes, welches die
// vorgegebenen PropertyActions enthält
HRESULT InitPropertyActionChoice (
	LPCSTR pcDesc, CALPCLSID *pcaClsIds, IPropertyActionSequence **ppISeq)
{
	USES_CONVERSION;

	if (NULL == ppISeq) return E_POINTER;
	*ppISeq = NULL;		// für alle Fälle

WPropertyActionSequence ISeq;
HRESULT hr = E_FAIL;
WStorage IStg;

	GetSubPropSeqStorage (IStg.ppi());
	if (NULL != (IStorage *)IStg) {	// evtl. gespeicherten Status laden
	WStream IStm;
	string strName = MakeStreamName(pcDesc);

	// Stream erzeugen
		hr = IStg -> OpenStream (A2OLE(strName.c_str()), NULL, 
						STGM_READ|STGM_SHARE_EXCLUSIVE, 0L, IStm.ppi());

		if (SUCCEEDED(hr)) {
			hr = OleLoadFromStream (IStm, IID_IPropertyActionSequence, ISeq.ppv());
			if (SUCCEEDED(hr)) {
				*ppISeq = ISeq.detach();
				return S_OK;
			}
		}
	}
	
// wenn Status nicht geladen werden kann, dann neu initialisieren
	try {
	// Objekt erzeugen
		ISeq = WPropertyActionSequence (CLSID_PropertyChoice);		// throws hr
		ISeq -> SetDescription (pcDesc);

	// Rücksetzen der AktionsFolge
	WPersistStreamInit Init = ISeq;		// throws hr

		hr = Init -> InitNew();
		if (FAILED(hr)) _com_issue_error(hr);
	
	} catch (_com_error& hr) {
		return _COM_ERROR(hr);
	}

// hinzufügen der einzelnen Aktionen
	hr = ISeq -> AddActionsByCLSID (pcaClsIds);
	if (FAILED(hr)) return hr;

	*ppISeq = ISeq.detach();

return NOERROR;
}
Example #5
0
// die folgende Funktion ist das konkrete äquivalent für 'OleLoadFromStream' --
HRESULT CreateEnumLONGFromStream (IStream *pIStream, 
								  IEnum<LONG> **ppEnumOut)
{
	ASSERT(NULL != pIStream);
	ASSERT(NULL != ppEnumOut);

	if (NULL == ppEnumOut) 
		return E_POINTER;

	*ppEnumOut = NULL;
	return OleLoadFromStream (pIStream, IID_IEnumLONG, (LPVOID *)ppEnumOut);
}
Example #6
0
// --------------------------------------------------------------------------------------------
STDMETHODIMP CRegOperatPropAct::Load (LPSTREAM pStm)
{
	if (m_bIsInitialized)		// m_bIsInitialized == true, wenn Page schon durch InitNew()
		return E_UNEXPECTED;	// initialisiert wurde

// Daten einlesen
// zuerst Bezeichner einlesen
HRESULT hr = CPropertyAction::Load (pStm);

	if (FAILED(hr)) return hr;

// meine Versionsnummer und Signatur lesen und überprüfen
DWORD dwSignature = 0;
DWORD dwVersion = 0;

	RETURN_FAILED_HRESULT(pStm->Read (&dwSignature, sizeof(DWORD), NULL));
	if (REGOPERATPROPACT_SIGNATURE != dwSignature)
		return E_UNEXPECTED;

	RETURN_FAILED_HRESULT(pStm->Read (&dwVersion, sizeof(DWORD), NULL));
	if ((dwVersion & ~ MINOR_VERSION_MASK) > REGOPERATPROPACT_ACTVERSION)
		return STG_E_OLDDLL;	// File was written with a newer version

// dann selektierte Info der letzten Auswahl
	RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bClassKey, sizeof(BOOL), NULL));
	RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bInter, sizeof(BOOL), NULL));
	RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bExter, sizeof(BOOL), NULL));
	RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bBound, sizeof(BOOL), NULL));

// ggf. Moniker einlesen
BOOL fHasMoniker = TRUE;

	if (dwVersion >= REGOPERATPROPACT_VERSION_1_0_2) {
		RETURN_FAILED_HRESULT (pStm->Read (&fHasMoniker, sizeof(BOOL), NULL));
	}
	if (fHasMoniker) {
		RETURN_FAILED_HRESULT (OleLoadFromStream(pStm, IID_IMoniker, m_mkOperOptions.ppv()));
	}

	if (NULL == m_pRegOperDlg)
		// Initialisierungsdaten für den Dialog wurden zwar soeben von Load() bereitgestellt,
		// können hier aber noch nicht an diesen weitergereicht werden
		m_bHasInitData = true;
	else
		// Initialisierungsdaten an den Dialog weiterreichen
		m_pRegOperDlg->SetSelectedInfo (&m_caSelInfo);
	
	m_bIsInitialized = true;	// Page wurde jetzt durch Load() initialisiert
	m_bIsDirty = false;			// Dialogparameter wurden (noch) nicht verändert
	return S_OK;

} // Load
Example #7
0
void
IT_OLELOADFROMSTREAM(ENV *envp,LONGPROC f)
{
    DWORD retcode;
    LPBYTE lp1,lp2,lp3;
    LPSTR lpString1,lpString2;

    lp1 = (LPBYTE)GetAddress(GETWORD(SP+26),GETWORD(SP+24));
    lpString1 = (LPSTR)GetAddress(GETWORD(SP+22),GETWORD(SP+20));
    lp2 = (LPBYTE)GetAddress(GETWORD(SP+18),GETWORD(SP+16));
    lpString2 = (LPSTR)GetAddress(GETWORD(SP+10),GETWORD(SP+8));
    lp3 = (LPBYTE)GetAddress(GETWORD(SP+6),GETWORD(SP+4));

    retcode = OleLoadFromStream((LPOLESTREAM)lp1,lpString1,
                                (LPOLECLIENT)lp2,GETDWORD(SP+12),
                                lpString2,(LPOLEOBJECT *)lp3);

    envp->reg.sp += 5*LP_86 + LONG_86 + RET_86;
    envp->reg.ax = LOWORD(retcode);
    envp->reg.dx = HIWORD(retcode);
}
Example #8
0
File: dshow.c Project: 3688/FFmpeg
static int
dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
                  enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype)
{
    struct dshow_ctx *ctx = avctx->priv_data;
    IBaseFilter *device_filter = NULL;
    IGraphBuilder *graph = ctx->graph;
    IPin *device_pin = NULL;
    libAVPin *capture_pin = NULL;
    libAVFilter *capture_filter = NULL;
    ICaptureGraphBuilder2 *graph_builder2 = NULL;
    int ret = AVERROR(EIO);
    int r;
    IStream *ifile_stream = NULL;
    IStream *ofile_stream = NULL;
    IPersistStream *pers_stream = NULL;

    const wchar_t *filter_name[2] = { L"Audio capture filter", L"Video capture filter" };


    if ( ((ctx->audio_filter_load_file) && (strlen(ctx->audio_filter_load_file)>0) && (sourcetype == AudioSourceDevice)) ||
            ((ctx->video_filter_load_file) && (strlen(ctx->video_filter_load_file)>0) && (sourcetype == VideoSourceDevice)) ) {
        HRESULT hr;
        char *filename = NULL;

        if (sourcetype == AudioSourceDevice)
            filename = ctx->audio_filter_load_file;
        else
            filename = ctx->video_filter_load_file;

        hr = SHCreateStreamOnFile ((LPCSTR) filename, STGM_READ, &ifile_stream);
        if (S_OK != hr) {
            av_log(avctx, AV_LOG_ERROR, "Could not open capture filter description file.\n");
            goto error;
        }

        hr = OleLoadFromStream(ifile_stream, &IID_IBaseFilter, (void **) &device_filter);
        if (hr != S_OK) {
            av_log(avctx, AV_LOG_ERROR, "Could not load capture filter from file.\n");
            goto error;
        }

        if (sourcetype == AudioSourceDevice)
            av_log(avctx, AV_LOG_INFO, "Audio-");
        else
            av_log(avctx, AV_LOG_INFO, "Video-");
        av_log(avctx, AV_LOG_INFO, "Capture filter loaded successfully from file \"%s\".\n", filename);
    } else {

        if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter)) < 0) {
            ret = r;
            goto error;
        }
    }

    ctx->device_filter [devtype] = device_filter;

    r = IGraphBuilder_AddFilter(graph, device_filter, NULL);
    if (r != S_OK) {
        av_log(avctx, AV_LOG_ERROR, "Could not add device filter to graph.\n");
        goto error;
    }

    if ((r = dshow_cycle_pins(avctx, devtype, sourcetype, device_filter, &device_pin)) < 0) {
        ret = r;
        goto error;
    }

    ctx->device_pin[devtype] = device_pin;

    capture_filter = libAVFilter_Create(avctx, callback, devtype);
    if (!capture_filter) {
        av_log(avctx, AV_LOG_ERROR, "Could not create grabber filter.\n");
        goto error;
    }
    ctx->capture_filter[devtype] = capture_filter;

    if ( ((ctx->audio_filter_save_file) && (strlen(ctx->audio_filter_save_file)>0) && (sourcetype == AudioSourceDevice)) ||
            ((ctx->video_filter_save_file) && (strlen(ctx->video_filter_save_file)>0) && (sourcetype == VideoSourceDevice)) ) {

        HRESULT hr;
        char *filename = NULL;

        if (sourcetype == AudioSourceDevice)
            filename = ctx->audio_filter_save_file;
        else
            filename = ctx->video_filter_save_file;

        hr = SHCreateStreamOnFile ((LPCSTR) filename, STGM_CREATE | STGM_READWRITE, &ofile_stream);
        if (S_OK != hr) {
            av_log(avctx, AV_LOG_ERROR, "Could not create capture filter description file.\n");
            goto error;
        }

        hr  = IBaseFilter_QueryInterface(device_filter, &IID_IPersistStream, (void **) &pers_stream);
        if (hr != S_OK) {
            av_log(avctx, AV_LOG_ERROR, "Query for IPersistStream failed.\n");
            goto error;
        }

        hr = OleSaveToStream(pers_stream, ofile_stream);
        if (hr != S_OK) {
            av_log(avctx, AV_LOG_ERROR, "Could not save capture filter \n");
            goto error;
        }

        hr = IStream_Commit(ofile_stream, STGC_DEFAULT);
        if (S_OK != hr) {
            av_log(avctx, AV_LOG_ERROR, "Could not commit capture filter data to file.\n");
            goto error;
        }

        if (sourcetype == AudioSourceDevice)
            av_log(avctx, AV_LOG_INFO, "Audio-");
        else
            av_log(avctx, AV_LOG_INFO, "Video-");
        av_log(avctx, AV_LOG_INFO, "Capture filter saved successfully to file \"%s\".\n", filename);
    }

    r = IGraphBuilder_AddFilter(graph, (IBaseFilter *) capture_filter,
                                filter_name[devtype]);
    if (r != S_OK) {
        av_log(avctx, AV_LOG_ERROR, "Could not add capture filter to graph\n");
        goto error;
    }

    libAVPin_AddRef(capture_filter->pin);
    capture_pin = capture_filter->pin;
    ctx->capture_pin[devtype] = capture_pin;

    r = CoCreateInstance(&CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER,
                         &IID_ICaptureGraphBuilder2, (void **) &graph_builder2);
    if (r != S_OK) {
        av_log(avctx, AV_LOG_ERROR, "Could not create CaptureGraphBuilder2\n");
        goto error;
    }
    ICaptureGraphBuilder2_SetFiltergraph(graph_builder2, graph);
    if (r != S_OK) {
        av_log(avctx, AV_LOG_ERROR, "Could not set graph for CaptureGraphBuilder2\n");
        goto error;
    }

    r = ICaptureGraphBuilder2_RenderStream(graph_builder2, NULL, NULL, (IUnknown *) device_pin, NULL /* no intermediate filter */,
        (IBaseFilter *) capture_filter); /* connect pins, optionally insert intermediate filters like crossbar if necessary */

    if (r != S_OK) {
        av_log(avctx, AV_LOG_ERROR, "Could not RenderStream to connect pins\n");
        goto error;
    }

    r = dshow_try_setup_crossbar_options(graph_builder2, device_filter, devtype, avctx);

    if (r != S_OK) {
        av_log(avctx, AV_LOG_ERROR, "Could not setup CrossBar\n");
        goto error;
    }

    ret = 0;

error:
    if (graph_builder2 != NULL)
        ICaptureGraphBuilder2_Release(graph_builder2);

    if (pers_stream)
        IPersistStream_Release(pers_stream);

    if (ifile_stream)
        IStream_Release(ifile_stream);

    if (ofile_stream)
        IStream_Release(ofile_stream);

    return ret;
}
Example #9
0
/***********************************************************************
 *             HlinkClone (HLINK.@)
 */
HRESULT WINAPI HlinkClone(IHlink *hlink, REFIID riid, IHlinkSite *hls,
        DWORD site_data, void **obj)
{
    IMoniker *mk, *clone_mk = NULL;
    WCHAR *loc, *name = NULL;
    HRESULT hres;

    if(!hlink || !riid || !obj)
        return E_INVALIDARG;

    *obj = NULL;

    hres = IHlink_GetMonikerReference(hlink, HLINKGETREF_DEFAULT, &mk, &loc);
    if(FAILED(hres))
        return hres;

    if(mk) {
        IStream *strm;
        LARGE_INTEGER lgint;

        hres = CreateStreamOnHGlobal(NULL, TRUE, &strm);
        if(FAILED(hres)) {
            IMoniker_Release(mk);
            goto cleanup;
        }

        hres = OleSaveToStream((IPersistStream*)mk, strm);
        if(FAILED(hres)) {
            IStream_Release(strm);
            IMoniker_Release(mk);
            goto cleanup;
        }
        IMoniker_Release(mk);

        lgint.QuadPart = 0;
        hres = IStream_Seek(strm, lgint, STREAM_SEEK_SET, NULL);
        if(FAILED(hres)) {
            IStream_Release(strm);
            goto cleanup;
        }

        hres = OleLoadFromStream(strm, &IID_IMoniker, (void**)&clone_mk);
        IStream_Release(strm);
        if(FAILED(hres))
            goto cleanup;
    }

    hres = IHlink_GetFriendlyName(hlink, HLFNAMEF_DEFAULT, &name);
    if(FAILED(hres))
        goto cleanup;

    hres = HlinkCreateFromMoniker(clone_mk, loc, name, hls, site_data, NULL,
            &IID_IHlink, obj);

cleanup:
    if(clone_mk)
        IMoniker_Release(clone_mk);
    CoTaskMemFree(loc);
    CoTaskMemFree(name);
    return hres;
}
Example #10
0
static HRESULT STDMETHODCALLTYPE
ITrayBandSiteImpl_OnLoad(IN OUT ITrayBandSite *iface,
                         IN OUT IStream *pStm,
                         IN REFIID riid,
                         OUT PVOID *pvObj)
{
    ITrayBandSiteImpl *This = ITrayBandSiteImpl_from_ITrayBandSite(iface);
    LARGE_INTEGER liPosZero;
    ULARGE_INTEGER liCurrent;
    CLSID clsid;
    ULONG ulRead;
    HRESULT hRet;

    /* NOTE: Callback routine called by the shell while loading the task band
             stream. We use it to intercept the default behavior when the task
             band is loaded from the stream.

       NOTE: riid always points to IID_IUnknown! This is because the shell hasn't
             read anything from the stream and therefore doesn't know what CLSID
             it's dealing with. We'll have to find it out ourselves by reading
             the GUID from the stream. */

    /* Read the current position of the stream, we'll have to reset it everytime
       we read a CLSID that's not the task band... */
    ZeroMemory(&liPosZero,
               sizeof(liPosZero));
    hRet = IStream_Seek(pStm,
                        liPosZero,
                        STREAM_SEEK_CUR,
                        &liCurrent);

    if (SUCCEEDED(hRet))
    {
        /* Now let's read the CLSID from the stream and see if it's our task band */
#if defined(IStream_Read)
        hRet = IStream_Read(pStm,
                            &clsid,
                            sizeof(clsid),
                            &ulRead);
#else
        ulRead = sizeof(clsid);
        hRet = IStream_Read(pStm,
                            &clsid,
                            sizeof(clsid));
#endif
        if (SUCCEEDED(hRet) && ulRead == sizeof(clsid))
        {
            if (IsEqualGUID(&clsid,
                            &CLSID_ITaskBand))
            {
                ASSERT(This->TaskBand != NULL);
                /* We're trying to load the task band! Let's create it... */

                hRet = ITaskBand_QueryInterface(This->TaskBand,
                                                riid,
                                                pvObj);
                if (SUCCEEDED(hRet))
                {
                    /* Load the stream */
                    DbgPrint("IBandSiteStreamCallback::OnLoad intercepted the task band CLSID!\n");
                }

                return hRet;
            }
        }
    }

    /* Reset the position and let the shell do all the work for us */
    hRet = IStream_Seek(pStm,
                        *(LARGE_INTEGER*)&liCurrent,
                        STREAM_SEEK_SET,
                        NULL);
    if (SUCCEEDED(hRet))
    {
        /* Let the shell handle everything else for us :) */
        hRet = OleLoadFromStream(pStm,
                                 riid,
                                 pvObj);
    }

    if (!SUCCEEDED(hRet))
    {
        DbgPrint("IBandSiteStreamCallback::OnLoad(0x%p, 0x%p, 0x%p) returns 0x%x\n", pStm, riid, pvObj, hRet);
    }

    return hRet;
}
Example #11
0
int BookServerTest::readItemMoniker()
{
	ComPtr<IStorage> pStorage;
	ComPtr<IStream> pStream;
	auto hr = StgOpenStorageEx(kMonikerFileName,
		STGM_READ | STGM_SHARE_EXCLUSIVE | STGM_DIRECT, STGFMT_STORAGE, 0, NULL, 0, IID_IStorage, (void**)&pStorage);
	if (FAILED(hr))
		return hr;
	hr = pStorage->OpenStream(kStreamName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
	if (FAILED(hr))
		return hr;
	IBindCtx* pbc;
	CreateBindCtx(0, &pbc);
	ComPtr<IMoniker> bkMoniker;
	OleLoadFromStream(pStream, IID_IMoniker, (void**)&bkMoniker);

	{
		ComPtr<IBook> book;
		ComPtr<IBook> book2;
		auto hr = bkMoniker->BindToObject(pbc, NULL, IID_IBook, (void**)&book);
		assert(book);
		//hr = bkMoniker->BindToObject(pbc, NULL, IID_IBook, (void**)&book2);
		//assert(book2);
	}

	{
		ComPtr<IMoniker> chMoniker;
		CreateItemMoniker(L"!", L"chapter0", &chMoniker);
		ComPtr<IChapter> chObj;
		hr = chMoniker->BindToObject(pbc, bkMoniker, IID_IChapter, (void**)&chObj);
		if (FAILED(hr))
			return hr;
		ComBSTR chName;
		chObj->get_name(&chName);
		assert(chName == L"概述");
	}

	{
		ComPtr<ISection> secObj;
		ComPtr<IMoniker> chMoniker;
		ComPtr<IMoniker> secMoniker;
		CreateItemMoniker(L"!", L"chapter0", &chMoniker);
		CreateItemMoniker(L"!", L"section0", &secMoniker);
		ComPtr<IMoniker> composeMoniker;
		chMoniker->ComposeWith(secMoniker, FALSE, &composeMoniker);
		hr = composeMoniker->BindToObject(pbc, bkMoniker, IID_ISection, (void**)&secObj);
		if (FAILED(hr))
			return hr;
		ComBSTR name;
		secObj->get_name(&name);
	}

	//ComPtr<IMoniker> secMoniker;
	//CreateItemMoniker(L"!", L"section0", &secMoniker);
	//ComPtr<ISection> secObj;
	//hr = secMoniker->BindToObject(pbc, bkMoniker, IID_ISection, (void**)&secObj);
	//if (FAILED(hr))
	//	return hr;
	//ComBSTR secName;
	//secObj->get_name(&secName);
	//assert(secName == L"how to read this book");

	//chObj = NULL;
	//ComPtr<IMoniker> composeMoniker;
	//hr = bkMoniker->ComposeWith(chMoniker, FALSE, &composeMoniker);
	//if (FAILED(hr))
	//	return hr;
	//composeMoniker->BindToObject(pbc, NULL, IID_IChapter, (void**)&chObj);
	//chObj->get_name(&chName);
	//assert(chName == L"概述");
	//CreateGenericComposite(bkMoniker, chMoniker, &composeMoniker);
	return 0;
}