Partager via


CoRegisterDeviceCatalog, fonction (combaseapi.h)

Permet à une DLL téléchargée d’inscrire ses interfaces de catalogue d’appareils Media Foundation Transform (MFT) dans son processus en cours d’exécution afin que le code de marshaling puisse marshaler ces interfaces.

Syntaxe

HRESULT CoRegisterDeviceCatalog(
  PCWSTR                   deviceInstanceId,
  CO_DEVICE_CATALOG_COOKIE *cookie
);

Paramètres

deviceInstanceId

Type : _In_ PCWSTR

Chaîne terminée par null contenant l’identificateur instance de l’appareil à inscrire.

cookie

Type : _Out_ CO_DEVICE_CATALOG_COOKIE*

Retourne une instance de CO_DEVICE_CATALOG_COOKIE. Vous pouvez utiliser cette valeur pour révoquer le catalogue d’appareils à l’aide de CoRevokeDeviceCatalog.

Valeur retournée

Cette fonction peut retourner les valeurs de retour standard E_INVALIDARG, E_OUTOFMEMORY et S_OK.

Notes

Exemples

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;
}

Configuration requise

   
Client minimal pris en charge Windows 10, version 2004 (10.0; Build 19041)
Serveur minimal pris en charge Windows Server, version 2004 (10.0 ; Build 19041)
Plateforme cible Windows
En-tête combaseapi.h (inclure Objbase.h)
Bibliothèque Ole32.lib
DLL Ole32.dll

Voir aussi