示例#1
0
		/// <summary>
		/// Gets the context of a given thread.
		/// </summary>
		/// <param name="hThread">Handle to the thread for which the context will be returned.</param>
		/// <param name="ContextFlags">Determines which set(s) of registers will be returned.</param>
		/// <returns>Returns the context of the thread.  If failure, sets CONTEXT.ContextFlags to zero.</returns>
		public static CONTEXT GetThreadContext( IntPtr hThread, uint ContextFlags ) {
			CONTEXT ctx = new CONTEXT();
			ctx.ContextFlags = ContextFlags;

			if( !Imports.GetThreadContext( hThread, ref ctx ) )
				ctx.ContextFlags = 0;

			return ctx;
		}
示例#2
0
		public static extern bool SetThreadContext(IntPtr hThread, ref CONTEXT lpContext);
示例#3
0
		/// <summary>
		/// Sets the context of a given thread.
		/// </summary>
		/// <param name="hThread">Handle to the thread for which the context will be set.</param>
		/// <param name="ctx">CONTEXT structure to which the thread's context will be set.</param>
		/// <returns>Returns true on success, false on failure.</returns>
		public static bool SetThreadContext( IntPtr hThread, CONTEXT ctx ) {
			return Imports.SetThreadContext( hThread, ref ctx );
		}