private static void FireWinSQMEvent( WinSQMWrapper.EventDescriptor eventDescriptor, uint dataPointID, uint dataPointValue) { Guid empty = Guid.Empty; if (!WinSQMWrapper.WinSqmEventEnabled(ref eventDescriptor, ref empty)) { return; } IntPtr num1 = Marshal.AllocHGlobal(Marshal.SizeOf((object)WinSQMWrapper.WINDOWS_SQM_GLOBALSESSION)); IntPtr num2 = Marshal.AllocHGlobal(4); IntPtr num3 = Marshal.AllocHGlobal(4); try { Marshal.StructureToPtr((object)WinSQMWrapper.WINDOWS_SQM_GLOBALSESSION, num1, true); Marshal.StructureToPtr((object)dataPointID, num2, true); Marshal.StructureToPtr((object)dataPointValue, num3, true); WinSQMWrapper.FireWinSQMEvent(eventDescriptor, num1, num2, num3); } finally { Marshal.FreeHGlobal(num1); Marshal.FreeHGlobal(num2); Marshal.FreeHGlobal(num3); } }
private static void FireWinSQMEvent( WinSQMWrapper.EventDescriptor eventDescriptor, Dictionary <uint, uint> dataToWrite) { Guid empty = Guid.Empty; if (!WinSQMWrapper.WinSqmEventEnabled(ref eventDescriptor, ref empty)) { return; } IntPtr num1 = Marshal.AllocHGlobal(Marshal.SizeOf((object)WinSQMWrapper.WINDOWS_SQM_GLOBALSESSION)); IntPtr num2 = Marshal.AllocHGlobal(4); IntPtr num3 = Marshal.AllocHGlobal(4); try { Marshal.StructureToPtr((object)WinSQMWrapper.WINDOWS_SQM_GLOBALSESSION, num1, true); foreach (uint key in dataToWrite.Keys) { uint num4 = dataToWrite[key]; Marshal.StructureToPtr((object)key, num2, true); Marshal.StructureToPtr((object)num4, num3, true); WinSQMWrapper.FireWinSQMEvent(eventDescriptor, num1, num2, num3); } } finally { Marshal.FreeHGlobal(num1); Marshal.FreeHGlobal(num2); Marshal.FreeHGlobal(num3); } }