struct context
{
	LONG		regs[15];		/* Registers d0-d7, a0-a6		*/
	LONG		usp; 			/* User stack pointer		*/
	WORD		sr;  			/* Status register			*/
	LONG		pc;  			/* Program counter			*/
	LONG		ssp; 			/* Supervisor stack pointer		*/
	LONG 		tvec;			/* GEMDOS terminate vector		*/
	char		fstate[216];		/* Internal FPU state		*/
	LONG		fregs[3*8];		/* Registers FP0-FP7			*/
	LONG		fctrl[3];		/* Registers FPCR/FPSR/FPIAR	*/

	/* More undocumented fields exist here */
} c;

void
ModifyContext( LONG handle )
{
	LONG curprocaddr, ctxtsize;

	Fcntl( handle, &curprocaddr, PPROCADDR );
	Fcntl( handle, &ctxtsize, PCTXTSIZE );

	curprocaddr -= 2 * ctxtsize;

	Fseek( curprocaddr, handle, SEEK_SET );
	Fread( handle, (LONG)sizeof(struct context), &c );

	/* Modify context c here */

	Fseek( curprocaddr, handle, SEEK_SET );
	Fwrite( handle, (LONG)sizeof(struct context), &c );
}
