Example #1
0
        /// <summary>
        /// Initializes the activation context.
        /// </summary>
        public void Initialize()
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.ToString());
            }
            if (!Initialized)
            {
                activationContext          = new W32API.ACTCTX();
                activationContext.cbSize   = Marshal.SizeOf(typeof(W32API.ACTCTX));
                activationContext.lpSource = this.ManifestFileName;

                contextHandle = W32API.CreateActCtx(ref activationContext);

                Initialized = (contextHandle != (IntPtr)W32API.INVALID_HANDLE_VALUE);

                if (!Initialized)
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to initialize activation context");
                }
            }
        }
        /// <summary>
        /// Initializes the activation context.
        /// </summary>
        public void Initialize()
        {
            if (disposed)
                throw new ObjectDisposedException(this.ToString());
            if (!Initialized)
            {
                activationContext = new W32API.ACTCTX();
                activationContext.cbSize = Marshal.SizeOf(typeof(W32API.ACTCTX));
                activationContext.lpSource = this.ManifestFileName;

                contextHandle = W32API.CreateActCtx(ref activationContext);

                Initialized = (contextHandle != (IntPtr) W32API.INVALID_HANDLE_VALUE);

                if (!Initialized)
                    throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to initialize activation context");
            }
        }