internal static extern int PublishFailureItem([In] ref ExDbFailureItemApi.HaDbFailureItem failureItem);
 internal static extern int PublishFailureItemEx([In] bool isDebug, [In] ref ExDbFailureItemApi.HaDbFailureItem failureItem);
Esempio n. 3
0
        // Token: 0x06000149 RID: 329 RVA: 0x00007274 File Offset: 0x00005474
        internal void Publish(bool isValidate, bool isDebugChannel)
        {
            if (DatabaseFailureItem.publishDatabaseFailureItemTestHook.Value != null)
            {
                DatabaseFailureItem.publishDatabaseFailureItemTestHook.Value();
            }
            if (isValidate)
            {
                this.Validate();
            }
            IntPtr intPtr  = IntPtr.Zero;
            IntPtr intPtr2 = IntPtr.Zero;
            IntPtr intPtr3 = IntPtr.Zero;

            ExDbFailureItemApi.HaDbFailureItem haDbFailureItem = default(ExDbFailureItemApi.HaDbFailureItem);
            try
            {
                haDbFailureItem.CbSize    = Marshal.SizeOf(typeof(ExDbFailureItemApi.HaDbFailureItem));
                haDbFailureItem.NameSpace = this.NameSpace;
                haDbFailureItem.Tag       = this.Tag;
                haDbFailureItem.Guid      = this.Guid;
                if (this.InstanceName != null)
                {
                    haDbFailureItem.InstanceName = this.InstanceName;
                }
                if (this.ComponentName != null)
                {
                    haDbFailureItem.ComponentName = this.ComponentName;
                }
                if (this.IoError != null)
                {
                    ExDbFailureItemApi.HaDbIoErrorInfo haDbIoErrorInfo = default(ExDbFailureItemApi.HaDbIoErrorInfo);
                    haDbIoErrorInfo.CbSize   = Marshal.SizeOf(typeof(ExDbFailureItemApi.HaDbIoErrorInfo));
                    haDbIoErrorInfo.Category = this.IoError.Category;
                    if (this.IoError.FileName != null)
                    {
                        haDbIoErrorInfo.FileName = this.IoError.FileName;
                    }
                    haDbIoErrorInfo.Offset = this.IoError.Offset;
                    haDbIoErrorInfo.Size   = this.IoError.Size;
                    intPtr = Marshal.AllocHGlobal(haDbIoErrorInfo.CbSize);
                    Marshal.StructureToPtr(haDbIoErrorInfo, intPtr, false);
                }
                haDbFailureItem.IoError = intPtr;
                if (this.NotifyEvent != null)
                {
                    ExDbFailureItemApi.HaDbNotificationEventInfo haDbNotificationEventInfo = default(ExDbFailureItemApi.HaDbNotificationEventInfo);
                    haDbNotificationEventInfo.CbSize  = Marshal.SizeOf(typeof(ExDbFailureItemApi.HaDbNotificationEventInfo));
                    haDbNotificationEventInfo.EventId = this.NotifyEvent.EventId;
                    if (this.NotifyEvent.Parameters != null)
                    {
                        haDbNotificationEventInfo.NumParameters = this.NotifyEvent.Parameters.Length;
                        intPtr2 = MarshalHelper.StringArrayToIntPtr(this.NotifyEvent.Parameters);
                        haDbNotificationEventInfo.Parameters = intPtr2;
                    }
                    intPtr3 = Marshal.AllocHGlobal(haDbNotificationEventInfo.CbSize);
                    Marshal.StructureToPtr(haDbNotificationEventInfo, intPtr3, false);
                }
                haDbFailureItem.NotificationEventInfo = intPtr3;
                if (this.Message != null)
                {
                    haDbFailureItem.Message = this.Message;
                }
                ExTraceGlobals.FaultInjectionTracer.TraceTest(2837851453U);
                int num = ExDbFailureItemApi.PublishFailureItemEx(isDebugChannel, ref haDbFailureItem);
                if (num != 0)
                {
                    throw new ExDbApiException(new Win32Exception(num));
                }
            }
            finally
            {
                Marshal.FreeHGlobal(intPtr);
                intPtr = IntPtr.Zero;
                if (intPtr2 != IntPtr.Zero)
                {
                    MarshalHelper.FreeIntPtrOfMarshalledObjectsArray(intPtr2, this.NotifyEvent.Parameters.Length);
                    intPtr2 = IntPtr.Zero;
                }
                Marshal.FreeHGlobal(intPtr3);
                intPtr3 = IntPtr.Zero;
            }
        }