Example #1
0
        private void EndFeedbackSession(bool normalExit)
        {
            if (this.sqmSessionHandle == null && (this.sqmSessionHandle == null || !this.sqmSessionHandle.IsInvalid && !this.sqmSessionHandle.IsClosed))
            {
                return;
            }
            if (!UnsafeNativeMethods.Set(this.sqmSessionHandle, 4U, normalExit ? 0U : 1U))
            {
                Marshal.GetLastWin32Error();
            }
            string feedbackPath = FeedbackService.FeedbackPath;

            try
            {
                this.sqmSessionHandle.FilePattern = this.EndSessionFileNamePattern;
            }
            catch (ArgumentException ex)
            {
            }
            try
            {
                if (!UnsafeNativeMethods.EndSession(this.sqmSessionHandle, this.EndSessionFileNamePattern, HSQMSESSION.MaxFilesToQueue, 10U))
                {
                    Marshal.GetLastWin32Error();
                }
            }
            catch (Exception ex)
            {
            }
            this.sqmSessionHandle = (HSQMSESSION)null;
        }
Example #2
0
        private bool CreateFeedbackSession(ExpressionApplication application)
        {
            if (string.IsNullOrEmpty(this.LoggingFileName))
            {
                this.LoggingFileName = "MySqmSession";
            }
            this.sqmSessionHandle = UnsafeNativeMethods.GetSession(this.LoggingFileName, 65536U, 1U);
            if (this.sqmSessionHandle == null)
            {
                Marshal.GetLastWin32Error();
                return(false);
            }
            if (this.sqmSessionHandle.IsInvalid)
            {
                return(false);
            }
            if (!UnsafeNativeMethods.SetAppId(this.sqmSessionHandle, (uint)application.CustomerFeedbackApplicationIdentifier))
            {
                Marshal.GetLastWin32Error();
                return(false);
            }
            Version version = ExpressionApplication.Version;

            if (!UnsafeNativeMethods.SetAppVersion(this.sqmSessionHandle, (uint)((version.Major << 16) + version.Minor), (uint)((version.Build << 16) + version.Revision)))
            {
                Marshal.GetLastWin32Error();
                return(false);
            }
            if (!UnsafeNativeMethods.ReadSharedMachineId(ref this.sharedMachineId) && !UnsafeNativeMethods.CreateNewId(ref this.sharedMachineId))
            {
                UnsafeNativeMethods.WriteSharedMachineId(ref this.sharedMachineId);
            }
            UnsafeNativeMethods.SetMachineId(this.sqmSessionHandle, ref this.sharedMachineId);
            if (!UnsafeNativeMethods.ReadSharedUserId(ref this.sharedUserId) && !UnsafeNativeMethods.CreateNewId(ref this.sharedUserId))
            {
                UnsafeNativeMethods.WriteSharedUserId(ref this.sharedUserId);
            }
            UnsafeNativeMethods.SetUserId(this.sqmSessionHandle, ref this.sharedUserId);
            return(true);
        }
 public static extern bool Increment(HSQMSESSION hSession, uint dwId, uint dwInc);
 public static extern bool SetIfMin(HSQMSESSION hSession, uint dwId, uint dwVal);
 public static extern bool SetAppId(HSQMSESSION hSession, uint dwAppId);
 public static extern bool GetEnabled(HSQMSESSION hSession);
 public static extern bool ClearFlags(HSQMSESSION hSession, uint dwFlags);
 public static extern bool AddToStreamDWord(HSQMSESSION hSession, uint dwId, uint cTuple, uint dwVal);
 public static extern bool SetString(HSQMSESSION hSession, uint dwId, string pwszVal);
Example #10
0
 public static extern bool GetUserId(HSQMSESSION hSession, ref Guid pGuid);
Example #11
0
 public static extern bool GetMachineId(HSQMSESSION hSession, ref Guid pGuid);
Example #12
0
 public static extern bool TimerAddToAverage(HSQMSESSION hSession, uint dwId);
Example #13
0
 public static extern bool TimerAccumulate(HSQMSESSION hSession, uint dwId);
Example #14
0
 public static extern bool TimerRecord(HSQMSESSION hSession, uint dwId);
Example #15
0
 public static extern bool TimerStart(HSQMSESSION hSession, uint dwId);
Example #16
0
 public static extern bool AddToAverage(HSQMSESSION hSession, uint dwId, uint dwVal);
Example #17
0
 public static extern bool AddToStream(HSQMSESSION hSession, uint dwId, int nArgs, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9);
Example #18
0
 public static extern System.Runtime.InteropServices.ComTypes.FILETIME GetSessionStartTime(HSQMSESSION hSession);
Example #19
0
 public static extern bool AddToStreamString(HSQMSESSION hSession, uint dwId, uint cTuple, string pwszVal);
Example #20
0
 public static extern bool StartSession(HSQMSESSION hSession);
Example #21
0
 public static extern bool GetFlags(HSQMSESSION hSession, out uint pdwFlags);
Example #22
0
 public static extern bool EndSession(HSQMSESSION hSession, string pwszPattern, uint dwMaxFilesToQueue, uint dwFlags);
Example #23
0
 public static extern bool SetEnabled(HSQMSESSION hSession, [MarshalAs(UnmanagedType.Bool)] bool fEnabled);
Example #24
0
 public static extern bool SqmFlushSession(HSQMSESSION hSession, string pwszFileName);
Example #25
0
 public static extern bool SetBits(HSQMSESSION hSession, uint dwId, uint dwOrBits);
Example #26
0
 public static extern bool SetAppVersion(HSQMSESSION hSession, uint dwVersionHigh, uint dwVersionLow);