CreateActContext() static private method

static private CreateActContext ( IDefinitionAppId AppId ) : IActContext
AppId IDefinitionAppId
return IActContext
Example #1
0
 public ApplicationContext(ReferenceAppId appid)
 {
     if (appid == null)
     {
         throw new ArgumentNullException();
     }
     this._appcontext = IsolationInterop.CreateActContext(appid._id);
 }
Example #2
0
        internal static IActContext CreateActContext(IDefinitionAppId AppId)
        {
            IsolationInterop.CreateActContextParameters createActContextParameters;
            createActContextParameters.Size                      = (uint)Marshal.SizeOf(typeof(IsolationInterop.CreateActContextParameters));
            createActContextParameters.Flags                     = 16U;
            createActContextParameters.CustomStoreList           = IntPtr.Zero;
            createActContextParameters.CultureFallbackList       = IntPtr.Zero;
            createActContextParameters.ProcessorArchitectureList = IntPtr.Zero;
            createActContextParameters.Source                    = IntPtr.Zero;
            createActContextParameters.ProcArch                  = 0;
            IsolationInterop.CreateActContextParametersSource createActContextParametersSource;
            createActContextParametersSource.Size       = (uint)Marshal.SizeOf(typeof(IsolationInterop.CreateActContextParametersSource));
            createActContextParametersSource.Flags      = 0U;
            createActContextParametersSource.SourceType = 1U;
            createActContextParametersSource.Data       = IntPtr.Zero;
            IsolationInterop.CreateActContextParametersSourceDefinitionAppid createActContextParametersSourceDefinitionAppid;
            createActContextParametersSourceDefinitionAppid.Size  = (uint)Marshal.SizeOf(typeof(IsolationInterop.CreateActContextParametersSourceDefinitionAppid));
            createActContextParametersSourceDefinitionAppid.Flags = 0U;
            createActContextParametersSourceDefinitionAppid.AppId = AppId;
            IActContext result;

            try
            {
                createActContextParametersSource.Data = createActContextParametersSourceDefinitionAppid.ToIntPtr();
                createActContextParameters.Source     = createActContextParametersSource.ToIntPtr();
                result = (IsolationInterop.CreateActContext(ref createActContextParameters) as IActContext);
            }
            finally
            {
                if (createActContextParametersSource.Data != IntPtr.Zero)
                {
                    IsolationInterop.CreateActContextParametersSourceDefinitionAppid.Destroy(createActContextParametersSource.Data);
                    createActContextParametersSource.Data = IntPtr.Zero;
                }
                if (createActContextParameters.Source != IntPtr.Zero)
                {
                    IsolationInterop.CreateActContextParametersSource.Destroy(createActContextParameters.Source);
                    createActContextParameters.Source = IntPtr.Zero;
                }
            }
            return(result);
        }
Example #3
0
 internal static IActContext CreateActContext(IReferenceAppId AppId)
 {
     IsolationInterop.CreateActContextParameters Params;
     Params.Size                      = (uint)Marshal.SizeOf(typeof(IsolationInterop.CreateActContextParameters));
     Params.Flags                     = 16U;
     Params.CustomStoreList           = IntPtr.Zero;
     Params.CultureFallbackList       = IntPtr.Zero;
     Params.ProcessorArchitectureList = IntPtr.Zero;
     Params.Source                    = IntPtr.Zero;
     Params.ProcArch                  = (ushort)0;
     IsolationInterop.CreateActContextParametersSource parametersSource;
     parametersSource.Size       = (uint)Marshal.SizeOf(typeof(IsolationInterop.CreateActContextParametersSource));
     parametersSource.Flags      = 0U;
     parametersSource.SourceType = 2U;
     parametersSource.Data       = IntPtr.Zero;
     IsolationInterop.CreateActContextParametersSourceReferenceAppid sourceReferenceAppid;
     sourceReferenceAppid.Size  = (uint)Marshal.SizeOf(typeof(IsolationInterop.CreateActContextParametersSourceReferenceAppid));
     sourceReferenceAppid.Flags = 0U;
     sourceReferenceAppid.AppId = AppId;
     try
     {
         parametersSource.Data = sourceReferenceAppid.ToIntPtr();
         Params.Source         = parametersSource.ToIntPtr();
         return(IsolationInterop.CreateActContext(ref Params) as IActContext);
     }
     finally
     {
         if (parametersSource.Data != IntPtr.Zero)
         {
             IsolationInterop.CreateActContextParametersSourceDefinitionAppid.Destroy(parametersSource.Data);
             parametersSource.Data = IntPtr.Zero;
         }
         if (Params.Source != IntPtr.Zero)
         {
             IsolationInterop.CreateActContextParametersSource.Destroy(Params.Source);
             Params.Source = IntPtr.Zero;
         }
     }
 }