59 lines
2.5 KiB
C#
59 lines
2.5 KiB
C#
//---------------------------------------------------------------------------------------------------------------
|
|
// <copyright file="Programs.cs" company="Microsoft">
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//
|
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
|
|
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
|
// PURPOSE.
|
|
//
|
|
// </copyright>
|
|
// <summary>
|
|
// Simple ETW eventing provider sample for Windows 7 SDK.
|
|
// Demonstrates how to easily create a ETW provider using the macros generated by MC (Message Compiler).
|
|
// </summary>
|
|
//---------------------------------------------------------------------------------------------------------------
|
|
namespace SimpleProvider
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using SimpleProvider;
|
|
|
|
/// <summary>
|
|
/// Program class defines the Main method.
|
|
/// </summary>
|
|
class Program
|
|
{
|
|
/// <summary>
|
|
/// Calls the methods defined in the generated code (SimpleProviderEvents.cs) and
|
|
/// logs event data for each event defined in the manifest (SimpleProvider.man).
|
|
/// </summary>
|
|
static void Main(string[] args)
|
|
{
|
|
MicrosoftWindowsSDKSampleSimpleProviderCs simplePrvdr = new MicrosoftWindowsSDKSampleSimpleProviderCs();
|
|
|
|
// Write Integer data for Event ID 101 in SimpleProvider.man.
|
|
simplePrvdr.EventWriteSampleEvt_INT32(3);
|
|
Console.WriteLine("EventWriteSampleEvt_INT32().");
|
|
|
|
// Write Float data for Event ID 102 in SimpleProvider.man.
|
|
simplePrvdr.EventWriteSampleEvt_Float(3.0F);
|
|
Console.WriteLine("EventWriteSampleEvt_Float().");
|
|
|
|
// Write Boolean data for Event ID 103 in SimpleProvider.man.
|
|
simplePrvdr.EventWriteSampleEvt_Bool(true);
|
|
Console.WriteLine("EventWriteSampleEvt_Bool().");
|
|
|
|
// Write String data for Event ID 104 in SimpleProvider.man.
|
|
simplePrvdr.EventWriteSampleEvt_UnicodeString("Sample String.");
|
|
Console.WriteLine("EventWriteSampleEvt_UnicodeString().");
|
|
|
|
// Write the provider GUID for Event ID 105 in SimpleProvider.man.
|
|
simplePrvdr.EventWriteSampleEvt_Guid(new Guid("21a9201e-73b0-43fe-9821-7e159a59bc71"));
|
|
Console.WriteLine("EventWriteSampleEvt_Guid().");
|
|
}
|
|
}
|
|
}
|