/// <summary>
        /// Gets the thread's context.
        /// </summary>
        /// <param name="context">A Context structure. The ContextFlags must be set appropriately.</param>
        public void GetContext(ref ContextAmd64 context)
        {
            // HACK: To avoid a datatype misalignment error, allocate some
            // aligned memory.
            using (AlignedMemoryAlloc data = new AlignedMemoryAlloc(Utils.SizeOf(16, ContextAmd64.SizeOf), 16))
            {
                data.WriteStruct(context);

                Win32.NtGetContextThread(this, data).ThrowIf();

                context = data.ReadStruct <ContextAmd64>();
            }
        }
        /// <summary>
        /// Gets the thread's context.
        /// </summary>
        /// <param name="context">A Context structure. The ContextFlags must be set appropriately.</param>
        public void GetContext(ref ContextAmd64 context)
        {
            NtStatus status;

            // HACK: To avoid a datatype misalignment error, allocate some
            // aligned memory.
            using (var data = new AlignedMemoryAlloc(Utils.SizeOf <ContextAmd64>(16), 16))
            {
                data.WriteStruct <ContextAmd64>(context);

                if ((status = Win32.NtGetContextThread(this, data)) >= NtStatus.Error)
                {
                    Win32.Throw(status);
                }

                context = data.ReadStruct <ContextAmd64>();
            }
        }