// Token: 0x060000DD RID: 221 RVA: 0x000064E0 File Offset: 0x000046E0
        private bool InitializeClusterNotify()
        {
            ClusterNotifyFlags eventMask = ~(ClusterNotifyFlags.CLUSTER_CHANGE_NODE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_NAME | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_ATTRIBUTES | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_SUBTREE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_RECONNECT | ClusterNotifyFlags.CLUSTER_CHANGE_QUORUM_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_PROPERTY);

            this.m_cen = new AmClusterNotify(this.Cluster.Handle);
            this.m_cen.Initialize(eventMask, (IntPtr)1L);
            return(true);
        }
        internal void RegisterObject(SafeHandle clusObject, ClusterNotifyFlags eventMask, IntPtr context)
        {
            AmTrace.Debug("Registering additional cluster objects for notification", new object[0]);
            int num = ClusapiMethods.RegisterClusterNotify(this.m_hChange, eventMask, clusObject, context);

            if (num != 0)
            {
                AmTrace.Error("RegisterClusterNotify for group state returned error 0x{0:X8}", new object[]
                {
                    num
                });
                throw AmExceptionHelper.ConstructClusterApiException(num, "RegisterClusterNotify(CLUSTER_CHANGE_GROUP_STATE)", new object[0]);
            }
        }
 internal void Initialize(ClusterNotifyFlags eventMask, IntPtr context)
 {
     if (this.m_hChange == null || this.m_hChange.IsInvalid)
     {
         AmTrace.Debug("Creating cluster notification port", new object[0]);
         this.m_hChange = ClusapiMethods.CreateClusterNotifyPort(AmClusterNotifyHandle.InvalidHandle, this.m_hCluster, eventMask, context);
         if (this.m_hChange == null || this.m_hChange.IsInvalid)
         {
             int lastWin32Error = Marshal.GetLastWin32Error();
             AmTrace.Error("CreateClusterNotifyPort failed. Error code 0x{0:X8}", new object[]
             {
                 lastWin32Error
             });
             throw AmExceptionHelper.ConstructClusterApiException(lastWin32Error, "CreateClusterNotifyPort()", new object[0]);
         }
     }
 }
Example #4
0
		private void RegisterForChangeNotification(IDistributedStoreKey dsKey, AmClusterNotifyHandle hChange)
		{
			AmClusterRegkeyHandle clusdbKeyHandle = this.GetClusdbKeyHandle(dsKey);
			if (clusdbKeyHandle != null && !clusdbKeyHandle.IsInvalid)
			{
				ClusterNotifyFlags dwFilter = ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE;
				IntPtr dwNotifyKey = (IntPtr)1;
				int num = ClusapiMethods.RegisterClusterNotify(hChange, dwFilter, clusdbKeyHandle, dwNotifyKey);
				if (num != 0)
				{
					NetworkManager.TraceError("RegisterClusterNotify for reg notification 0x{0:X8}", new object[]
					{
						num
					});
					throw AmExceptionHelper.ConstructClusterApiException(num, "RegisterClusterNotify(Network Registry)", new object[0]);
				}
			}
		}
        internal bool WaitForEvent(out AmClusterEventInfo eventInfo, TimeSpan timeout)
        {
            ClusterNotifyFlags eventCode     = ~(ClusterNotifyFlags.CLUSTER_CHANGE_NODE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_NODE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_NODE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_NODE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_NAME | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_ATTRIBUTES | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_SUBTREE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_RECONNECT | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_QUORUM_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_HANDLE_CLOSE);
            StringBuilder      stringBuilder = new StringBuilder(1024);
            uint   num  = Convert.ToUInt32(stringBuilder.Capacity);
            IntPtr zero = IntPtr.Zero;
            int    num2 = 0;

            try
            {
                num2 = ClusapiMethods.GetClusterNotify(this.m_hChange, out zero, out eventCode, stringBuilder, ref num, Convert.ToUInt32(timeout.TotalMilliseconds));
            }
            catch (AccessViolationException innerException)
            {
                throw new ClusterApiException("GetClusterNotify", innerException);
            }
            if (num2 == 258)
            {
                eventInfo = null;
                return(false);
            }
            if (num2 == 0)
            {
                eventInfo = new AmClusterEventInfo(stringBuilder.ToString(), eventCode, zero);
                ExTraceGlobals.ClusterEventsTracer.TraceDebug <AmClusterEventInfo>((long)this.GetHashCode(), "WaitForEvent returns: {0}", eventInfo);
                return(true);
            }
            AmTrace.Error("GetClusterNotify returned error 0x{0:X8}", new object[]
            {
                num2
            });
            if (this.m_isClosed && num2 == 6)
            {
                AmTrace.Error("Cluster notification port handle is closed", new object[0]);
                eventInfo = null;
                return(false);
            }
            throw AmExceptionHelper.ConstructClusterApiException(num2, "GetClusterNotify()", new object[0]);
        }
Example #6
0
 internal static extern int RegisterClusterNotify([In] AmClusterNotifyHandle hChange, [In] ClusterNotifyFlags dwFilter, [In] SafeHandle hObject, [In] IntPtr dwNotifyKey);
Example #7
0
 internal static extern int GetClusterNotify([In] AmClusterNotifyHandle hChange, out IntPtr dwNotifyKey, out ClusterNotifyFlags dwFilter, [MarshalAs(UnmanagedType.LPWStr)][In][Out] StringBuilder lpszName, [In][Out] ref uint cbNameSize, [In] uint dwMillisecTimeout);
Example #8
0
 internal static extern AmClusterNotifyHandle CreateClusterNotifyPort([In] AmClusterNotifyHandle hChange, [In] AmClusterHandle hCluster, [In] ClusterNotifyFlags dwFilter, [In] IntPtr dwNotifyKey);
Example #9
0
		private void MonitorEvents()
		{
			AmClusterNotifyHandle amClusterNotifyHandle = null;
			IDistributedStoreKey distributedStoreKey = null;
			IDistributedStoreChangeNotify distributedStoreChangeNotify = null;
			try
			{
				ClusterNotifyFlags networkClusterNotificationMask = RegistryParameters.NetworkClusterNotificationMask;
				NetworkManager.TraceDebug("SettingClusterMask as 0x{0:x}", new object[]
				{
					networkClusterNotificationMask
				});
				amClusterNotifyHandle = ClusapiMethods.CreateClusterNotifyPort(AmClusterNotifyHandle.InvalidHandle, this.ClusterHandle, networkClusterNotificationMask, IntPtr.Zero);
				if (amClusterNotifyHandle == null || amClusterNotifyHandle.IsInvalid)
				{
					int lastWin32Error = Marshal.GetLastWin32Error();
					NetworkManager.TraceError("CreateClusterNotifyPort failed. Error code 0x{0:X8}", new object[]
					{
						lastWin32Error
					});
					throw new ClusCommonTransientException("CreateClusterNotifyPort", new Win32Exception(lastWin32Error));
				}
				using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(this.ClusterHandle, null, null, DxStoreKeyAccessMode.Write, false))
				{
					distributedStoreKey = clusterKey.OpenKey("Exchange\\DagNetwork", DxStoreKeyAccessMode.CreateIfNotExist, false, null);
				}
				this.RegisterForChangeNotification(distributedStoreKey, amClusterNotifyHandle);
				TimeSpan t = new TimeSpan(0, 0, RegistryParameters.NetworkStatusPollingPeriodInSecs);
				while (this.m_clusterHandlesAreValid && !this.m_shutdown)
				{
					StringBuilder stringBuilder = new StringBuilder(256);
					uint num = Convert.ToUInt32(stringBuilder.Capacity);
					IntPtr zero = IntPtr.Zero;
					ClusterNotifyFlags clusterNotifyFlags;
					int clusterNotify = ClusapiMethods.GetClusterNotify(amClusterNotifyHandle, out zero, out clusterNotifyFlags, stringBuilder, ref num, 3000U);
					if (this.m_shutdown)
					{
						break;
					}
					if (this.m_netMap == null)
					{
						if (!this.TryDriveMapRefresh())
						{
							break;
						}
					}
					else if (clusterNotify == 258)
					{
						if (t < ExDateTime.TimeDiff(ExDateTime.Now, this.m_mapLoadTime) && !this.TryDriveMapRefresh())
						{
							break;
						}
					}
					else if (clusterNotify != 0)
					{
						NetworkManager.TraceDebug("GetClusterNotify() returned unexpected status code 0x{0:X)", new object[]
						{
							clusterNotify
						});
					}
					else
					{
						string text = stringBuilder.ToString();
						NetworkManager.TraceDebug("GetClusterNotify() returned notifyKey={0}, filterType=0x{1:x}, resName={2}", new object[]
						{
							zero,
							clusterNotifyFlags,
							text
						});
						if ((clusterNotifyFlags & ~(ClusterNotifyFlags.CLUSTER_CHANGE_NODE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_NAME | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_ATTRIBUTES | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_SUBTREE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_RECONNECT | ClusterNotifyFlags.CLUSTER_CHANGE_QUORUM_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_PROPERTY)) != ~(ClusterNotifyFlags.CLUSTER_CHANGE_NODE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_NODE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_NODE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_NODE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_NAME | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_ATTRIBUTES | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE | ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_SUBTREE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_GROUP_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_RECONNECT | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_NETWORK_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_DELETED | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_ADDED | ClusterNotifyFlags.CLUSTER_CHANGE_NETINTERFACE_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_QUORUM_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_STATE | ClusterNotifyFlags.CLUSTER_CHANGE_CLUSTER_PROPERTY | ClusterNotifyFlags.CLUSTER_CHANGE_HANDLE_CLOSE) && !this.TryDriveMapRefresh())
						{
							break;
						}
					}
				}
			}
			finally
			{
				if (amClusterNotifyHandle != null)
				{
					amClusterNotifyHandle.Dispose();
					amClusterNotifyHandle = null;
				}
				if (distributedStoreChangeNotify != null)
				{
					distributedStoreChangeNotify.Dispose();
				}
				if (distributedStoreKey != null)
				{
					distributedStoreKey.Dispose();
				}
			}
		}
Example #10
0
 // Token: 0x060001E7 RID: 487 RVA: 0x00008DAA File Offset: 0x00006FAA
 internal AmClusterEventInfo(string changedObjectName, ClusterNotifyFlags eventCode, IntPtr context)
 {
     this.ObjectName = changedObjectName;
     this.EventCode  = eventCode;
     this.Context    = context;
 }
Example #11
0
 // Token: 0x060001F8 RID: 504 RVA: 0x00009081 File Offset: 0x00007281
 internal bool IsEventTriggered(ClusterNotifyFlags eventToCheck)
 {
     return((this.EventCode & eventToCheck) == eventToCheck);
 }