Esempio n. 1
0
        public static void Initialize(XenGuestAgentLib.XenGuestServices service)
        {
            Program.AssertOffEventThread();
            Thread thread;
            string evname;
            EventWaitHandleSecurity   evsec;
            EventWaitHandleAccessRule evrule;
            string user;

            xgsc = service;

            evname = xgsc.RegisterVmsEvent();
            user   = Environment.UserDomainName + "\\" + Environment.UserName;
            evvms  = EventWaitHandle.OpenExisting(evname,
                                                  EventWaitHandleRights.ReadPermissions | EventWaitHandleRights.ChangePermissions);
            evsec  = evvms.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);
            evvms.SetAccessControl(evsec);

            evvms = EventWaitHandle.OpenExisting(evname);

            // Start the monitor thread
            thread              = new Thread(CacheXgsMonitor);
            thread.Name         = "XenClient Cache Thread";
            thread.IsBackground = true;

            thread.Start();
        }
Esempio n. 2
0
        public static void Initialize(XenGuestAgentLib.XenGuestServices service)
        {
            Program.AssertOffEventThread();
            Thread thread;
            string evname;
            EventWaitHandleSecurity evsec;
            EventWaitHandleAccessRule evrule;
            string user;
            xgsc = service;

            evname = xgsc.RegisterVmsEvent();
            user = Environment.UserDomainName + "\\" + Environment.UserName;
            evvms = EventWaitHandle.OpenExisting(evname,
                EventWaitHandleRights.ReadPermissions | EventWaitHandleRights.ChangePermissions);
            evsec = evvms.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);
            evvms.SetAccessControl(evsec);

            evvms = EventWaitHandle.OpenExisting(evname);

            // Start the monitor thread
            thread = new Thread(CacheXgsMonitor);
            thread.Name = "XenClient Cache Thread";
            thread.IsBackground = true;

            thread.Start();
        }
Esempio n. 3
0
 public string RegisterVmsEvent()
 {
     return(xgsc.RegisterVmsEvent());
 }