/// <summary> /// Calls the methods defined in the generated code (AdvancedProviderEvents.cs) and /// logs event data for each event defined in the manifest (AdvancedProvider.man). /// </summary> static void Main(string[] args) { MicrosoftWindowsSDKSampleAdvancedProviderCs advProvider = new MicrosoftWindowsSDKSampleAdvancedProviderCs(); SecurityIdentifier sidWellKnow = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null); DateTime timeIn = DateTime.Now; // Write Integer data for Event ID 102 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_INT8(1); Console.WriteLine("EventWriteSampleEvt_INT8()."); // Write Integer data for Event ID 103 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_UINT8(1); Console.WriteLine("EventWriteSampleEvt_UINT8()."); // Write Integer data for Event ID 104 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_UINT8_HEXINT8(1); Console.WriteLine("EventWriteSampleEvt_UINT8_HEXINT8()."); // Write Integer data for Event ID 105 in AdvancedProvider.man advProvider.EventWriteSampleEvt_INT16(1); Console.WriteLine("EventWriteSampleEvt_INT16()."); // Write Integer data for Event ID 106 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT16(1); Console.WriteLine("EventWriteSampleEvt_UINT16()."); // Write Integer data for Event ID 107 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_UINT16_HexInt16(1); Console.WriteLine("EventWriteSampleEvt_UINT16_HexInt16()."); // Write Integer data for Event ID 108 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_INT32(1); Console.WriteLine("EventWriteSampleEvt_INT32()."); // Write Integer data for Event ID 109 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT32(1); Console.WriteLine("EventWriteSampleEvt_UINT32()."); // Write Integer data for Event ID 110 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT32_PID(1); Console.WriteLine("EventWriteSampleEvt_UINT32_PID()."); // Write Integer data for Event ID 111 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT32_TID(1); Console.WriteLine("EventWriteSampleEvt_UINT32_TID()."); // Write Integer data for Event ID 112 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT32_IPV4(1); Console.WriteLine("EventWriteSampleEvt_UINT32_IPV4()."); // Write Integer data for Event ID 114 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT32_ERRORCODE(1); Console.WriteLine("EventWriteSampleEvt_UINT32_ERRORCODE()."); // Write Integer data for Event ID 115 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT32_HEXINT32(1); Console.WriteLine("EventWriteSampleEvt_UINT32_HEXINT32()."); // Write Integer data for Event ID 116 in AdvancedProvider.man advProvider.EventWriteSampleEvt_INT64(1); Console.WriteLine("EventWriteSampleEvt_INT64()."); // Write Integer data for Event ID 117 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT64(1); Console.WriteLine("EventWriteSampleEvt_UINT64()."); // Write Integer data for Event ID 118 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UINT64_HEXInt64(1); Console.WriteLine("EventWriteSampleEvt_UINT64_HEXInt64()."); // Write Float data for Event ID 119 in AdvancedProvider.man advProvider.EventWriteSampleEvt_FLOAT(1); Console.WriteLine("EventWriteSampleEvt_FLOAT()."); // Write Double data for Event ID 120 in AdvancedProvider.man advProvider.EventWriteSampleEvt_DOUBLE(1); Console.WriteLine("EventWriteSampleEvt_DOUBLE()."); // Write Boolean for Event ID 121 in AdvancedProvider.man advProvider.EventWriteSampleEvt_BOOL(true); Console.WriteLine("EventWriteSampleEvt_BOOL()."); // Write GUID data for Event ID 125 in AdvancedProvider.man Guid ProGuid = new Guid("21a9201e-73b0-43fe-9821-7e159a59bc70"); advProvider.EventWriteSampleEvt_GUID(ProGuid); Console.WriteLine("EventWriteSampleEvt_GUID()."); // Write Pointer data for Event ID 126 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_POINTER(IntPtr.Zero); Console.WriteLine("EventWriteSampleEvt_POINTER()."); // Write DateTime Event ID 127 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_FILETIME(timeIn); Console.WriteLine("EventWriteSampleEvt_FILETIME()."); // Write SecurityIdentifier Event ID 129 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_SID(sidWellKnow); Console.WriteLine("EventWriteSampleEvt_SID()."); // Write NULL terminated unicode string for Event ID 200 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_UnicodeString("Sample UnicodeString"); Console.WriteLine("EventWriteSampleEvt_UnicodeString()."); // Write Fixed length unicode string for Event ID 202 in AdvancedProvider.man. String Prop_FixedLength_Unicode_String; Prop_FixedLength_Unicode_String = "Unicode String"; advProvider.EventWriteSampleEvt_FixedLength_UnicodeString(Prop_FixedLength_Unicode_String); Console.WriteLine("EventWriteSampleEvt_FixedLength_UnicodeString()."); // Write parametrized length Unicode string for Event ID 205 in AdvancedProvider.man String Prop_ParamLength_UnicodeString = "Param Length Unicode String."; uint Prop_ParamLength_UnicodString_Length = Convert.ToUInt16(Prop_ParamLength_UnicodeString.Length); advProvider.EventWriteSampleEvt_ParamLength_UnicodeString(Prop_ParamLength_UnicodString_Length, Prop_ParamLength_UnicodeString); Console.WriteLine("EventWriteSampleEvt_ParamLength_UnicodeString()."); // Write Parametrized count Integer data array for Event ID 309 in AdvancedProvider.man byte[] Prop_ParamCount_Int8 = { Convert.ToByte('a'), Convert.ToByte('b'), Convert.ToByte('c'), Convert.ToByte('d') }; //advProvider.EventWriteSampleEvt_ParamCount_Int8(Convert.ToByte(4), Prop_ParamCount_Int8); Console.WriteLine("EventWriteSampleEvt_ParamCount_Int8()."); // Write NULL terminated unicode string under User defined channels for Event ID 600 advProvider.EventWriteSampleEvt_UserChannel_UnicodeString("UnicodeString"); Console.WriteLine("EventWriteSampleEvt_UserChannel_UnicodeString()."); // Write Integer data under User defined channel for Event ID 601 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UserChannel_UINT8(1); Console.WriteLine("EventWriteSampleEvt_UserChannel_UINT8()."); // Write Integer data with User defined keyword for Event ID 602 in AdvancedProvider.man advProvider.EventWriteSampleEvt_UserKeyword_UINT8(1); Console.WriteLine("EventWriteSampleEvt_UserKeyword_UINT8()."); // UnAligned template data. byte Prop_Alignment_UInt8_UnicodeString_1 = 97; String Prop_Alignment_UInt8_UnicodeString_2 = "UnAligned UnicodeString..."; advProvider.EventWriteSampleEvt_Alignment_UInt8_UnicodeString(Prop_Alignment_UInt8_UnicodeString_1, Prop_Alignment_UInt8_UnicodeString_2); Console.WriteLine("EventWriteSampleEvt_Alignment_UInt8_UnicodeString()."); // Value Map for Event ID 605 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_ValueMap_UInt8(1); Console.WriteLine("EventWriteSampleEvt_ValueMap_UInt8()."); // Value Map for Event ID 605 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_ValueMap_UInt8(2); Console.WriteLine("EventWriteSampleEvt_ValueMap_UInt8()."); // Value Map for Event ID 605 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_ValueMap_UInt8(3); Console.WriteLine("EventWriteSampleEvt_ValueMap_UInt8()."); // Value map for Event ID 605 but value not defined in the manifiset. advProvider.EventWriteSampleEvt_ValueMap_UInt8(5); Console.WriteLine("EventWriteSampleEvt_ValueMap_UInt8()."); // Bit Map for Event ID 606 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_BitMap_UInt8(1); Console.WriteLine("EventWriteSampleEvt_BitMap_UInt8()."); // Bit Map for Event ID 606 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_BitMap_UInt8(2); Console.WriteLine("EventWriteSampleEvt_BitMap_UInt8()."); // Bit Map for Event ID 606 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_BitMap_UInt8(3); Console.WriteLine("EventWriteSampleEvt_BitMap_UInt8()."); // Bit Map for Event ID 606 but value not in the manifest. advProvider.EventWriteSampleEvt_BitMap_UInt8(8); Console.WriteLine("EventWriteSampleEvt_BitMap_UInt8()."); // Win32Error values. advProvider.EventWriteSampleEvt_UInt32_Win32Error(122); Console.WriteLine("EventWriteSampleEvt_UInt32_Win32Error()."); // NTbReturn Error values. advProvider.EventWriteSampleEvt_UInt32_NTSTATUS(0); Console.WriteLine("EventWriteSampleEvt_UInt32_NTbReturn()."); // HResult Error Values. advProvider.EventWriteSampleEvt_Int32_HResult(-1); Console.WriteLine("EventWriteSampleEvt_Int32_HResult()."); // duplicate event IDs, different version. advProvider.EventWriteSampleEvt_INT8_V1(1); Console.WriteLine("EventWriteSampleEvt_INT8_V1()."); // Write Integer data for Event ID 102, Version 1 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_INT8_V2(1); Console.WriteLine("EventWriteSampleEvt_INT8_V2()."); // Write NULL terminated Unicdoe string for Event ID 200, Version 1 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_UnicodeString_V1("Unicode String on Event Version 1"); Console.WriteLine("EventWriteSampleEvt_UnicodeString_V1()."); // Write Fixed count Integer for Event ID 702, Version 2 in AdvancedProvider.man. advProvider.EventWriteSampleEvt_Int32_HResult_V2(-1); Console.WriteLine("EventWriteSampleEvt_Int32_HResult_V2()."); }