public static void Initialize(XenGuestAgentLib.XenGuestServices service) { Program.AssertOffEventThread(); Thread thread; string evname; EventWaitHandleSecurity evsec; EventWaitHandleAccessRule evrule; string user; xgsc = service; alertList = Program.GetAlertList(); evname = xgsc.RegisterAlertsEvent(); user = Environment.UserDomainName + "\\" + Environment.UserName; evalerts = EventWaitHandle.OpenExisting(evname, EventWaitHandleRights.ReadPermissions | EventWaitHandleRights.ChangePermissions); evsec = evalerts.GetAccessControl(); evrule = new EventWaitHandleAccessRule(user, EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, AccessControlType.Deny); evsec.RemoveAccessRule(evrule); evrule = new EventWaitHandleAccessRule(user, EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, AccessControlType.Allow); evsec.AddAccessRule(evrule); evalerts.SetAccessControl(evsec); evalerts = EventWaitHandle.OpenExisting(evname); thread = new Thread(alertUpdater); thread.Name = "XenClient Alert Thread"; thread.IsBackground = true; thread.Start(); }
public static void Initialize(XenGuestAgentLib.XenGuestServices service) { Program.AssertOffEventThread(); Thread thread; string evname; EventWaitHandleSecurity evsec; EventWaitHandleAccessRule evrule; string user; xgsc = service; alertList = Program.GetAlertList(); evname = xgsc.RegisterAlertsEvent(); user = Environment.UserDomainName + "\\" + Environment.UserName; evalerts = EventWaitHandle.OpenExisting(evname, EventWaitHandleRights.ReadPermissions | EventWaitHandleRights.ChangePermissions); evsec = evalerts.GetAccessControl(); evrule = new EventWaitHandleAccessRule(user, EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, AccessControlType.Deny); evsec.RemoveAccessRule(evrule); evrule = new EventWaitHandleAccessRule(user, EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, AccessControlType.Allow); evsec.AddAccessRule(evrule); evalerts.SetAccessControl(evsec); evalerts = EventWaitHandle.OpenExisting(evname); thread = new Thread(alertUpdater); thread.Name = "XenClient Alert Thread"; thread.IsBackground = true; thread.Start(); }
public string RegisterAlertsEvent() { return(xgsc.RegisterAlertsEvent()); }