Example #1
0
        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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
 private static void FireWinSQMEvent(
     WinSQMWrapper.EventDescriptor eventDescriptor,
     IntPtr sessionHandle,
     IntPtr dataPointIDHandle,
     IntPtr dataValueHandle)
 {
     WinSQMWrapper.EventDataDescriptor[] userData = new WinSQMWrapper.EventDataDescriptor[3]
     {
         new WinSQMWrapper.EventDataDescriptor(sessionHandle, Marshal.SizeOf((object)WinSQMWrapper.WINDOWS_SQM_GLOBALSESSION)),
         new WinSQMWrapper.EventDataDescriptor(dataPointIDHandle, 4),
         new WinSQMWrapper.EventDataDescriptor(dataValueHandle, 4)
     };
     int num = (int)WinSQMWrapper.WinSqmEventWrite(ref eventDescriptor, userData.Length, userData);
 }
Example #4
0
 private static extern uint WinSqmEventWrite(
     ref WinSQMWrapper.EventDescriptor eventDescriptor,
     int userDataCount,
     WinSQMWrapper.EventDataDescriptor[] userData);
Example #5
0
 private static extern bool WinSqmEventEnabled(
     ref WinSQMWrapper.EventDescriptor eventDescriptor,
     ref Guid guid);