You will not be able to post if you are still using Microsoft email addresses such as Hotmail etc
See here for more information viewtopic.php?f=20&t=7296
BOOKMARK THIS PAGE !
https://www.exxosforum.co.uk:8085/IP_CHECK/
You can unban yourself if needed. It also sends me reports to investigate the ban.
DO NOT USE MOBILE / CGNAT DEVICES WHERE THE IP CHANGES CONSTANTLY!
At this time, it is unfortunately not possible to whitelist users when your IP changes constantly.
You may inadvertently get banned because a previous attack may have used the IP you are now on.
So I suggest people only use fixed IP address devices until I can think of a solution for this problem!

Installing _FRB cookie ?

News,announcements,programming,fixes,game patches & discussions.
User avatar
exxos
Site Admin
Site Admin
Posts: 28211
Joined: 16 Aug 2017 23:19
Location: UK

Installing _FRB cookie ?

Post by exxos »

Does anyone know how to do this ? I can only find this page http://toshyp.atari.org/en/004013.html#CJar While I can access XBIOS from HISOFT BASIC, I am not sure if that function is supported, but could be I just don't know how to use it in the first place.

Even ASM code with explanation would help.. anyone ?
User avatar
thorsten.otto
Posts: 148
Joined: 04 Nov 2019 02:20

Re: Installing _FRB cookie ?

Post by thorsten.otto »

Code: Select all

The function is available when the cookie 'CJar' ($434A6172) is present. This is created by JARxxx (Cookie Jar Manager) or by Liberty.
So that function is not a standard XBIOS function, but only available if you ran that cookie jar manager. And you can detect its presence only by looking at the cookiejar... some kind of chicken/egg problem.
And although that might installing the cookie easier, it does not help you in making the buffer that the cookie points to resident.

Basically, the procedure you need (in some pseudo/C-like code)

Code: Select all

int install_frb(void)
{
	long *cookiejar;
	long size;
	void *buffer;
	
	cookiejar = (long *)Setexc(0x5a0 / 4, (void *)-1); /* get cookiejar */
	if (cookiejar == 0)
	{
		bailout(); /* no cookiejar; installing a new one not yet supported */
		return FALSE;
	}
	size = 0;
	while  (*cookiejar != 0 && *cookiejar != 0x5f465242L) /*  '_FRB' */
	{
		size++; /* count number of existing entries */
		cookiejar += 2; /* get to next entry */
	}
	if (*cookiejar != 0)
	{
		/* _FRB already present; nothing to do */
		return TRUE;
	}
	if (size + 2 > cookiejar[1]) /* check against cookie jar size */
	{
		/* no room in cookie jar */
		bailout();
		return FALSE;
	}
	buffer = Mxalloc(0, 0x10000L); /* allocate in ST-RAM only */
	if (buffer == 0)
	{
		/* not enough memory */
		return FALSE;
	}
	if (buffer == (void *)-32)
	{
		/* Mxalloc not supported */
		return FALSE;
	}
	/* copy the old end cookie */
	cookiejar[3] = cookiejar[1];
	cookiejar[2] = cookiejar[0];
	/* install our _FRB cookie */
	cookiejar[0] = 0x5f465242L;
	cookiejar[1] = (long)buffer;
	/* terminate and stay resident */
	Ptermres(256L, 0); /* we only need to keep the basepage */
}
Just written from memory, no guarantee that this actually works ;)

Adding some error messages might also be a good idea.

I'm not entirely sure about memory protection, normally that buffer should only be accessed by the harddisk driver from supervisor mode, if in doubt you may have to add the appropiate flags to make it globally readable/writable. But that only matters for MiNT.

Return to “SOFTWARE PROGRAMMING & DISCUSSION”

Who is online

Users browsing this forum: CCBot and 3 guests