ETW提供商的渠道名称

时间:2012-11-12 22:36:37

标签: windows winapi event-log etw

我正在尝试使用Windows事件跟踪(ETW)提供程序清单来注册正确的通道名称。当我使用清单(包含在下面)时,我得到以下结果。但是,当我检查我的清单与注册表中的All-User-Install-Agent清单(存储在HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ WINEVT)中的结果之间的差异时,我没有看到任何理由为什么我的使用Foo-Bat-TestApp /前缀显示密钥。如何摆脱前缀?我无法从name属性中删除它们,因为已经有一个使用“Operational”名称的OS组件(它是注册表中的一个平面列表)。

Event Viewer Snapshot

我的示例清单如下所示:

<?xml version="1.0" encoding="utf-16"?>
<instrumentationManifest
    xmlns="http://schemas.microsoft.com/win/2004/08/events"
    xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <instrumentation>
    <events>
      <provider name="Foo-Bar-TestApp"
                guid="{C5C633DC-FB7E-4EA0-80EC-C683FA52561C}"
                symbol="EtwProvider"
                resourceFileName="C:\Projects\ETWTest\bin\Debug\ETWTest..dll"
                messageFileName="C:\Projects\ETWTest\bin\Debug\ETWTest.dll">
        <channels>
          <channel name="Foo-Bar-TestApp/Admin"
                   chid="Admin"
                   type="Admin"
                   enabled="true" />
          <channel name="Foo-Bar-TestApp/Operational"
                   chid="Operational"
                   type="Operational"
                   enabled="true" />
          <channel name="Foo-Bar-TestApp/Debug"
                   chid="Debug"
                   type="Debug"
                   enabled="false" />
        </channels>
        <keywords>
          <keyword name="KeywordA" symbol="READ_KEYWORD" mask="0x1" />
          <keyword name="KeywordB" symbol="WRITE_KEYWORD" mask="0x2" />
        </keywords>
       <events>
          <event version="1"
                 value="1"
                 symbol="SampleEvent"
                 channel="Operational"
                 level="win:Informational"
                 message="$(string.Event.SampleEvent)"
                 keywords="KeywordA" />
        </events>
      </provider>
    </events>
  </instrumentation>
  <localization>
    <resources culture="en-US">
      <stringTable>
        <string id="Event.SampleEvent" value="This is a sample event"/>
      </stringTable>
    </resources>
  </localization>
</instrumentationManifest>

1 个答案:

答案 0 :(得分:0)

为了实现所需的功能,您必须在通道定义上使用symbol属性。见下面的例子:
<channel name="Admin" symbol="Foo-Bar-TestApp-Admin" chid="Admin" type="Admin" enabled="true" />