BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
ristonecrackerlib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"
#include <dos/dos.h>
#include <proto/dos.h>
#include "optidec.h"

Data Structures

struct  s404hdr

Macros

#define __NOLIBBASE__
#define DOS_BASE_NAME   dos
#define S404   0x53343034UL
#define HDR(p)
#define FIBSIZE   264 /* AllocMem'd for Examine: a little more than the FIB */

Functions

void _stclength (void)
void _stcstart (void)
void _stcsafelen (void)
void _stcload (void)
void ristonecrackerlib_codeinit (void)
void ristonecrackerlib_codefinit (void)
void optidec (void)
static int stcdecrunch (UBYTE *a)
static void codeinit_c (void)
 init (codeinit): opens dos.library, any version (finit closes it).
static void codefinit_c (void)
 finit: closes dos.library if init opened it.
static ULONG stclength_c (const UBYTE *a)
 STCLength(address): the unpacked size of an S404 file in memory.
static ULONG stcstart_c (const UBYTE *a)
 STCStart(address): where the data of an S404 file unpacked in place begin (address + security offset).
static ULONG stcsafelen_c (const UBYTE *a)
 STCSafeLen(address): the buffer size an S404 file needs to be unpacked in place (unpacked length + security offset).
static ULONG stcload_c (CONST_STRPTR name, UBYTE *ad)
 STCLoad filename$,address: reads an S404 file to address (its whole length) and unpacks it in place.

Variables

static struct Library * dosbase
static const char dosname [] = "dos.library"

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ DOS_BASE_NAME

#define DOS_BASE_NAME   dos

◆ FIBSIZE

#define FIBSIZE   264 /* AllocMem'd for Examine: a little more than the FIB */

◆ HDR

#define HDR ( p)
Value:
((const struct s404hdr *)(p))
Definition ristonecrackerlib.c:117

◆ S404

#define S404   0x53343034UL

Function Documentation

◆ _stclength()

void _stclength ( void )

◆ _stcload()

void _stcload ( void )

◆ _stcsafelen()

void _stcsafelen ( void )

◆ _stcstart()

void _stcstart ( void )

◆ codefinit_c()

void codefinit_c ( void )
static

finit: closes dos.library if init opened it.

Fixed (#834): the original's finit is 0, dos.library was never closed.

◆ codeinit_c()

void codeinit_c ( void )
static

init (codeinit): opens dos.library, any version (finit closes it).

◆ optidec()

void optidec ( void )

◆ ristonecrackerlib_codefinit()

void ristonecrackerlib_codefinit ( void )

◆ ristonecrackerlib_codeinit()

void ristonecrackerlib_codeinit ( void )

◆ stcdecrunch()

int stcdecrunch ( UBYTE * a)
static

◆ stclength_c()

ULONG stclength_c ( const UBYTE * a)
static

STCLength(address): the unpacked size of an S404 file in memory.

Parameters
ad0: the file
Returns
d0: the unpacked length, 0 if a is no S404 file

◆ stcload_c()

ULONG stcload_c ( CONST_STRPTR name,
UBYTE * ad )
static

STCLoad filename$,address: reads an S404 file to address (its whole length) and unpacks it in place.

The file is opened by its name while the lock is held, and the lock is unlocked after that (fixed #1147: the original opened it with OpenFromLock, a dos V36 function, and crashed on Kickstart 1.x; it also unlocked the lock OpenFromLock had taken over again after Close, fixed #835). Unpacked only if Examine succeeded, Read read the whole file and it is an S404 file whose packed data and trailer lie within it (fixed #836: the original checked none of it). The whole file is read whatever the buffer's size (the command has no size argument). Corrupt data give 0 and are not written below the buffer (fixed #833).

Parameters
named0: filename$
add1: the buffer (STCSafeLen bytes, at least the file's size)
Returns
d0: the start of the unpacked data (address + offset), 0 if the file cannot be locked, examined, opened or read whole, there is no memory for the FileInfoBlock, or it is no S404 file whose packed data and trailer it holds, or its data are corrupt

◆ stcsafelen_c()

ULONG stcsafelen_c ( const UBYTE * a)
static

STCSafeLen(address): the buffer size an S404 file needs to be unpacked in place (unpacked length + security offset).

The header check is only in the binary (not in the source).

Parameters
ad0: the file
Returns
d0: the size, 0 if a is no S404 file

◆ stcstart_c()

ULONG stcstart_c ( const UBYTE * a)
static

STCStart(address): where the data of an S404 file unpacked in place begin (address + security offset).

The header check is only in the binary (not in the source).

Parameters
ad0: the file
Returns
d0: address + offset, 0 if a is no S404 file

Variable Documentation

◆ dosbase

struct Library* dosbase
static

◆ dosname

const char dosname[] = "dos.library"
static