private void HandleAllowDupHandlePermission(int myPid)
 {
     if (OSEnvironmentHelper.IsVistaOrGreater || !this.listenerUserSid.Equals(new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null)))
     {
         SecurityIdentifier userSidForPid;
         try
         {
             userSidForPid = System.ServiceModel.Activation.Utility.GetUserSidForPid(myPid);
         }
         catch (Win32Exception exception)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString("SharedManagerBase", new object[] { this.serviceName, System.ServiceModel.SR.GetString("SharedManagerCurrentUserSidLookupFailure", new object[] { exception.NativeErrorCode }) }), exception));
         }
         if (OSEnvironmentHelper.IsVistaOrGreater || !userSidForPid.Equals(this.listenerUserSid))
         {
             try
             {
                 this.allowContext = AllowHelper.TryAllow(this.listenerUniqueSid.Value);
             }
             catch (Win32Exception exception2)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString("SharedManagerBase", new object[] { this.serviceName, System.ServiceModel.SR.GetString("SharedManagerAllowDupHandleFailed", new object[] { this.listenerUniqueSid.Value }) }), exception2));
             }
             if (DiagnosticUtility.ShouldTraceInformation)
             {
                 TraceUtility.TraceEvent(TraceEventType.Information, 0xa0003, System.ServiceModel.SR.GetString("TraceCodePortSharingDupHandleGranted", new object[] { this.serviceName, this.listenerUniqueSid.Value }));
             }
         }
     }
 }
Пример #2
0
 private static void EnsureInitialized()
 {
     if (singleton == null)
     {
         lock (ThisLock)
         {
             if (singleton == null)
             {
                 if (AppDomain.CurrentDomain.IsDefaultAppDomain())
                 {
                     processWideRefCount = new Dictionary <string, RegistrationRefCount>();
                     singleton           = new AllowHelper();
                 }
                 else
                 {
                     object obj2;
                     Guid   clsid = new Guid("CB2F6723-AB3A-11D2-9C40-00C04FA30A3E");
                     Guid   riid  = new Guid("CB2F6722-AB3A-11D2-9C40-00C04FA30A3E");
                     ((ListenerUnsafeNativeMethods.ICorRuntimeHost)RuntimeEnvironment.GetRuntimeInterfaceAsObject(clsid, riid)).GetDefaultDomain(out obj2);
                     AppDomain domain = (AppDomain)obj2;
                     if (!domain.IsDefaultAppDomain())
                     {
                         throw Fx.AssertAndThrowFatal("AllowHelper..ctor() GetDefaultDomain did not return the default domain!");
                     }
                     singleton = domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(AllowHelper).FullName) as AllowHelper;
                 }
             }
         }
     }
 }
 private static void EnsureInitialized()
 {
     if (singleton == null)
     {
         lock (ThisLock)
         {
             if (singleton == null)
             {
                 if (AppDomain.CurrentDomain.IsDefaultAppDomain())
                 {
                     processWideRefCount = new Dictionary<string, RegistrationRefCount>();
                     singleton = new AllowHelper();
                 }
                 else
                 {
                     object obj2;
                     Guid clsid = new Guid("CB2F6723-AB3A-11D2-9C40-00C04FA30A3E");
                     Guid riid = new Guid("CB2F6722-AB3A-11D2-9C40-00C04FA30A3E");
                     ((ListenerUnsafeNativeMethods.ICorRuntimeHost) RuntimeEnvironment.GetRuntimeInterfaceAsObject(clsid, riid)).GetDefaultDomain(out obj2);
                     AppDomain domain = (AppDomain) obj2;
                     if (!domain.IsDefaultAppDomain())
                     {
                         throw Fx.AssertAndThrowFatal("AllowHelper..ctor() GetDefaultDomain did not return the default domain!");
                     }
                     singleton = domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(AllowHelper).FullName) as AllowHelper;
                 }
             }
         }
     }
 }
Пример #4
0
 public RegistrationForAllow(AllowHelper singleton, string grantedSid)
 {
     this.singleton  = singleton;
     this.grantedSid = grantedSid;
 }
 public RegistrationForAllow(AllowHelper singleton, string grantedSid)
 {
     this.singleton = singleton;
     this.grantedSid = grantedSid;
 }