Beispiel #1
0
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
	int codepage, int *cached)
{
	ITypeLib *TL;
	char *name_dup;
	size_t l;

	l = strlen(search_string);

	if ((TL = zend_ts_hash_str_find_ptr(&php_com_typelibraries, search_string, l)) != NULL) {
		*cached = 1;
		/* add a reference for the caller */
		ITypeLib_AddRef(TL);
		return TL;
	}

	*cached = 0;
	name_dup = estrndup(search_string, l);
	TL = php_com_load_typelib(name_dup, codepage);
	efree(name_dup);

	if (TL) {
		if (NULL != zend_ts_hash_str_update_ptr(&php_com_typelibraries,
				search_string, l, TL)) {
			/* add a reference for the hash table */
			ITypeLib_AddRef(TL);
		}
	}

	return TL;
}
Beispiel #2
0
static void ref_count_test(LPCWSTR type_lib)
{
    ITypeLib *iface;
    ITypeInfo *iti1, *iti2;
    HRESULT hRes;
    int ref_count;

    trace("Loading type library\n");
    hRes = LoadTypeLib(type_lib, &iface);
    ok(hRes == S_OK, "Could not load type library\n");
    if(hRes != S_OK)
        return;

    hRes = ITypeLib_GetTypeInfo(iface, 1, &iti1);
    ok(hRes == S_OK, "ITypeLib_GetTypeInfo failed on index = 1\n");
    ok(ref_count=ITypeLib_Release(iface) > 0, "ITypeLib destroyed while ITypeInfo has back pointer\n");
    if(!ref_count)
        return;

    hRes = ITypeLib_GetTypeInfo(iface, 1, &iti2);
    ok(hRes == S_OK, "ITypeLib_GetTypeInfo failed on index = 1\n");
    ok(iti1 == iti2, "ITypeLib_GetTypeInfo returned different pointers for same indexes\n");

    ITypeLib_AddRef(iface);
    ITypeInfo_Release(iti2);
    ITypeInfo_Release(iti1);
    ok(ITypeLib_Release(iface) == 0, "ITypeLib should be destroyed here.\n");
}
Beispiel #3
0
HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
    ITypeLib* This,
    LPTLIBATTR* ppTLibAttr,
    CLEANLOCALSTORAGE* pDummy)
{
    HRESULT hr;
    TRACE("(%p, %p)\n", This, ppTLibAttr);
    
    hr = ITypeLib_GetLibAttr(This, ppTLibAttr);
    if(hr != S_OK)
        return hr;

    pDummy->flags = CLS_LIBATTR;
    ITypeLib_AddRef(This);
    pDummy->pInterface = (IUnknown*)This;
    pDummy->pStorage = ppTLibAttr;
    return hr;
}
Beispiel #4
0
ITypeLib *get_msi_typelib( LPWSTR *path )
{
    EnterCriticalSection( &MSI_typelib_cs );

    if (!msi_typelib)
    {
        TRACE("loading typelib\n");

        if (GetModuleFileNameW( msi_hInstance, msi_path, MAX_PATH ))
            LoadTypeLib( msi_path, &msi_typelib );
    }

    LeaveCriticalSection( &MSI_typelib_cs );

    if (path)
        *path = msi_path;

    if (msi_typelib)
        ITypeLib_AddRef( msi_typelib );

    return msi_typelib;
}
Beispiel #5
0
ITypeLib *get_msxml3_typelib( LPWSTR *path )
{
    static WCHAR msxml3_path[MAX_PATH];

    EnterCriticalSection( &MSXML3_typelib_cs );

    if (!typelib)
    {
        TRACE("loading typelib\n");

        if (GetModuleFileNameW( hInstance, msxml3_path, MAX_PATH ))
            LoadTypeLib( msxml3_path, &typelib );
    }

    LeaveCriticalSection( &MSXML3_typelib_cs );

    if (path)
        *path = msxml3_path;

    if (typelib)
        ITypeLib_AddRef( typelib );

    return typelib;
}