CoRegisterDeviceCatalog function (combaseapi.h)

Enables a downloaded DLL to register its Media Foundation Transform (MFT) device catalog interfaces within its running process so that the marshaling code will be able to marshal those interfaces.

Syntax

HRESULT CoRegisterDeviceCatalog(
  PCWSTR                   deviceInstanceId,
  CO_DEVICE_CATALOG_COOKIE *cookie
);

Parameters

deviceInstanceId

Type: _In_ PCWSTR

A null-terminated string containing the instance identifier of the device to register.

cookie

Type: _Out_ CO_DEVICE_CATALOG_COOKIE*

Returns an instance of CO_DEVICE_CATALOG_COOKIE. You can use this value to revoke the device catalog using CoRevokeDeviceCatalog.

Return value

This function can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and S_OK.

Remarks

Examples

std::vector<CO_DEVICE_CATALOG_COOKIE> g_deviceCatalogsCookies;

HRESULT MFStartup(ULONG Version, DWORD dwFlags)
{
    // current MFStartup code elided.
    std::wstring devices{ /* set of device IDs of interest */ };
    for (const auto& device : devices)
    {
        CO_DEVICE_CATALOG_COOKIE cookie{};
        RETURN_IF_FAILED(CoRegisterDeviceCatalog(device.c_str(), &cookie));
        g_deviceCatalogsCookies.push_back(cookie);
    }

    return S_OK;
}

HRESULT STDMETHODCALLTYPE MFShutdown()
{
    // current MFShutdown code elided
    for (auto catalogCookie : g_deviceCatalogsCookies)
    {
        CoRevokeDeviceCatalog(catalogCookie);
    }

    return S_OK;
}

Requirements

Requirement Value
Minimum supported client Windows 10, version 2004 (10.0; Build 19041)
Minimum supported server Windows Server, version 2004 (10.0; Build 19041)
Target Platform Windows
Header combaseapi.h (include Objbase.h)
Library Ole32.lib
DLL Ole32.dll

See also