/*
 * PLTV.CPP --  To be included in any 286|DOS-Extender TV2 app.
 * 		TV2 decides if it is in protected mode by
 *		looking for the Borland DPMI16 services.  Here,
 *		we lie and say we are Borland.
 */
#include <phapi.h>
#include <dos.h>	// for chain_intr

class __Hook2F
{
public:
	__Hook2F();
	~__Hook2F();
private:
	static void _interrupt new2f(REGS_BINT r);
	static PIHANDLER old2f;
};

static __Hook2F x;
PIHANDLER __Hook2F::old2f;

void _interrupt __Hook2F::new2f(REGS_BINT r)
{
	if(r.ax == 0xFB42 && r.bx == 1)
	{
		r.ax = 1;
		return;
	}
	_chain_intr((void _interrupt (*)(...))old2f);
}

__Hook2F::__Hook2F()
{
	DosSetProtVec(0x2f, (PIHANDLER)new2f, &old2f);

}

__Hook2F::~__Hook2F()
{
	if(old2f)
		DosSetProtVec(0x2f, old2f, 0);
}
