다음을 통해 공유


EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS 콜백 함수(acxelements.h)

EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS 콜백은 키워드(keyword) 스포터에서 사용할 키워드(keyword) 검색에 대한 검색 패턴을 할당합니다.

구문

EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS EvtAcxKeywordspotterAssignPatterns;

NTSTATUS EvtAcxKeywordspotterAssignPatterns(
  ACXKEYWORDSPOTTER KeywordSpotter,
  GUID *EventId,
  PVOID Pattern,
  ULONG PatternSize
)
{...}

매개 변수

KeywordSpotter

초기화된 기존 ACXKEYWORDSPOTTER 개체입니다. ACX 개체에 대한 자세한 내용은 ACX 개체 요약을 참조하세요. AcxKeywordSpotterCreate 함수도 참조하세요.

EventId

EventId를 나타내는 GUID에 대한 포인터입니다.

Pattern

키워드(keyword) 스포터 검색 패턴을 식별하는 GUID입니다.

PatternSize

키워드(keyword) 검색 패턴의 길이(바이트)입니다.

반환 값

호출에 성공하면 를 반환합니다 STATUS_SUCCESS . 그렇지 않으면 적절한 오류 코드를 반환합니다. 자세한 내용은 NTSTATUS 값 사용을 참조하세요.

설명

키워드(keyword) 검색에 대한 일반적인 내용은 음성 활성화다중 음성 도우미를 참조하세요.

예제

예제 사용법은 다음과 같습니다.

EVT_ACX_KEYWORDSPOTTER_ASSIGN_PATTERNS  CodecC_EvtAcxKeywordSpotterAssignPatterns;

NTSTATUS
NTAPI
CodecC_EvtAcxKeywordSpotterAssignPatterns(
    _In_    ACXKEYWORDSPOTTER   KeywordSpotter,
    _In_    GUID *              EventId,
    _In_    PVOID               Pattern,
    _In_    ULONG               PatternSize
    )
{
    KSMULTIPLE_ITEM *               itemsHeader = nullptr;
    SOUNDDETECTOR_PATTERNHEADER *   patternHeader;
    CONTOSO_KEYWORDCONFIGURATION *  pattern;
    ULONG                           cbRemaining = 0;
    PCODEC_KEYWORDSPOTTER_CONTEXT   keywordSpotterCtx;
    CKeywordDetector *              keywordDetector = NULL;

    PAGED_CODE();

    keywordSpotterCtx = GetCodecKeywordSpotterContext(KeywordSpotter);

    keywordDetector = (CKeywordDetector*)keywordSpotterCtx->KeywordDetector;

    cbRemaining = PatternSize;

    // The SYSVADPROPERTY_ITEM for this property ensures the value size is at
    // least sizeof KSMULTIPLE_ITEM.
    if (cbRemaining < sizeof(KSMULTIPLE_ITEM))
    {
        return STATUS_INVALID_PARAMETER;
    }

    itemsHeader = (KSMULTIPLE_ITEM*)Pattern;

    // Verify property value is large enough to include the items
    if (itemsHeader->Size > cbRemaining)
    {
        return STATUS_INVALID_PARAMETER;
    }

    // No items so clear the configuration.
    if (itemsHeader->Count == 0)
    {
        keywordDetector->ResetDetector(*EventId);
        return STATUS_SUCCESS;
    }

    // This sample supports only 1 pattern type.
    if (itemsHeader->Count > 1)
    {
        return STATUS_NOT_SUPPORTED;
    }

    // Bytes remaining after the items header
    cbRemaining = itemsHeader->Size - sizeof(*itemsHeader);

    // Verify the property value is large enough to include the pattern header.
    if (cbRemaining < sizeof(SOUNDDETECTOR_PATTERNHEADER))
    {
        return STATUS_INVALID_PARAMETER;
    }

    patternHeader = (SOUNDDETECTOR_PATTERNHEADER*)(itemsHeader + 1);

    // Verify the pattern type is supported.
    if (patternHeader->PatternType != CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER2)
    {
        return STATUS_NOT_SUPPORTED;
    }

    // Verify the property value is large enough for the pattern.
    if (cbRemaining < patternHeader->Size)
    {
        return STATUS_INVALID_PARAMETER;
    }

    // Verify the pattern is large enough.
    if (patternHeader->Size != sizeof(CONTOSO_KEYWORDCONFIGURATION))
    {
        return STATUS_INVALID_PARAMETER;
    }

    pattern = (CONTOSO_KEYWORDCONFIGURATION*)(patternHeader);

    return keywordDetector->DownloadDetectorData(*EventId, pattern->ContosoDetectorConfigurationData);
}

ACX 요구 사항

최소 ACX 버전: 1.0

ACX 버전에 대한 자세한 내용은 ACX 버전 개요를 참조하세요.

요구 사항

요구 사항
헤더 acxelements.h
IRQL PASSIVE_LEVEL

추가 정보