mirror of
https://github.com/ctm/executor.git
synced 2025-01-03 00:31:03 +00:00
Removed serial number and other commercial vestiges.
This commit is contained in:
parent
27727108b3
commit
15c6ab13ac
15
README
15
README
@ -10,8 +10,6 @@ just like emulation a lot, you probably don't want to spend any time
|
||||
with Executor.
|
||||
|
||||
Included are a bunch of auxiliarly files and miscellaneous front-ends.
|
||||
It's unlikely anything other than the Linux and win32 ports can be
|
||||
made to go.
|
||||
|
||||
The DOS port required various other libraries that we had permission
|
||||
to use, but that we did not necessarily have the permission to publish
|
||||
@ -25,7 +23,7 @@ install of syn68k):
|
||||
|
||||
mkdir -p build/debug-linux
|
||||
cd build/debug-linux
|
||||
../../util/configure.sh '--target=i486-linux' '--host=i486-linux' '--front-end=x' '--target-gcc=gcc' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -DNDEBUG -O0 -finline-functions -g -Wall -DRELEASE_INTERNAL -DERROR_SUPPORTED_MASK="(~0)"' '--root=../..' '--target-file-format=glibc' '--sound=linux' '--syn68k-target=i486-linux-glibc'
|
||||
../../util/configure.sh '--target=i486-linux' '--host=i486-linux' '--front-end=x' '--target-gcc=gcc' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -O0 -finline-functions -g -Wall' '--root=../..' '--target-file-format=glibc' '--sound=linux' '--syn68k-target=i486-linux-glibc'
|
||||
make
|
||||
|
||||
That should leave you with a binary called executor. Unfortunately, without
|
||||
@ -44,7 +42,7 @@ something like
|
||||
|
||||
mkdir -p build/debug-linux
|
||||
cd build/debug-linux
|
||||
../../util/configure.sh '--target=i486-linux' '--host=i486-linux' '--front-end=x' '--target-gcc=gcc -m32' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -DNDEBUG -O0 -finline-functions -g -Wall -DRELEASE_INTERNAL -DERROR_SUPPORTED_MASK="(~0)"' '--root=../..' '--target-file-format=glibc' '--sound=linux' '--syn68k-target=i486-linux-glibc'
|
||||
../../util/configure.sh '--target=i486-linux' '--host=i486-linux' '--front-end=x' '--target-gcc=gcc -m32' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -O0 -finline-functions -g -Wall' '--root=../..' '--target-file-format=glibc' '--sound=linux' '--syn68k-target=i486-linux-glibc'
|
||||
make
|
||||
|
||||
However, you may find that you need to hand-edit Makefile and change the line
|
||||
@ -61,7 +59,7 @@ the SDL-based version of Executor on Linux, you can try:
|
||||
|
||||
mkdir -p build/debug-linux-sdl
|
||||
cd build/debug-linux-sdl
|
||||
../../util/configure.sh '--target=i486-linux' '--host=i486-linux' '--front-end=sdl' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -DNDEBUG -O0 -finline-functions -g -Wall -DRELEASE_INTERNAL -DERROR_SUPPORTED_MASK="(~0)"' '--root=../..' '--target-file-format=glibc' '--sound=sdl' '--syn68k-target=i486-linux-glibc'
|
||||
../../util/configure.sh '--target=i486-linux' '--host=i486-linux' '--front-end=sdl' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -O0 -finline-functions -g -Wall' '--root=../..' '--target-file-format=glibc' '--sound=sdl' '--syn68k-target=i486-linux-glibc'
|
||||
make
|
||||
|
||||
If you have SDL <http://libsdl.org/> installed and would like to play with
|
||||
@ -69,10 +67,13 @@ the SDL-based version of Executor on Mac OS X Intel, you can try:
|
||||
|
||||
mkdir -p build/debug-macosx-sdl
|
||||
cd build/debug-macosx-sdl
|
||||
../../util/configure.sh '--target=i486-macosx' '--host=i486-macosx' '--front-end=sdl' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -DNDEBUG -O0 -finline-functions -g -Wall -DRELEASE_INTERNAL -DERROR_SUPPORTED_MASK="(~0)"' '--root=../..' '--target-file-format=glibc' '--sound=sdl' '--syn68k-target=i486-macosx-glibc'
|
||||
../../util/configure.sh '--target=i486-macosx' '--host=i486-macosx' '--front-end=sdl' '--cflags=-fno-strict-aliasing -I/usr/X11R6/include -O0 -finline-functions -g -Wall' '--root=../..' '--target-file-format=glibc' '--sound=sdl' '--syn68k-target=i486-macosx-glibc'
|
||||
make
|
||||
|
||||
The Mac OS X version has problems, especially with quitting.
|
||||
In the past it was possible to cross-compile a version of Executor for
|
||||
Windows using mingw32. So far that port hasn't been tried since
|
||||
putting the code on Github. It probably doesn't work, but probably
|
||||
could be made to work without much effort.
|
||||
|
||||
My email address is still <ctm@ardi.com>, although ARDI itself is
|
||||
defunct. I get a ridiculous amount of spam and will quite possibly
|
||||
|
11
TODO
11
TODO
@ -1,8 +1,15 @@
|
||||
Get rid of old copy-protection stuff
|
||||
|
||||
package up the System Folder and whatnot so that people w/o the
|
||||
old executor-aux can run Executor
|
||||
|
||||
do this before or after switching to GNU build system?
|
||||
|
||||
probably get rid of most of the customization stuff (don't yet
|
||||
wholesale kill it, since some might be useful as per-user,
|
||||
per-app or command line configuration)
|
||||
|
||||
splash screen stuff: does it even make sense anymore,
|
||||
since the app should come up quickly now
|
||||
|
||||
Try building the mingw32 version using the mingw32 toolchain
|
||||
for Fedora 11 (mingw32 has been done before)
|
||||
|
||||
|
@ -40,13 +40,13 @@ executor_SOURCE = \
|
||||
dump.c trapname.c float4.c float5.c float7.c floatnext.c font.c \
|
||||
gestalt.c globals.c \
|
||||
image.c image_inits.c iu.c launch.c main.c mman.c mmansubr.c \
|
||||
notify.c hle.c osevent.c osutil.c pack.c protector.c scrap.c script.c \
|
||||
notify.c hle.c osevent.c osutil.c pack.c scrap.c script.c \
|
||||
segment.c serial.c setuid.c slash.c \
|
||||
sounddriver.c sound.c soundIMVI.c soundfake.c \
|
||||
stdfile.c romlib_stubs.c \
|
||||
snth5.c syserr.c toolevent.c toolmath.c toolutil.c time.c vbl.c \
|
||||
syncint.c virtualint.c refresh.c autorefresh.c \
|
||||
license.c aboutbox.c licensetext.c dcmaketables.c \
|
||||
aboutbox.c licensetext.c dcmaketables.c \
|
||||
dcconvert.c rgbutil.c keycode.c option.c parseopt.c parsenum.c \
|
||||
desperate.c \
|
||||
version.c shutdown.c uniquefile.c sigio_multiplex.c \
|
||||
|
@ -504,9 +504,9 @@ static void dumpimage( unsigned char *p, int numrows, int numbytes,
|
||||
|
||||
toskip = rowbytes - numbytes;
|
||||
context = DPSGetCurrentContext();
|
||||
for (i = CRACKER_ZERO; i < numrows; ++i)
|
||||
for (i = 0; i < numrows; ++i)
|
||||
{
|
||||
for (j = CRACKER_ZERO; j < numbytes; ++j)
|
||||
for (j = 0; j < numbytes; ++j)
|
||||
DPSPrintf(context, "%02X", *p++);
|
||||
DPSPrintf(context, "\n");
|
||||
p += toskip;
|
||||
|
@ -221,16 +221,6 @@ const char ROMlib_page_end[] =
|
||||
#endif
|
||||
"%%%%EndDocument\n"
|
||||
|
||||
#if defined (PRINT_DEMO_WATERMARK)
|
||||
"gsave\n"
|
||||
"/Helvetica findfont2 250 scalefont setfont\n"
|
||||
"75 200 moveto\n"
|
||||
"1 -1 scale\n"
|
||||
"%d rotate\n"
|
||||
"(Demo) false charpath 1 setlinewidth stroke\n"
|
||||
"grestore\n"
|
||||
#endif
|
||||
|
||||
"/showpage systemdict begin { showpage } bind end def\n"
|
||||
#if !defined (NEXTSTEP)
|
||||
"showpage\n"
|
||||
|
412
src/aboutbox.c
412
src/aboutbox.c
@ -9,8 +9,6 @@ char ROMlib_rcsid_aboutbox[] =
|
||||
|
||||
#include "rsys/common.h"
|
||||
|
||||
#if defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
|
||||
#include "rsys/aboutbox.h"
|
||||
#include "rsys/mman.h"
|
||||
#include "rsys/vdriver.h"
|
||||
@ -36,374 +34,6 @@ char ROMlib_rcsid_aboutbox[] =
|
||||
#include "rsys/gestalt.h"
|
||||
#include "rsys/osevent.h"
|
||||
|
||||
#if !defined (TIME_OUT_DAYS)
|
||||
|
||||
#define days_left_func() (1)
|
||||
|
||||
#else
|
||||
|
||||
#include "rsys/cookie.h"
|
||||
|
||||
#if defined (LINUX)
|
||||
#define COOKIE_FILE "/etc/opt/executor/.xp"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (LINUX) || defined (MSDOS)
|
||||
|
||||
#if defined (MSDOS)
|
||||
|
||||
#define COOKIE_FILE "excook.xp"
|
||||
|
||||
PRIVATE char *
|
||||
viable_path (char vol, const char *path)
|
||||
{
|
||||
char *retval;
|
||||
int path_len, retval_size;
|
||||
|
||||
path_len = strlen (path);
|
||||
retval_size = sizeof vol + sizeof ':' + path_len + 1 + sizeof (COOKIE_FILE);
|
||||
retval = malloc (retval_size);
|
||||
if (retval)
|
||||
{
|
||||
struct stat sbuf;
|
||||
|
||||
sprintf (retval, "%c:%s", vol, path);
|
||||
if (stat (retval, &sbuf) != 0 || !S_ISDIR (sbuf.st_mode))
|
||||
{
|
||||
free (retval);
|
||||
retval = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (path[1] != 0) /* test for non-root directory */
|
||||
strcat (retval, "/");
|
||||
strcat (retval, COOKIE_FILE);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
PRIVATE char *
|
||||
cookie_file_name (void)
|
||||
{
|
||||
char *retval;
|
||||
|
||||
#if defined (LINUX)
|
||||
retval = strdup (COOKIE_FILE);
|
||||
#elif defined (MSDOS)
|
||||
static char vols[] =
|
||||
{
|
||||
'C',
|
||||
0, /* to be filled in with ROMlib_start_drive*/
|
||||
};
|
||||
static char *dirs[] =
|
||||
{
|
||||
"/dos",
|
||||
"/windows",
|
||||
"/winnt",
|
||||
"/",
|
||||
};
|
||||
int i, j;
|
||||
|
||||
vols[NELEM (vols)-1] = ROMlib_start_drive;
|
||||
retval = NULL;
|
||||
for (i = 0; !retval && i < (int) NELEM (vols); ++i)
|
||||
for (j = 0; !retval && j < (int) NELEM (dirs); ++j)
|
||||
retval = viable_path (vols[i], dirs[j]);
|
||||
|
||||
#else
|
||||
#error need cookie file name
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define open_cookie_file ocf
|
||||
|
||||
PRIVATE
|
||||
FILE *open_cookie_file (const char *mode)
|
||||
{
|
||||
FILE *retval;
|
||||
char *file;
|
||||
|
||||
file = cookie_file_name ();
|
||||
retval = file ? fopen (file, mode) : NULL;
|
||||
if (!retval)
|
||||
warning_trace_info ("%s", file ? file : "NULL");
|
||||
if (file)
|
||||
free (file);
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRIVATE boolean_t
|
||||
retrieve_cookie (cookie_t *cookiep)
|
||||
{
|
||||
boolean_t retval;
|
||||
|
||||
#if defined (LINUX) || defined (MSDOS)
|
||||
retval = FALSE;
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = open_cookie_file ("rb");
|
||||
if (fp)
|
||||
{
|
||||
retval = fread (cookiep, sizeof *cookiep, 1, fp) == 1;
|
||||
fclose (fp);
|
||||
}
|
||||
}
|
||||
#elif defined (CYGWIN32)
|
||||
|
||||
retval = win_retrieve_cookie (cookiep);
|
||||
|
||||
#else
|
||||
#warning not implemented
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
PRIVATE long
|
||||
today (void)
|
||||
{
|
||||
time_t t;
|
||||
struct tm tm;
|
||||
int retval;
|
||||
|
||||
time (&t);
|
||||
tm = *localtime (&t);
|
||||
retval = (long) tm.tm_year * 365 + tm.tm_yday;
|
||||
return retval;
|
||||
}
|
||||
|
||||
PRIVATE long
|
||||
unify_version (int major, int minor)
|
||||
{
|
||||
long retval;
|
||||
|
||||
retval = major * 10000 + minor;
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define leave_cookie lc
|
||||
|
||||
PRIVATE boolean_t
|
||||
leave_cookie (const cookie_t *cookiep)
|
||||
{
|
||||
boolean_t retval;
|
||||
|
||||
#if defined (LINUX) || defined (MSDOS)
|
||||
retval = FALSE;
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = open_cookie_file ("wb");
|
||||
if (fp)
|
||||
{
|
||||
retval = (fwrite (cookiep, sizeof *cookiep, 1, fp) == 1 &&
|
||||
fclose (fp) == 0);
|
||||
}
|
||||
if (!retval)
|
||||
warning_trace_info ("fp = %p", fp);
|
||||
}
|
||||
#elif defined (CYGWIN32)
|
||||
retval = win_leave_cookie (cookiep);
|
||||
if (!retval)
|
||||
warning_trace_info (NULL_STRING);
|
||||
#else
|
||||
#error "don't know how to leave cookie"
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define COOKIE_RES_TYPE TICK(" xp ")
|
||||
enum { COOKIE_RES_ID = 0 };
|
||||
|
||||
PRIVATE boolean_t
|
||||
retrieve_system_cookie (cookie_t *cookiep)
|
||||
{
|
||||
boolean_t retval;
|
||||
Handle h;
|
||||
INTEGER rn;
|
||||
|
||||
rn = CW (CurMap);
|
||||
UseResFile (0);
|
||||
h = GetResource (COOKIE_RES_TYPE, COOKIE_RES_ID);
|
||||
if (!h)
|
||||
retval = FALSE;
|
||||
else
|
||||
{
|
||||
if (cookiep)
|
||||
*cookiep = *(cookie_t *) STARH (h);
|
||||
retval = TRUE;
|
||||
}
|
||||
UseResFile (rn);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define leave_system_cookie lsc
|
||||
|
||||
PRIVATE boolean_t
|
||||
leave_system_cookie (const cookie_t *cookiep)
|
||||
{
|
||||
boolean_t retval, need_to_add;
|
||||
Handle h;
|
||||
INTEGER rn;
|
||||
|
||||
retval = TRUE;
|
||||
rn = CW (CurMap);
|
||||
UseResFile (0);
|
||||
h = GetResource (COOKIE_RES_TYPE, COOKIE_RES_ID);
|
||||
if (h)
|
||||
need_to_add = FALSE;
|
||||
else
|
||||
{
|
||||
need_to_add = TRUE;
|
||||
h = NewHandleSys (sizeof *cookiep);
|
||||
if (!h)
|
||||
retval = FALSE;
|
||||
}
|
||||
if (retval)
|
||||
{
|
||||
*(cookie_t *)STARH (h) = *cookiep;
|
||||
if (need_to_add)
|
||||
AddResource (h, COOKIE_RES_TYPE, COOKIE_RES_ID, NULL);
|
||||
else
|
||||
ChangedResource (h);
|
||||
WriteResource (h);
|
||||
}
|
||||
UseResFile (rn);
|
||||
return retval;
|
||||
}
|
||||
|
||||
PRIVATE boolean_t
|
||||
leave_cookies (const cookie_t *cookiep)
|
||||
{
|
||||
boolean_t retval;
|
||||
|
||||
retval = leave_cookie (cookiep);
|
||||
if (retval)
|
||||
retval = leave_system_cookie (cookiep);
|
||||
return retval;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
COOKIE_MAJOR_REVISION = 2,
|
||||
COOKIE_MINOR_REVISION = 12, /* 2.0v was 1 */
|
||||
};
|
||||
|
||||
PRIVATE void
|
||||
setup_cookie (cookie_t *cookiep)
|
||||
{
|
||||
cookiep->version = unify_version (COOKIE_MAJOR_REVISION,
|
||||
COOKIE_MINOR_REVISION);
|
||||
cookiep->day = today () + TIME_OUT_DAYS;
|
||||
}
|
||||
|
||||
#define days_left_func dlf
|
||||
|
||||
#define days_left(expire_day) \
|
||||
({ \
|
||||
typeof (expire_day) _d; \
|
||||
int retval; \
|
||||
\
|
||||
_d = expire_day; \
|
||||
retval = _d - today (); \
|
||||
if (retval < 0 || retval > TIME_OUT_DAYS) \
|
||||
retval = 0; \
|
||||
retval; \
|
||||
})
|
||||
|
||||
PRIVATE int
|
||||
days_left_func (void)
|
||||
{
|
||||
int retval;
|
||||
cookie_t cookie;
|
||||
|
||||
if (retrieve_cookie (&cookie))
|
||||
{
|
||||
if (cookie.version < unify_version (COOKIE_MAJOR_REVISION,
|
||||
COOKIE_MINOR_REVISION))
|
||||
{
|
||||
setup_cookie (&cookie);
|
||||
retval = leave_cookies (&cookie) ? days_left (cookie.day) : 0;
|
||||
if (retval == 0)
|
||||
warning_trace_info ("found old, couldn't leave new");
|
||||
}
|
||||
else
|
||||
{
|
||||
cookie_t cookie2;
|
||||
|
||||
if (!retrieve_system_cookie (&cookie2))
|
||||
{
|
||||
if (leave_system_cookie (&cookie))
|
||||
retval = days_left (cookie.day);
|
||||
else
|
||||
{
|
||||
warning_trace_info ("couldn't leave sys");
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cookie.day == cookie2.day)
|
||||
retval = days_left (cookie.day);
|
||||
else
|
||||
{
|
||||
retval = 0;
|
||||
warning_trace_info ("mismatch");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (retrieve_system_cookie (&cookie))
|
||||
{
|
||||
if (cookie.version < unify_version (COOKIE_MAJOR_REVISION,
|
||||
COOKIE_MINOR_REVISION))
|
||||
{
|
||||
setup_cookie (&cookie);
|
||||
retval = leave_cookies (&cookie) ? days_left (cookie.day) : 0;
|
||||
if (retval == 0)
|
||||
warning_trace_info ("found old, couldn't leave new");
|
||||
else
|
||||
warning_trace_info ("found old, left new");
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = 0;
|
||||
warning_trace_info ("unexpected system");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setup_cookie (&cookie);
|
||||
if (leave_cookies (&cookie))
|
||||
retval = days_left (cookie.day);
|
||||
else
|
||||
{
|
||||
retval = 0;
|
||||
warning_trace_info ("couldn't leave");
|
||||
}
|
||||
}
|
||||
|
||||
if (retval <= 0)
|
||||
{
|
||||
ROMlib_exit = TRUE;
|
||||
if (retval < 0)
|
||||
warning_trace_info ("%d", retval);
|
||||
}
|
||||
replace_physgestalt_selector (gestaltDemoExpiration, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define ABOUT_BOX_WIDTH 500
|
||||
#define ABOUT_BOX_HEIGHT 300
|
||||
#define BUTTON_WIDTH 85
|
||||
@ -431,14 +61,6 @@ static struct { char *name, *text; ControlHandle ctl; } about_box_buttons[] = {
|
||||
},
|
||||
{ "Maker",
|
||||
"ARDI\r"
|
||||
// "Suite 4-101\r"
|
||||
// "1650 University Blvd., NE\r"
|
||||
// "Albuquerque, NM 87102\r\r"
|
||||
|
||||
// "+1 505 766 5153 FAX\r"
|
||||
// "+1 505 766 9115 Phone (M-F 9am-5pm Mountain Time)\r\r"
|
||||
|
||||
// "E-Mail: questions@ardi.com\r"
|
||||
"World Wide Web: <http://www.ardi.com>\r"
|
||||
"FTP: <ftp://ftp.ardi.com/pub>\r",
|
||||
NULL
|
||||
@ -614,13 +236,8 @@ find_license_button (void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if defined (TIME_OUT_DAYS)
|
||||
#define DAYS_LEFT_MESSAGE "%d DAYS LEFT\r\r"
|
||||
#define EXPIRED_MESSAGE "This demo has EXPIRED.\r\r"
|
||||
#endif
|
||||
|
||||
static void
|
||||
create_license_text (int days_left)
|
||||
create_license_text (void)
|
||||
{
|
||||
int b;
|
||||
|
||||
@ -632,13 +249,6 @@ create_license_text (int days_left)
|
||||
|
||||
new_size = 0;
|
||||
|
||||
#if defined (TIME_OUT_DAYS)
|
||||
#if TIME_OUT_DAYS > 999
|
||||
#error string overflow
|
||||
#endif
|
||||
new_size += MAX (sizeof DAYS_LEFT_MESSAGE, sizeof EXPIRED_MESSAGE);
|
||||
#endif
|
||||
|
||||
/* Compute the length of the license string. */
|
||||
for (licensep = ROMlib_licensep ? (char *) ROMlib_licensep->chars : "";
|
||||
*licensep;)
|
||||
@ -659,13 +269,6 @@ create_license_text (int days_left)
|
||||
|
||||
p = license_text;
|
||||
|
||||
#if defined (TIME_OUT_DAYS)
|
||||
if (days_left > 0)
|
||||
p += sprintf (p, DAYS_LEFT_MESSAGE, days_left);
|
||||
else
|
||||
p += sprintf (p, EXPIRED_MESSAGE);
|
||||
#endif
|
||||
|
||||
for (licensep = ROMlib_licensep ? (char *) ROMlib_licensep->chars : "";
|
||||
*licensep;)
|
||||
{
|
||||
@ -860,7 +463,7 @@ dispose_tips_text (void)
|
||||
|
||||
|
||||
static void
|
||||
create_about_box (int days_left)
|
||||
create_about_box ()
|
||||
{
|
||||
static Rect scroll_bar_bounds = {
|
||||
CWC (TE_TOP),
|
||||
@ -877,7 +480,7 @@ create_about_box (int days_left)
|
||||
Rect about_box_bounds;
|
||||
int b;
|
||||
|
||||
create_license_text (days_left);
|
||||
create_license_text ();
|
||||
create_tips_text ();
|
||||
|
||||
SetRect (&about_box_bounds,
|
||||
@ -1190,18 +793,15 @@ do_about_box (void)
|
||||
|
||||
if (!busy_p)
|
||||
{
|
||||
int days_left;
|
||||
|
||||
busy_p = TRUE; /* Only allow one about box at a time. */
|
||||
|
||||
if (scroll_bar_callback == 0)
|
||||
scroll_bar_callback = (ProcPtr) SYN68K_TO_US(callback_install (scroll_stub, NULL));
|
||||
|
||||
days_left = days_left_func ();
|
||||
ZONE_SAVE_EXCURSION
|
||||
(SysZone,
|
||||
{
|
||||
create_about_box (days_left);
|
||||
create_about_box ();
|
||||
|
||||
THEPORT_SAVE_EXCURSION
|
||||
(about_box,
|
||||
@ -1217,9 +817,5 @@ do_about_box (void)
|
||||
});
|
||||
|
||||
busy_p = FALSE;
|
||||
if (days_left <= 0)
|
||||
C_ExitToShell ();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SUPPORT_ABOUT_EXECUTOR_BOX */
|
||||
|
@ -194,7 +194,7 @@ adb_apeiron_hack (boolean_t deltas_p, ...)
|
||||
/* begin code for PegLeg */
|
||||
|
||||
if (button_is_down)
|
||||
MBState = CRACKER_ZERO;
|
||||
MBState = 0;
|
||||
else
|
||||
MBState = 0xFF;
|
||||
|
||||
|
@ -286,10 +286,6 @@ dosdisk_open (int disk, LONGINT *bsizep, drive_flags_t *flagsp)
|
||||
d->disk_number = disk;
|
||||
d->is_open = 1;
|
||||
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
*flagsp |= DRIVE_FLAGS_LOCKED;
|
||||
#endif
|
||||
|
||||
dcache_invalidate (disk | DOSFDBIT);
|
||||
|
||||
return disk;
|
||||
@ -833,9 +829,6 @@ dosdisk_read (int disk, void *buf, int num_bytes)
|
||||
int
|
||||
dosdisk_write (int disk, const void *buf, int num_bytes)
|
||||
{
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
return -1;
|
||||
#else
|
||||
dosdisk_info_t *d = disk_number_to_disk_info (disk);
|
||||
int orig_num_bytes;
|
||||
boolean_t old_slow_clock_p;
|
||||
@ -971,5 +964,4 @@ dosdisk_write (int disk, const void *buf, int num_bytes)
|
||||
|
||||
set_expect_slow_clock (old_slow_clock_p);
|
||||
return orig_num_bytes - num_bytes;
|
||||
#endif /* !defined (DISABLE_FLOPPY_WRITES) */
|
||||
}
|
||||
|
@ -930,11 +930,7 @@ aspi_disk_read (int disk, void *buf, int num_bytes)
|
||||
PUBLIC int
|
||||
aspi_disk_write (int disk, const void *buf, int num_bytes)
|
||||
{
|
||||
#if defined (DISABLE_SCSI_WRITES)
|
||||
return -1;
|
||||
#else
|
||||
return aspi_disk_xfer (WRITE_10, disk, (void *) buf, num_bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1033,9 +1029,6 @@ aspi_try_to_open_and_mount_disk (int disk)
|
||||
sprintf (aspi_name, "aspi(%d,%d,%d)",
|
||||
aspi_info[disk].adaptor, aspi_info[disk].target,
|
||||
aspi_info[disk].lun);
|
||||
#if defined (DISABLE_SCSI_WRITES)
|
||||
flags |= DRIVE_FLAGS_LOCKED;
|
||||
#endif
|
||||
try_to_mount_disk (aspi_name, disk | ASPIFDBIT, &mess,
|
||||
blocksize, 16 * PHYSBSIZE, flags, 0);
|
||||
mess = CL (mess);
|
||||
|
@ -386,10 +386,6 @@ dosdisk_open (int disk, LONGINT *bsizep, drive_flags_t *flagsp)
|
||||
d->disk_number = disk;
|
||||
d->is_open = 1;
|
||||
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
*flagsp |= DRIVE_FLAGS_LOCKED;
|
||||
#endif
|
||||
|
||||
dcache_invalidate (disk | DOSFDBIT, FALSE);
|
||||
|
||||
lock_media (disk);
|
||||
@ -876,9 +872,6 @@ dosdisk_read (int disk, void *buf, int num_bytes)
|
||||
int
|
||||
dosdisk_write (int disk, const void *buf, int num_bytes)
|
||||
{
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
return -1;
|
||||
#else
|
||||
dosdisk_info_t *d = disk_number_to_disk_info (disk);
|
||||
int orig_num_bytes;
|
||||
boolean_t old_slow_clock_p;
|
||||
@ -1030,5 +1023,4 @@ dosdisk_write (int disk, const void *buf, int num_bytes)
|
||||
if (changed && num_bytes == 0)
|
||||
complain_about_changed_media ();
|
||||
return orig_num_bytes - num_bytes;
|
||||
#endif /* !defined (DISABLE_FLOPPY_WRITES) */
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ extern void sendresumeevent(LONGINT cvtclip);
|
||||
extern void sendsuspendevent(void);
|
||||
extern void ROMlib_writenameorgkey(char *name, char *org, char *key);
|
||||
extern void contextswitch(char **from_spp, char **to_spp);
|
||||
extern void protectus(long serialnumber, long max);
|
||||
extern LONGINT insertfonttbl(char **op, char doit);
|
||||
|
||||
#ifndef OPENSTEP
|
||||
|
@ -648,7 +648,7 @@ void PutScrapX(LONGINT type, LONGINT length, char *p, int scrap_count)
|
||||
PUBLIC boolean_t
|
||||
we_lost_clipboard(void)
|
||||
{
|
||||
/* TODO */
|
||||
return false; /* TODO */
|
||||
}
|
||||
|
||||
LONGINT GetScrapX(LONGINT type, char **h)
|
||||
|
@ -1,107 +0,0 @@
|
||||
/* Copyright 1998, 1999 by Abacus Research and
|
||||
* Development, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#if !defined (OMIT_RCSID_STRINGS)
|
||||
char ROMlib_rcsid_win_cookie[] = "$Id: win_cookie.c 63 2004-12-24 18:19:43Z ctm $";
|
||||
#endif
|
||||
|
||||
#define USE_WINDOWS_NOT_MAC_TYPEDEFS_AND_DEFINES
|
||||
|
||||
#include "rsys/common.h"
|
||||
#include "rsys/cookie.h"
|
||||
#include "rsys/custom.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined (TIME_OUT_DAYS)
|
||||
|
||||
#define COOKIE_KEY_ROOT "SOFTWARE\\ARDI\\xp"
|
||||
|
||||
PRIVATE const char *
|
||||
create_cookie_key (void)
|
||||
{
|
||||
char *retval;
|
||||
int length;
|
||||
|
||||
length = strlen (COOKIE_KEY_ROOT) + 1;
|
||||
|
||||
if (ROMlib_mac_demo_idp)
|
||||
length += 1 + strlen (ROMlib_mac_demo_idp->chars);
|
||||
retval = malloc (length);
|
||||
if (retval)
|
||||
{
|
||||
strcpy (retval, COOKIE_KEY_ROOT);
|
||||
if (ROMlib_mac_demo_idp)
|
||||
{
|
||||
char *ip, *op;
|
||||
|
||||
/* make sure there's just one \ separator and that we always use
|
||||
lower case in the key */
|
||||
|
||||
for (ip = ROMlib_mac_demo_idp->chars; *ip == '\\'; ++ip)
|
||||
;
|
||||
for (op = retval + strlen (retval), *op++ = '\\'; *ip; ++ip)
|
||||
*op++ = tolower (*ip);
|
||||
*op = 0;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
destroy_cookie_key (const char *cookie_key)
|
||||
{
|
||||
free ((char *) cookie_key);
|
||||
}
|
||||
|
||||
PUBLIC int
|
||||
win_retrieve_cookie (cookie_t *cookiep)
|
||||
{
|
||||
int retval;
|
||||
HKEY key;
|
||||
const char *cookie_key;
|
||||
|
||||
retval = 0;
|
||||
cookie_key = create_cookie_key ();
|
||||
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, cookie_key, 0, KEY_READ, &key)
|
||||
== ERROR_SUCCESS)
|
||||
{
|
||||
DWORD val_len;
|
||||
|
||||
val_len = sizeof *cookiep;
|
||||
retval = (RegQueryValueEx (key, "xp", NULL, NULL, (LPBYTE) cookiep,
|
||||
&val_len) == ERROR_SUCCESS);
|
||||
RegCloseKey (key);
|
||||
}
|
||||
destroy_cookie_key (cookie_key);
|
||||
return retval;
|
||||
}
|
||||
|
||||
PUBLIC int
|
||||
win_leave_cookie (const cookie_t *cookiep)
|
||||
{
|
||||
int retval;
|
||||
HKEY key;
|
||||
DWORD disp;
|
||||
const char *cookie_key;
|
||||
|
||||
retval = 0;
|
||||
cookie_key = create_cookie_key ();
|
||||
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, cookie_key, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
|
||||
&key, &disp) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD val_len;
|
||||
|
||||
val_len = sizeof *cookiep;
|
||||
retval = (RegSetValueEx (key, "xp", 0, REG_BINARY, (LPBYTE) cookiep,
|
||||
sizeof *cookiep) == ERROR_SUCCESS);
|
||||
RegCloseKey (key);
|
||||
}
|
||||
destroy_cookie_key (cookie_key);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
@ -343,10 +343,6 @@ dosdisk_open (int disk, LONGINT *bsizep, drive_flags_t *flagsp)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
*flagsp |= DRIVE_FLAGS_LOCKED;
|
||||
#endif
|
||||
|
||||
dcache_invalidate (disk | DOSFDBIT, FALSE);
|
||||
|
||||
SetErrorMode (old_err_mode);
|
||||
|
@ -33,14 +33,12 @@ P1(PUBLIC pascal trap, INTEGER, OpenDeskAcc, Str255, acc) /* IMI-440 */
|
||||
DCtlHandle dctlh;
|
||||
WindowPtr wp;
|
||||
|
||||
#if defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
if (EqualString (acc, about_box_menu_name_pstr, TRUE, TRUE))
|
||||
{
|
||||
do_about_box ();
|
||||
retval = 0;
|
||||
goto done;
|
||||
}
|
||||
#endif /* SUPPORT_ABOUT_EXECUTOR_BOX */
|
||||
|
||||
if (OpenDriver(acc, &retval) == noErr) {
|
||||
retval = CW(retval);
|
||||
@ -56,9 +54,7 @@ P1(PUBLIC pascal trap, INTEGER, OpenDeskAcc, Str255, acc) /* IMI-440 */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
done:
|
||||
#endif
|
||||
|
||||
SEvtEnb = TRUE;
|
||||
return retval;
|
||||
|
@ -282,7 +282,7 @@ ROMlib_new_dialog_common (DialogPtr dp,
|
||||
itp = (itmp) (ip + 1);
|
||||
i = CW (*ip);
|
||||
item_no = 1;
|
||||
while (i-- >= CRACKER_ZERO)
|
||||
while (i-- >= 0)
|
||||
{
|
||||
dialog_create_item ((DialogPeek) dp, itp, itp, item_no,
|
||||
zero_pt);
|
||||
|
@ -32,7 +32,6 @@ char ROMlib_rcsid_dialHandle[] =
|
||||
#include "rsys/pstuff.h"
|
||||
#include "rsys/stdfile.h"
|
||||
#include "rsys/print.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/hook.h"
|
||||
#include "rsys/executor.h"
|
||||
#include "rsys/osevent.h"
|
||||
@ -92,8 +91,6 @@ ROMlib_CALLMODALPROC (DialogPtr dp,
|
||||
retval = C_ROMlib_numsonlyfilterproc((DialogPeek) dp, evtp, ip);
|
||||
else if (fp == (modalprocp) P_ROMlib_stlfilterproc)
|
||||
retval = C_ROMlib_stlfilterproc((DialogPeek) dp, evtp, ip);
|
||||
else if (fp == (modalprocp) P_ROMlib_licensefilt)
|
||||
retval = C_ROMlib_licensefilt((DialogPeek) dp, evtp, ip);
|
||||
else
|
||||
{
|
||||
ROMlib_hook(dial_modalnumber);
|
||||
|
@ -123,7 +123,7 @@ dirty_rect_accrue (int top, int left, int bottom, int right)
|
||||
/* Figure out which union adds the least new area. */
|
||||
best_area_added = ~0UL;
|
||||
best = 0;
|
||||
for (i = ndr - 1; i >= CRACKER_ZERO; i--)
|
||||
for (i = ndr - 1; i >= 0; i--)
|
||||
{
|
||||
unsigned long added;
|
||||
|
||||
|
@ -35,9 +35,6 @@ P2(PUBLIC pascal trap, INTEGER, DIBadMount, Point, pt, LONGINT, evtmess)
|
||||
|
||||
P1(PUBLIC pascal trap, OSErr, DIFormat, INTEGER, dn)
|
||||
{
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
return wPrErr;
|
||||
#endif
|
||||
return noErr; /* We don't do low-level formats right now */
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ char ROMlib_rcsid_dump[] =
|
||||
#include "DialogMgr.h"
|
||||
#include "ControlMgr.h"
|
||||
#include "MenuMgr.h"
|
||||
#include "FileMgr.h"
|
||||
|
||||
#include "rsys/cquick.h"
|
||||
#include "rsys/wind.h"
|
||||
|
@ -26,7 +26,6 @@ char ROMlib_rcsid_emutraptables[] =
|
||||
#include "rsys/osutil.h"
|
||||
#include "rsys/vbl.h"
|
||||
#include "rsys/soundopts.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/refresh.h"
|
||||
#include "rsys/gestalt.h"
|
||||
#include "rsys/emustubs.h"
|
||||
@ -1195,7 +1194,6 @@ toolstuff_t pstuff[] = {
|
||||
{ { _Key1Trans, -1 }, (void *) 0},
|
||||
{ { _Key2Trans, -1 }, (void *) 0},
|
||||
|
||||
{ { C_ROMlib_licensefilt, PTOC_ROMlib_licensefilt }, (void *) 0 },
|
||||
{ { C_unixmount, PTOC_unixmount }, (void *) 0 },
|
||||
{ { C_GestaltTablesOnly, PTOC_GestaltTablesOnly }, (void *) 0 },
|
||||
{ { C_sound_timer_handler, 0 }, (void *) 0 },
|
||||
|
@ -50,7 +50,6 @@ char ROMlib_rcsid_executor[] =
|
||||
#include "rsys/trapname.h"
|
||||
|
||||
#include "rsys/options.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/suffix_maps.h"
|
||||
#include "rsys/string.h"
|
||||
#include "rsys/custom.h"
|
||||
@ -639,7 +638,6 @@ PUBLIC void executor_main( void )
|
||||
#define ALINETRAPNUMBER 0xA
|
||||
trap_install_handler( ALINETRAPNUMBER, alinehandler, (void *) 0);
|
||||
#endif
|
||||
dolicense();
|
||||
if (thefile.fType == CLC(T('A','P','P','L')))
|
||||
{
|
||||
ClrAppFiles(1);
|
||||
|
@ -58,13 +58,13 @@ AUX_SRC = \
|
||||
dump.c trapname.c float4.c float5.c float7.c floatnext.c font.c \
|
||||
gestalt.c globals.c \
|
||||
image.c image_inits.c iu.c launch.c main.c mman.c mmansubr.c \
|
||||
notify.c hle.c osevent.c osutil.c pack.c protector.c scrap.c script.c \
|
||||
notify.c hle.c osevent.c osutil.c pack.c scrap.c script.c \
|
||||
segment.c serial.c setuid.c slash.c \
|
||||
sounddriver.c sound.c soundIMVI.c soundfake.c \
|
||||
stdfile.c romlib_stubs.c \
|
||||
snth5.c syserr.c toolevent.c toolmath.c toolutil.c time.c vbl.c \
|
||||
syncint.c virtualint.c refresh.c autorefresh.c \
|
||||
license.c aboutbox.c licensetext.c dcmaketables.c \
|
||||
aboutbox.c licensetext.c dcmaketables.c \
|
||||
dcconvert.c rgbutil.c keycode.c option.c parseopt.c parsenum.c \
|
||||
desperate.c \
|
||||
version.c shutdown.c uniquefile.c sigio_multiplex.c \
|
||||
|
@ -235,11 +235,9 @@ quoted_character (unsigned char *name, int length)
|
||||
{
|
||||
retval = (length > 2 &&
|
||||
iscandidate_for_quoting (name[1], name[2]));
|
||||
#if defined (RELEASE_INTERNAL)
|
||||
if (!retval)
|
||||
fprintf (stderr, "*** suspicious colon in '%.*s' ***\n", length,
|
||||
name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
@ -304,7 +302,7 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */
|
||||
char *pathname, *filename, *endname, *rpathname;
|
||||
char savechar;
|
||||
struct stat datasbuf, resourcesbuf, parentsbuf;
|
||||
LONGINT longzero = CRACKER_ZERO;
|
||||
LONGINT longzero = 0;
|
||||
VCBExtra *vcbp;
|
||||
THz savezone;
|
||||
struct timeval accessupdatetimes[2];
|
||||
|
11
src/float4.c
11
src/float4.c
@ -1242,14 +1242,3 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fclassx, void *,
|
||||
*dp = CW (0 - CW (*dp));
|
||||
|
||||
}
|
||||
|
||||
#if !defined (NDEBUG)
|
||||
|
||||
#undef EXTERN_INLINE
|
||||
#define EXTERN_INLINE
|
||||
|
||||
#undef _floatconv_h_
|
||||
|
||||
#include "rsys/floatconv.h"
|
||||
|
||||
#endif
|
||||
|
@ -235,17 +235,6 @@ PRIVATE gestaltentry_t phystable[] =
|
||||
#else
|
||||
#warning gestaltExecutorVersionString not currently available
|
||||
#endif
|
||||
#if defined (RELEASE_DEMO)
|
||||
{ gestaltDemoStatus, 1 },
|
||||
#if defined (TIME_OUT_DAYS)
|
||||
{ gestaltDemoExpiration, TO_BE_FILLED_IN },
|
||||
#endif
|
||||
#else
|
||||
{ gestaltDemoStatus, 0 },
|
||||
{ gestaltSerialNumber, TO_BE_FILLED_IN },
|
||||
{ gestaltRegisteredName, TO_BE_FILLED_IN },
|
||||
{ gestaltRegisteredOrg, TO_BE_FILLED_IN },
|
||||
#endif
|
||||
#if defined (LINUX) || defined (CYGWIN32)
|
||||
{ gestaltPhysicalRAMSize, TO_BE_FILLED_IN },
|
||||
#endif
|
||||
|
@ -75,30 +75,7 @@ extern INTEGER SysEvtMask;
|
||||
extern QHdr EventQueue;
|
||||
#endif
|
||||
|
||||
#if !defined (SHORT_TICKS)
|
||||
|
||||
#define Ticks (Ticks_UL.u)
|
||||
#define CRACKER_ZERO (0)
|
||||
|
||||
#else
|
||||
|
||||
#if !defined (SHORT_TICKS_SHIFT)
|
||||
#define SHORT_TICKS_SHIFT 0
|
||||
#endif
|
||||
|
||||
#define Ticks ((ULONGINT) (*(unsigned long *)SYN68K_TO_US(0x16c)) \
|
||||
& ((1<<(16+SHORT_TICKS_SHIFT))-1))
|
||||
|
||||
/* This macro evaluates to *(short *) 0x16a, but the assembly code
|
||||
* generated varies depending on what line the macro is invoked!
|
||||
*/
|
||||
|
||||
#define CRACKER_ZERO \
|
||||
(CW(*(short *) ({ volatile long a = __LINE__ * 17; \
|
||||
*&a + ((SYN68K_TO_US(0x16a)) - __LINE__ * 17); })) >> SHORT_TICKS_SHIFT)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
extern void ROMlib_eventdep( void );
|
||||
extern void insertcommonevent( char *xeventp, commonevent *comevtp );
|
||||
|
@ -1,11 +1,7 @@
|
||||
#if !defined (_RSYS_ABOUTBOX_H_)
|
||||
#define _RSYS_ABOUTBOX_H_
|
||||
|
||||
#if defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
|
||||
extern StringPtr about_box_menu_name_pstr;
|
||||
extern void do_about_box (void);
|
||||
|
||||
#endif /* SUPPORT_ABOUT_EXECUTOR_BOX */
|
||||
|
||||
#endif /* !_RSYS_ABOUTBOX_H_ */
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
extern void ROMlib_circledefault(DialogPtr dp);
|
||||
|
||||
#if !defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
#define ABOUTOKITEM 1
|
||||
#endif
|
||||
|
||||
#endif /* !defined(__RSYS_ABOUTPANEL__) */
|
||||
|
@ -1,25 +0,0 @@
|
||||
#if !defined(_RSYS_COOKIE_H_)
|
||||
#define _RSYS_COOKIE_H_
|
||||
|
||||
/*
|
||||
* Copyright 1998 by Abacus Research and Development, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* $Id: cookie.h 63 2004-12-24 18:19:43Z ctm $
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long version;
|
||||
long day;
|
||||
}
|
||||
cookie_t;
|
||||
|
||||
#if defined (CYGWIN32)
|
||||
|
||||
extern int win_retrieve_cookie (cookie_t *cookiep);
|
||||
extern int win_leave_cookie (const cookie_t *cookiep);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -28,24 +28,9 @@ enum { gestaltGhostScriptVersion = T ('g', 'o', 's', 't') };
|
||||
/* Executor Version as string */
|
||||
enum { gestaltExecutorVersionString = T ('x', 'q', 't', 'r') };
|
||||
|
||||
/* whether or not we're the demo version */
|
||||
enum { gestaltDemoStatus = T ('d', 'e', 'm', 'o') };
|
||||
|
||||
/* expiration date */
|
||||
enum { gestaltDemoExpiration = T ('x', 'p', 'i', 'r') };
|
||||
|
||||
/* serial number */
|
||||
enum { gestaltSerialNumber = T ('s', '/', 'n', ' ') };
|
||||
|
||||
/* screen size */
|
||||
enum { gestaltScreenSize = T ('s', 'c', 'r', 'n') };
|
||||
|
||||
/* registered name */
|
||||
enum { gestaltRegisteredName = T ('n', 'a', 'm', 'e') };
|
||||
|
||||
/* registered organization */
|
||||
enum { gestaltRegisteredOrg = T ('o', 'r', 'g', ' ') };
|
||||
|
||||
enum { gestaltPHYSICAL = T ('M', 'U', 'L', '8') };
|
||||
|
||||
enum { physicalUndefSelectorErr = -15551 };
|
||||
|
@ -867,10 +867,6 @@ PRIVATE void reset_low_globals(void)
|
||||
((char *)&lastlowglobal - (char *)&nilhandle
|
||||
- 64 * sizeof (ULONGINT)));
|
||||
|
||||
#if defined (SHORT_TICKS)
|
||||
/* CRACKER_ZERO = 0; */
|
||||
*(short *)SYN68K_TO_US(0x16a) = 0;
|
||||
#endif
|
||||
AE_info = saveAE_info;
|
||||
|
||||
JCrsrTask = saveJCrsrTask;
|
||||
|
@ -1,25 +0,0 @@
|
||||
#if !defined(_RSYS_LICENSE_H_)
|
||||
#define _RSYS_LICENSE_H_
|
||||
|
||||
/*
|
||||
* Copyright 1994 by Abacus Research and Development, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* $Id: license.h 63 2004-12-24 18:19:43Z ctm $
|
||||
*/
|
||||
|
||||
#include <DialogMgr.h>
|
||||
|
||||
enum { GENERIC_COMPLAINT_ID = -3000 };
|
||||
|
||||
typedef enum { no_license, old_license, register_only } which_license_t;
|
||||
|
||||
extern void dolicense ( void );
|
||||
extern which_license_t ROMlib_dolicense;
|
||||
|
||||
extern INTEGER C_ROMlib_licensefilt(DialogPeek dp, EventRecord *evtp,
|
||||
INTEGER *ith);
|
||||
extern void ROMlib_writenameorgkey(char *name, char *org, char *key);
|
||||
extern void protectus(long serialnumber, long max);
|
||||
|
||||
#endif
|
@ -17,19 +17,6 @@
|
||||
#define INFO_START_STRING "Run Paiot,-Svp."
|
||||
/* 1234567890123456 */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char info_start_string[sizeof(INFO_START_STRING)];
|
||||
LONGINT serialnumber;
|
||||
char name[81];
|
||||
char organization[81];
|
||||
char key[81];
|
||||
LONGINT inodenumber;
|
||||
LONGINT timechanged;
|
||||
} infoblock;
|
||||
|
||||
extern infoblock ROMlib_info;
|
||||
|
||||
#define SETUPA5 LONGINT savea5; savea5 = EM_A5; EM_A5 = CL( (LONGINT) CurrentA5)
|
||||
|
||||
#define RESTOREA5 EM_A5 = savea5
|
||||
|
@ -1,130 +1,30 @@
|
||||
#if !defined (_RSYS_RELEASE_H_)
|
||||
#define _RSYS_RELEASE_H_
|
||||
|
||||
/* There are four kinds of builds:
|
||||
* RELEASE_INTERNAL:
|
||||
* for internal use ONLY, and should not be released to the public.
|
||||
* RELEASE_PRE_BETA:
|
||||
* a time-limited demo copy that can be registered to remove the limit.
|
||||
* RELEASE_DEMO:
|
||||
* a "crippled" demo copy that cannot be registered.
|
||||
* RELEASE_COMMERCIAL:
|
||||
* the full commercial release, for sale but not to be made publicly
|
||||
* available.
|
||||
*
|
||||
* Other files can expect that Exactly one of these will be #defined.
|
||||
* If none are #defined, RELEASE_PRE_BETA will be #defined here.
|
||||
*
|
||||
* Certain releases enable certain features:
|
||||
*
|
||||
* DISPLAY_SPLASH_INFO_BOX:
|
||||
* display the old syserr demo/info box on startup
|
||||
* DISPLAY_SPLASH_SCREEN:
|
||||
* display a fancy splash screen while loading
|
||||
* SUPPORT_ABOUT_EXECUTOR_BOX:
|
||||
* make an "about Executor" menu available that brings up a special
|
||||
* about box.
|
||||
* REGISTER_BEFORE_USABLE:
|
||||
* Executor must be registered before it can be used at all.
|
||||
* SHORT_TICKS:
|
||||
* low-memory global Ticks is treated as a short and the high 2 bytes
|
||||
* are used (this means if crackers disable the "Time's Up" message,
|
||||
* subtle things will go awry)
|
||||
* PRINT_DEMO_WATERMARK:
|
||||
* All output comes with "Demo" printed diagonally down the page
|
||||
* DISABLE_FLOPPY_WRITES:
|
||||
* Executor will read HD floppies but not write to them
|
||||
* DISABLE_SCSI_WRITES:
|
||||
* Executor will read SCSI drives but not write to them
|
||||
* DISABLE_COMMAND_KEY_EQUIVS:
|
||||
* Command-key shortcuts won't work in the demo version
|
||||
* DISPLAY_DEMO_ON_MENU_BAR:
|
||||
* Menu Bar says "DEMO" in red, which can be clicked on to get a little
|
||||
* information about where to find the real thing.
|
||||
* TIME_OUT n
|
||||
* Executor time's out in n minutes.
|
||||
* SHORT_TICKS_SHIFT n
|
||||
* The number of bits to right shift the high short of Ticks. Could
|
||||
* be computed from TIME_OUT if we could do log2 in #defines. Not needed
|
||||
* for timeouts up to 18 minutes, but needs to be 1 for 30 minutes.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: Internal builds are now flagged as such
|
||||
* There used to be different types of releases, e.g. commercial demo,
|
||||
* internal. This header file used to set up different options
|
||||
* depending on which release we were.
|
||||
*
|
||||
* In general, all the old pain-in-the-butt options have been removed
|
||||
* and what little is left will be converted to configuration options
|
||||
* when (if) we switch to the GNU build system.
|
||||
*
|
||||
* In the meantime, there's still a little cruft in here.
|
||||
*/
|
||||
|
||||
#if defined (RELEASE_INTERNAL)
|
||||
|
||||
#define DISPLAY_DEMO_ON_MENU_BAR
|
||||
#define DEMO_PREFIX "INTERNAL "
|
||||
|
||||
#else
|
||||
|
||||
#define DEMO_PREFIX ""
|
||||
|
||||
#endif
|
||||
|
||||
#if (!defined (RELEASE_DEMO) \
|
||||
&& !defined (RELEASE_COMMERCIAL) \
|
||||
&& !defined (RELEASE_PRE_BETA) \
|
||||
&& !defined (RELEASE_INTERNAL))
|
||||
#define RELEASE_PRE_BETA
|
||||
#endif
|
||||
|
||||
#if (1 != (defined (RELEASE_DEMO) \
|
||||
+ defined (RELEASE_COMMERCIAL) \
|
||||
+ defined (RELEASE_PRE_BETA) \
|
||||
+ defined (RELEASE_INTERNAL)))
|
||||
#error "Exactly one release type must be specified."
|
||||
#endif
|
||||
|
||||
#if defined (RELEASE_PRE_BETA)
|
||||
#define DISPLAY_SPLASH_INFO_BOX
|
||||
#define TIME_OUT
|
||||
#endif
|
||||
|
||||
#if !defined (RELEASE_PRE_BETA)
|
||||
#define DISPLAY_SPLASH_SCREEN
|
||||
#define SUPPORT_ABOUT_EXECUTOR_BOX
|
||||
#endif
|
||||
|
||||
#if defined (RELEASE_DEMO)
|
||||
|
||||
/* #define SHORT_TICKS */
|
||||
#define PRINT_DEMO_WATERMARK
|
||||
#define DISABLE_FLOPPY_WRITES
|
||||
#define DISABLE_SCSI_WRITES
|
||||
#define DISPLAY_DEMO_ON_MENU_BAR
|
||||
|
||||
#define TIME_OUT_DAYS (ROMlib_days_of_demop ? ROMlib_days_of_demop->val : 30)
|
||||
#define DISABLE_COMMAND_KEY_EQUIVS
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (RELEASE_COMMERCIAL)
|
||||
#define REGISTER_BEFORE_USABLE
|
||||
#endif
|
||||
|
||||
/* Set up the bit mask for which classes of debugging information
|
||||
* we can generate. This can be overridden on the command line
|
||||
* by defining ERROR_SUPPORTED_MASK there.
|
||||
*/
|
||||
|
||||
#if !defined (ERROR_SUPPORTED_MASK)
|
||||
# if defined (RELEASE_INTERNAL)
|
||||
# define ERROR_SUPPORTED_MASK (~0) /* all errors */
|
||||
# else /* !RELEASE_INTERNAL */
|
||||
# define ERROR_SUPPORTED_MASK \
|
||||
(ERROR_BIT_MASK (ERROR_UNIMPLEMENTED) \
|
||||
| ERROR_BIT_MASK (ERROR_UNEXPECTED) \
|
||||
| ERROR_BIT_MASK (ERROR_TRACE_INFO) \
|
||||
| ERROR_BIT_MASK (ERROR_FILESYSTEM_LOG))
|
||||
# endif /* !RELEASE_INTERNAL */
|
||||
#endif /* !ERROR_SUPPORTED_MASK */
|
||||
|
||||
#if defined (RELEASE_INTERNAL)
|
||||
#define SUPPORT_LOG_ERR_TO_RAM
|
||||
#endif
|
||||
|
||||
#if defined (EXPERIMENTAL)
|
||||
#define ALLOW_MOVABLE_MODAL
|
||||
|
@ -1,8 +1,7 @@
|
||||
#if !defined (_SYSTEM_ERROR_H_)
|
||||
#define _SYSTEM_ERROR_H_
|
||||
|
||||
/* system_error.h
|
||||
$Id: system_error.h 63 2004-12-24 18:19:43Z ctm $ */
|
||||
enum { GENERIC_COMPLAINT_ID = -3000 };
|
||||
|
||||
typedef void (*system_error_callback_t) (void);
|
||||
|
||||
|
@ -81,7 +81,6 @@ char ROMlib_rcsid_launch[] =
|
||||
#include "rsys/print.h"
|
||||
#include "rsys/gestalt.h"
|
||||
#include "rsys/osevent.h"
|
||||
#include "rsys/license.h"
|
||||
|
||||
#include "rsys/cfm.h"
|
||||
#include "rsys/launch.h"
|
||||
@ -952,10 +951,6 @@ PRIVATE void reset_low_globals(void)
|
||||
((char *)&lastlowglobal - (char *)&nilhandle
|
||||
- 64 * sizeof (ULONGINT)));
|
||||
|
||||
#if defined (SHORT_TICKS)
|
||||
/* CRACKER_ZERO = 0; */
|
||||
*(short *)SYN68K_TO_US(0x16a) = 0;
|
||||
#endif
|
||||
AE_info = saveAE_info;
|
||||
|
||||
JCrsrTask = saveJCrsrTask;
|
||||
|
582
src/license.c
582
src/license.c
@ -1,582 +0,0 @@
|
||||
/* Copyright 1994 - 2000 by Abacus Research and
|
||||
* Development, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#if !defined (OMIT_RCSID_STRINGS)
|
||||
char ROMlib_rcsid_license[] =
|
||||
"$Id: license.c 137 2006-07-10 21:25:07Z ctm $";
|
||||
#endif
|
||||
|
||||
#include "rsys/common.h"
|
||||
|
||||
#include "DialogMgr.h"
|
||||
#include "OSUtil.h"
|
||||
#include "SysErr.h"
|
||||
#include "ResourceMgr.h"
|
||||
#include "BinaryDecimal.h"
|
||||
#include "SegmentLdr.h"
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
#include "rsys/arrowkeys.h"
|
||||
#include "rsys/aboutpanel.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/keycode.h"
|
||||
#include "rsys/pstuff.h"
|
||||
#include "rsys/next.h"
|
||||
#include "rsys/licensetext.h"
|
||||
#include "rsys/segment.h"
|
||||
#include "rsys/vdriver.h"
|
||||
#include "rsys/custom.h"
|
||||
#include "rsys/string.h"
|
||||
#include "rsys/osevent.h"
|
||||
|
||||
which_license_t ROMlib_dolicense = no_license;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REGISTER_OK_ITEM = 1,
|
||||
REGISTER_CANCEL_ITEM,
|
||||
REGISTER_NAME_ITEM,
|
||||
REGISTER_ORGANIZATION_ITEM,
|
||||
REGISTER_SN_ITEM,
|
||||
REGISTER_KEY_ITEM,
|
||||
REGISTER_MESSAGE_ITEM,
|
||||
REGISTER_NAME_LABEL,
|
||||
REGISTER_ORGANIZATION_LABEL,
|
||||
REGISTER_SN_LABEL,
|
||||
REGISTER_KEY_LABEL,
|
||||
REGISTER_COPYRIGHT_NOTICE,
|
||||
REGISTER_INSTRUCTIONS,
|
||||
REGISTER_THANK_YOU,
|
||||
} register_items_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LICENSE_NEXT_ITEM = 1,
|
||||
LICENSE_HEADING_ITEM,
|
||||
LICENSE_BODY_ITEM,
|
||||
LICENSE_OK_ITEM,
|
||||
LICENSE_PREVIOUS_ITEM,
|
||||
} license_items_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REGISTER_DIAL_ID= -4065,
|
||||
} license_id_t;
|
||||
|
||||
typedef enum { dim, undim } operation_t;
|
||||
|
||||
PRIVATE void modify_item(operation_t op, DialogPtr dp, license_items_t item)
|
||||
{
|
||||
HIDDEN_Handle h;
|
||||
INTEGER type;
|
||||
Rect r;
|
||||
BOOLEAN need_to_change;
|
||||
|
||||
GetDItem(dp, item, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
need_to_change = FALSE;
|
||||
switch (op) {
|
||||
case dim:
|
||||
if (!(type & CWC(itemDisable))) {
|
||||
need_to_change = TRUE;
|
||||
type |= CWC(itemDisable);
|
||||
HiliteControl((ControlHandle) h.p, 255);
|
||||
}
|
||||
break;
|
||||
case undim:
|
||||
if (type & CWC(itemDisable)) {
|
||||
need_to_change = TRUE;
|
||||
type &= ~CWC(itemDisable);
|
||||
HiliteControl((ControlHandle) h.p, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (need_to_change)
|
||||
SetDItem(dp, item, CW(type), h.p, &r);
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
right_justify (DialogPtr dp, INTEGER item)
|
||||
{
|
||||
INTEGER type;
|
||||
HIDDEN_Handle h;
|
||||
Rect r;
|
||||
int len;
|
||||
enum { JUSTIFY_SLOP = 6 };
|
||||
|
||||
GetDItem (dp, item, &type, &h, &r);
|
||||
h.p = MR (h.p);
|
||||
len = TextWidth (STARH (h.p), 0, GetHandleSize (h.p));
|
||||
r.left = CW (CW (r.right) - len - JUSTIFY_SLOP);
|
||||
SetDItem (dp, item, CW(type), h.p, &r);
|
||||
InvalRect (&r);
|
||||
}
|
||||
|
||||
const char *updatetext =
|
||||
"Number of CPUs: xxx\nLast free update: yyy.zzz\nExpires: www/vvv";
|
||||
|
||||
PRIVATE void updatemessage(DialogPtr dp, INTEGER valid_p,
|
||||
decoded_info_t *infop)
|
||||
{
|
||||
HIDDEN_Handle h;
|
||||
INTEGER type;
|
||||
Rect r;
|
||||
Str255 s;
|
||||
INTEGER pos;
|
||||
|
||||
if (valid_p)
|
||||
modify_item(undim, dp, REGISTER_OK_ITEM);
|
||||
/* TODO: Hilight ok button */
|
||||
else
|
||||
modify_item(dim, dp, REGISTER_OK_ITEM);
|
||||
|
||||
GetDItem(dp, REGISTER_MESSAGE_ITEM, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
if (!infop)
|
||||
{
|
||||
#if !defined (RELEASE_COMMERCIAL)
|
||||
pos = 1 + sprintf((char *) s + 1, "This is a demo version");
|
||||
#else
|
||||
pos = 0;
|
||||
#endif
|
||||
s[0] = pos;
|
||||
SetIText(h.p, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = 1;
|
||||
pos += sprintf((char *) s+pos,
|
||||
"Number of CPUs: %ld\r", (long) infop->n_cpu);
|
||||
if (!ROMlib_creatorsp)
|
||||
{
|
||||
pos += sprintf((char *) s+pos,
|
||||
"Last free update: %d", infop->major_revision);
|
||||
pos += sprintf((char *) s+pos,
|
||||
".%s\r", infop->updates_p ? "*" : "0");
|
||||
}
|
||||
if (infop->expires_p)
|
||||
pos += sprintf((char *) s+pos, "Expires: %d/%d", infop->last_month,
|
||||
infop->last_year);
|
||||
s[0] = pos;
|
||||
SetIText(h.p, s);
|
||||
}
|
||||
InvalRect(&r);
|
||||
|
||||
{
|
||||
StringPtr sp;
|
||||
Str255 str;
|
||||
|
||||
GetDItem(dp, REGISTER_COPYRIGHT_NOTICE, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
if (!ROMlib_copyright_infop)
|
||||
sp = (StringPtr) "\073Copyright \251 1986-2006 "
|
||||
"Abacus Research and Development, Inc.";
|
||||
else
|
||||
{
|
||||
str255_from_c_string (str, (char *) ROMlib_copyright_infop->chars);
|
||||
sp = str;
|
||||
}
|
||||
SetIText(h.p, sp);
|
||||
InvalRect(&r);
|
||||
}
|
||||
if (ROMlib_thank_you_infop)
|
||||
{
|
||||
Str255 str;
|
||||
|
||||
GetDItem(dp, REGISTER_THANK_YOU, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
str255_from_c_string (str, (char *) ROMlib_thank_you_infop->chars);
|
||||
SetIText(h.p, str);
|
||||
InvalRect(&r);
|
||||
}
|
||||
if (ROMlib_registration_instructionsp)
|
||||
{
|
||||
Str255 str;
|
||||
|
||||
GetDItem(dp, REGISTER_INSTRUCTIONS, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
str255_from_c_string (str,
|
||||
(char *) ROMlib_registration_instructionsp->chars);
|
||||
SetIText(h.p, str);
|
||||
InvalRect(&r);
|
||||
}
|
||||
right_justify (dp, REGISTER_NAME_LABEL);
|
||||
right_justify (dp, REGISTER_ORGANIZATION_LABEL);
|
||||
right_justify (dp, REGISTER_SN_LABEL);
|
||||
right_justify (dp, REGISTER_KEY_LABEL);
|
||||
}
|
||||
|
||||
#define KEYLENGTH 13
|
||||
PRIVATE INTEGER checkkeychange(DialogPtr dp, EventRecord *ev, char ch)
|
||||
{
|
||||
TEHandle teh;
|
||||
|
||||
switch(ch)
|
||||
{
|
||||
case '\177': case '\010': case '\t':
|
||||
case ASCIILEFTARROW: case ASCIIRIGHTARROW: case ASCIIUPARROW:
|
||||
case ASCIIDOWNARROW:
|
||||
/*--*/ return FALSE;
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||
case 'p': case 'q': case 'r': case 's': case 't':
|
||||
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||
case 'z':
|
||||
break;
|
||||
default:
|
||||
ParamText((StringPtr) "\077Authentication Keys contain only digits and lower-case letters.",
|
||||
0, 0, 0);
|
||||
CautionAlert(GENERIC_COMPLAINT_ID, (ProcPtr) 0);
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
teh = MR(((DialogPeek) dp)->textH);
|
||||
if (Hx(teh, teLength) >= KEYLENGTH && Hx(teh, selEnd) == Hx(teh, selStart))
|
||||
{
|
||||
/* FIXME: 13 is a constant in the text below. */
|
||||
ParamText((StringPtr) "\041Keys are only 13 characters long.", 0, 0, 0);
|
||||
CautionAlert(GENERIC_COMPLAINT_ID, (ProcPtr) 0);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#define SNLENGTH 10
|
||||
PRIVATE INTEGER checksnchange(DialogPtr dp, EventRecord *ev, char ch)
|
||||
{
|
||||
TEHandle teh;
|
||||
|
||||
switch(ch)
|
||||
{
|
||||
case '\177': case '\010': case '\t':
|
||||
case ASCIILEFTARROW: case ASCIIRIGHTARROW: case ASCIIUPARROW:
|
||||
case ASCIIDOWNARROW:
|
||||
/*--*/ return FALSE;
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
break;
|
||||
default:
|
||||
ParamText((StringPtr) "\043Serial Numbers contain only digits.",
|
||||
0, 0, 0);
|
||||
CautionAlert(GENERIC_COMPLAINT_ID, (ProcPtr) 0);
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
teh = MR(((DialogPeek) dp)->textH);
|
||||
if (Hx(teh, teLength) >= SNLENGTH && Hx(teh, selEnd) == Hx(teh, selStart))
|
||||
{
|
||||
/* FIXME: 10 is a constant in the text below. */
|
||||
ParamText((StringPtr) "\051Serial Numbers are at most "
|
||||
"10 digits long.", 0, 0, 0);
|
||||
CautionAlert(GENERIC_COMPLAINT_ID, (ProcPtr) 0);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
P3(PUBLIC, pascal INTEGER, ROMlib_licensefilt, DialogPeek, dp,
|
||||
EventRecord *, ev, INTEGER *, ith)
|
||||
{
|
||||
char ch;
|
||||
TEHandle teh;
|
||||
|
||||
switch (ev->what)
|
||||
{
|
||||
case CWC(keyDown):
|
||||
case CWC(autoKey):
|
||||
ch = CL(ev->message) & 0xFF;
|
||||
teh = MR(dp->textH);
|
||||
if (ev->modifiers & CW(cmdKey))
|
||||
{
|
||||
switch(ch) {
|
||||
case 'c':
|
||||
TECopy(teh);
|
||||
break;
|
||||
case 'v':
|
||||
TEPaste(teh);
|
||||
#if 0 /* TODO */
|
||||
/* FIXME */
|
||||
checkvalue(? ? ?);
|
||||
#endif /* 0 */
|
||||
break;
|
||||
case 'x':
|
||||
TECut(teh);
|
||||
break;
|
||||
default:
|
||||
SysBeep(1);
|
||||
break;
|
||||
}
|
||||
/*--*/ return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ch == '\n' || ch == '\r' || ch == NUMPAD_ENTER)
|
||||
{
|
||||
*ith = CWC(REGISTER_OK_ITEM);
|
||||
/*-->*/ return -1;
|
||||
}
|
||||
switch (CW(dp->editField) + 1)
|
||||
{
|
||||
case REGISTER_SN_ITEM:
|
||||
return checksnchange((DialogPtr) dp, ev, ch);
|
||||
break;
|
||||
case REGISTER_KEY_ITEM:
|
||||
return checkkeychange((DialogPtr) dp, ev, ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CWC(updateEvt):
|
||||
ROMlib_circledefault((DialogPtr)dp);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PRIVATE void get_dp_item_text(DialogPtr dp, INTEGER item, Str255 retstring)
|
||||
{
|
||||
HIDDEN_Handle h;
|
||||
INTEGER type;
|
||||
Rect r;
|
||||
|
||||
GetDItem(dp, item, &type, &h, &r);
|
||||
GetIText(MR(h.p), retstring);
|
||||
}
|
||||
|
||||
PRIVATE int validcode(DialogPtr dp, decoded_info_t *info, Str255 userkey)
|
||||
{
|
||||
LONGINT sn;
|
||||
Str255 s;
|
||||
|
||||
get_dp_item_text(dp, REGISTER_SN_ITEM, s);
|
||||
StringToNum(s, &sn);
|
||||
if ( decode(userkey + 1, info) && (info->serial_number == sn))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PRIVATE INTEGER validexit(DialogPtr dp, INTEGER ihit, INTEGER valid_p)
|
||||
{
|
||||
Str255 s;
|
||||
|
||||
if (ihit == CWC(REGISTER_CANCEL_ITEM))
|
||||
/*-->*/ return TRUE;
|
||||
else if (ihit == CWC(REGISTER_OK_ITEM))
|
||||
{
|
||||
if (!valid_p)
|
||||
/*-->*/ return FALSE;
|
||||
get_dp_item_text(dp, REGISTER_NAME_ITEM, s);
|
||||
if (s[0] < 1)
|
||||
{
|
||||
ParamText((StringPtr) "\027Please enter your name.", 0, 0, 0);
|
||||
StopAlert(GENERIC_COMPLAINT_ID, (ProcPtr) 0);
|
||||
/*-->*/ return FALSE;
|
||||
}
|
||||
else
|
||||
/*-->*/ return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PRIVATE void SetI_c_string(Handle h, const char *name)
|
||||
{
|
||||
Str255 s;
|
||||
|
||||
s[0] = strlen(name);
|
||||
memcpy(s+1, name, s[0]);
|
||||
SetIText(h, s);
|
||||
}
|
||||
|
||||
PRIVATE void lockinfo(DialogPtr dp, LONGINT sn, const char *name,
|
||||
const char *organization)
|
||||
{
|
||||
HIDDEN_Handle h;
|
||||
INTEGER type;
|
||||
Rect r;
|
||||
Str255 s;
|
||||
|
||||
GetDItem(dp, REGISTER_SN_ITEM, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
NumToString(sn, s);
|
||||
SetIText(h.p, s);
|
||||
SetDItem(dp, REGISTER_SN_ITEM, statText | itemDisable, h.p, &r);
|
||||
|
||||
GetDItem(dp, REGISTER_NAME_ITEM, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
SetI_c_string(h.p, name);
|
||||
SetDItem(dp, REGISTER_NAME_ITEM, statText | itemDisable, h.p, &r);
|
||||
|
||||
GetDItem(dp, REGISTER_ORGANIZATION_ITEM, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
SetI_c_string(h.p, organization);
|
||||
SetDItem(dp, REGISTER_ORGANIZATION_ITEM, statText | itemDisable, h.p, &r);
|
||||
}
|
||||
|
||||
PRIVATE void clear_item_text(DialogPtr dp, INTEGER itemno)
|
||||
{
|
||||
HIDDEN_Handle h;
|
||||
INTEGER type;
|
||||
Rect r;
|
||||
|
||||
GetDItem(dp, itemno, &type, &h, &r);
|
||||
h.p = MR(h.p);
|
||||
SetIText(h.p, (StringPtr) "");
|
||||
SetDItem(dp, itemno, CW(type), h.p, &r);
|
||||
}
|
||||
|
||||
PRIVATE void get_dp_item_c_string(DialogPtr dp, INTEGER item, char *stringp,
|
||||
int string_length)
|
||||
{
|
||||
Str255 temp_text;
|
||||
|
||||
get_dp_item_text(dp, item, temp_text);
|
||||
if (temp_text[0] >= string_length)
|
||||
temp_text[0] = string_length-1;
|
||||
|
||||
/* FIXME - use a subroutine to convert pascal string to C string */
|
||||
strncpy(stringp, (char *) temp_text + 1, temp_text[0]);
|
||||
stringp[temp_text[0]] = 0;
|
||||
}
|
||||
|
||||
PRIVATE void doregistration( void )
|
||||
{
|
||||
DialogPtr dp;
|
||||
INTEGER ihit;
|
||||
Str255 userkey;
|
||||
decoded_info_t info, default_info, *default_infop;
|
||||
INTEGER valid_p;
|
||||
INTEGER start_sel;
|
||||
|
||||
dp = GetNewDialog(REGISTER_DIAL_ID, (Ptr) 0, (WindowPtr) -1);
|
||||
|
||||
default_infop = 0;
|
||||
if (ROMlib_info.serialnumber)
|
||||
{
|
||||
clear_item_text(dp, REGISTER_KEY_ITEM);
|
||||
start_sel = REGISTER_KEY_ITEM;
|
||||
lockinfo(dp, ROMlib_info.serialnumber, ROMlib_info.name,
|
||||
ROMlib_info.organization);
|
||||
if ( decode((unsigned char *) ROMlib_info.key, &default_info)
|
||||
&& (default_info.serial_number == ROMlib_info.serialnumber))
|
||||
default_infop = &default_info;
|
||||
}
|
||||
else
|
||||
{
|
||||
clear_item_text(dp, REGISTER_NAME_ITEM);
|
||||
clear_item_text(dp, REGISTER_ORGANIZATION_ITEM);
|
||||
clear_item_text(dp, REGISTER_SN_ITEM);
|
||||
clear_item_text(dp, REGISTER_KEY_ITEM);
|
||||
start_sel = REGISTER_NAME_ITEM;
|
||||
}
|
||||
SelIText(dp, start_sel, 0, 32767);
|
||||
|
||||
valid_p = FALSE;
|
||||
modify_item(dim, dp, REGISTER_OK_ITEM);
|
||||
ROMlib_circledefault(dp);
|
||||
ShowWindow(dp);
|
||||
SetPort(dp);
|
||||
|
||||
updatemessage(dp, FALSE, default_infop);
|
||||
do
|
||||
{
|
||||
ModalDialog((ProcPtr) P_ROMlib_licensefilt, &ihit);
|
||||
get_dp_item_text(dp, REGISTER_KEY_ITEM, userkey);
|
||||
/* these next two lines won't be needed once the filterproc is added */
|
||||
if (userkey[0] == 255)
|
||||
userkey[0] = 254;
|
||||
userkey[userkey[0] + 1] = 0;
|
||||
if (valid_key_format(userkey + 1) && validcode(dp, &info, userkey))
|
||||
{
|
||||
if (!valid_p)
|
||||
{
|
||||
updatemessage(dp, TRUE, &info);
|
||||
valid_p = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (valid_p)
|
||||
{
|
||||
updatemessage(dp, FALSE, default_infop);
|
||||
valid_p = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!validexit(dp, ihit, valid_p));
|
||||
if (ihit != CWC(REGISTER_OK_ITEM))
|
||||
{
|
||||
ROMlib_exit = 1;
|
||||
C_ExitToShell ();
|
||||
}
|
||||
else
|
||||
{
|
||||
char temp_name[81];
|
||||
char temp_org[81];
|
||||
char temp_key[14]; /* FIXME hardcoded numbers */
|
||||
|
||||
|
||||
#if 0
|
||||
#if !defined(NEXTSTEP)
|
||||
ParamText("\070Executor will now exit and be registered when restarted.",
|
||||
0, 0, 0);
|
||||
#else
|
||||
ParamText("\072Executor will now exit, then you must run it once as root.",
|
||||
0, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
if (!ROMlib_restart_stringp)
|
||||
ParamText((StringPtr) "\070Executor will now exit and "
|
||||
"be registered when restarted.",
|
||||
0, 0, 0);
|
||||
else
|
||||
{
|
||||
Str255 str;
|
||||
|
||||
str255_from_c_string (str, (char *) ROMlib_restart_stringp->chars);
|
||||
ParamText(str, 0, 0, 0);
|
||||
}
|
||||
|
||||
NoteAlert(GENERIC_COMPLAINT_ID, (ProcPtr) 0);
|
||||
get_dp_item_c_string(dp, REGISTER_NAME_ITEM,
|
||||
temp_name, sizeof(temp_name));
|
||||
|
||||
get_dp_item_c_string(dp, REGISTER_ORGANIZATION_ITEM,
|
||||
temp_org, sizeof(temp_org));
|
||||
|
||||
|
||||
get_dp_item_c_string(dp, REGISTER_KEY_ITEM,
|
||||
temp_key, sizeof(temp_key));
|
||||
|
||||
ROMlib_info.serialnumber = info.serial_number;
|
||||
ROMlib_writenameorgkey(temp_name, temp_org, temp_key);
|
||||
}
|
||||
DisposDialog(dp);
|
||||
}
|
||||
|
||||
PUBLIC void dolicense( void )
|
||||
{
|
||||
if (ROMlib_dolicense != no_license)
|
||||
{
|
||||
if (WWExist != EXIST_YES)
|
||||
{
|
||||
SysBeep (5);
|
||||
vdriver_shutdown ();
|
||||
fprintf (stderr, "Error: could not display registration panel!\n");
|
||||
ROMlib_exit = 1;
|
||||
C_ExitToShell ();
|
||||
}
|
||||
else if (ROMlib_dolicense == register_only)
|
||||
{
|
||||
doregistration ();
|
||||
ROMlib_exit = 1;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,8 +10,6 @@ char ROMlib_rcsid_licensetext[] =
|
||||
|
||||
#include "rsys/common.h"
|
||||
|
||||
#if defined (DISPLAY_SPLASH_INFO_BOX) || defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
|
||||
#include "rsys/licensetext.h"
|
||||
|
||||
license_text_page_t ROMlib_license[] =
|
||||
@ -246,5 +244,4 @@ license_text_page_t ROMlib_license[] =
|
||||
{ NULL, NULL }, /* array terminator */
|
||||
};
|
||||
|
||||
#endif /* DISPLAY_SPLASH_INFO_BOX || SUPPORT_ABOUT_EXECUTOR_BOX */
|
||||
#endif
|
||||
|
520
src/main.c
520
src/main.c
@ -62,7 +62,6 @@ char ROMlib_rcsid_main[] =
|
||||
#include "rsys/blockinterrupts.h"
|
||||
#include "rsys/rgbutil.h"
|
||||
#include "rsys/refresh.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/executor.h"
|
||||
#include "rsys/wind.h"
|
||||
#include "rsys/osevent.h"
|
||||
@ -145,23 +144,8 @@ char *ROMlib_xfervmaddr;
|
||||
LONGINT ROMlib_xfervmsize = 0;
|
||||
#endif /* NEXTSTEP */
|
||||
|
||||
infoblock ROMlib_info =
|
||||
{
|
||||
INFO_START_STRING,
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
PUBLIC int ROMlib_noclock = 0;
|
||||
|
||||
#if defined (DISPLAY_SPLASH_INFO_BOX)
|
||||
PUBLIC int ROMlib_nosplash = 0;
|
||||
#endif
|
||||
|
||||
#if defined (NOMOUSE_COMMAND_LINE_OPTION)
|
||||
PUBLIC int ROMlib_no_mouse = 1;
|
||||
#endif
|
||||
@ -315,10 +299,6 @@ static option_t common_opts[] =
|
||||
{ "noclock", "disable timer", opt_no_arg, NULL },
|
||||
#endif
|
||||
|
||||
#if defined (DISPLAY_SPLASH_INFO_BOX)
|
||||
{ "nosplash", "skip splash screen", opt_no_arg, NULL },
|
||||
#endif
|
||||
|
||||
#if defined (NOMOUSE_COMMAND_LINE_OPTION)
|
||||
/* Hack Dr. Chung wanted */
|
||||
{ "nomouse", "ignore missing mouse", opt_no_arg, NULL },
|
||||
@ -543,353 +523,8 @@ PUBLIC char *ROMlib_appname;
|
||||
|
||||
#define APPWRAP "/Executor.app"
|
||||
|
||||
PRIVATE void maskkey( void )
|
||||
{
|
||||
unsigned char *p, *ep;
|
||||
|
||||
for (p = (unsigned char *) &ROMlib_info.info_start_string
|
||||
+ sizeof(ROMlib_info.info_start_string),
|
||||
ep = (unsigned char *) &ROMlib_info + sizeof(ROMlib_info);
|
||||
p < ep; *p++ ^= 0xA5)
|
||||
;
|
||||
}
|
||||
|
||||
PRIVATE void byteswapinfo(infoblock *infop)
|
||||
{
|
||||
infop->serialnumber = CL(infop->serialnumber);
|
||||
infop->inodenumber = CL(infop->inodenumber);
|
||||
infop->timechanged = CL(infop->timechanged);
|
||||
}
|
||||
|
||||
#if !defined (NEXTSTEP)
|
||||
enum { N_COOKIES = 1 };
|
||||
#else
|
||||
enum { N_COOKIES = 2 };
|
||||
#endif
|
||||
|
||||
PRIVATE void
|
||||
copy_with_cookie_substitution (FILE *read_fp, FILE *write_fp)
|
||||
{
|
||||
int n_subs_made;
|
||||
int c;
|
||||
|
||||
for (n_subs_made = 0; n_subs_made < N_COOKIES; ++n_subs_made)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
c = fgetc(read_fp);
|
||||
if (write_fp != read_fp && c != EOF)
|
||||
if (fputc(c, write_fp) == EOF)
|
||||
{
|
||||
fprintf(stderr, "trouble writing\n");
|
||||
exit(3);
|
||||
}
|
||||
if (c == ROMlib_info.info_start_string[i])
|
||||
++i;
|
||||
else
|
||||
i = 0;
|
||||
}
|
||||
while (i != sizeof(ROMlib_info.info_start_string) && c != EOF);
|
||||
|
||||
if (c == EOF)
|
||||
{
|
||||
if (n_subs_made == 0)
|
||||
{
|
||||
fprintf(stderr, "Couldn't find cookie; unable to register.\n");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
long offset;
|
||||
struct stat sbuf;
|
||||
|
||||
offset = ftell(write_fp) - sizeof(ROMlib_info.info_start_string);
|
||||
|
||||
if (write_fp == read_fp)
|
||||
{
|
||||
|
||||
/* This seek may not be needed, but it appears that
|
||||
NEXTSTEP gets confused if we don't do this */
|
||||
|
||||
if (fseek(read_fp, (offset
|
||||
+ sizeof(ROMlib_info.info_start_string)),
|
||||
SEEK_SET) == -1)
|
||||
{
|
||||
fprintf(stderr, "bizarre seek problem\n");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
byteswapinfo(&ROMlib_info);
|
||||
if (fwrite((char *)
|
||||
&ROMlib_info + sizeof(ROMlib_info.info_start_string),
|
||||
sizeof(ROMlib_info)
|
||||
- sizeof(ROMlib_info.info_start_string), 1, write_fp)
|
||||
!= 1)
|
||||
{
|
||||
fprintf(stderr, "couldn't fwrite\n");
|
||||
/* exit(11); */
|
||||
}
|
||||
byteswapinfo(&ROMlib_info);
|
||||
if (fseek(write_fp, offset, SEEK_SET) == -1)
|
||||
{
|
||||
fprintf(stderr, "couldn't seek to lowseg\n");
|
||||
exit(12);
|
||||
}
|
||||
if (fflush(write_fp) == EOF)
|
||||
{
|
||||
fprintf(stderr, "couldn't fflush\n");
|
||||
exit(13);
|
||||
}
|
||||
fsync(fileno(write_fp));
|
||||
if (fstat(fileno(write_fp), &sbuf) < 0)
|
||||
{
|
||||
fprintf(stderr, "couldn't fstat\n");
|
||||
exit(14);
|
||||
}
|
||||
ROMlib_info.timechanged = sbuf.st_mtime;
|
||||
ROMlib_info.inodenumber = ST_INO (sbuf);
|
||||
byteswapinfo(&ROMlib_info);
|
||||
maskkey();
|
||||
if (fwrite(&ROMlib_info, sizeof(ROMlib_info), 1, write_fp) != 1)
|
||||
{
|
||||
fprintf(stderr, "couldn't fwrite\n");
|
||||
/* exit(15); */
|
||||
}
|
||||
maskkey();
|
||||
byteswapinfo(&ROMlib_info);
|
||||
|
||||
if (write_fp == read_fp)
|
||||
{
|
||||
|
||||
/* This seek may not be needed, but it appears that
|
||||
NEXTSTEP gets confused if we don't do this */
|
||||
|
||||
if (fseek(read_fp, (offset
|
||||
+ sizeof(ROMlib_info.info_start_string)),
|
||||
SEEK_SET) == -1)
|
||||
{
|
||||
fprintf(stderr, "bizarre seek problem\n");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fseek(read_fp,
|
||||
sizeof(ROMlib_info)
|
||||
- sizeof(ROMlib_info.info_start_string), SEEK_CUR)
|
||||
== -1)
|
||||
{
|
||||
fprintf(stderr, "bizarre seek problem\n");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (write_fp != read_fp)
|
||||
while ((c = fgetc(read_fp)) != EOF)
|
||||
if (fputc(c, write_fp) == EOF)
|
||||
{
|
||||
fprintf(stderr, "trouble writing\n");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
complain_and_die_because_not_writeable (const char *verb,
|
||||
const char *file,
|
||||
const char *errno_string)
|
||||
{
|
||||
char errmsg[2048];
|
||||
|
||||
sprintf (errmsg,
|
||||
"Registration failed: \"%s\". "
|
||||
"This application needs to %s %s during the "
|
||||
"registration process, but is unable to do so. "
|
||||
"This means either that you are running this application "
|
||||
"from a CD-ROM (or other write-protected medium), "
|
||||
"or that you do not have permission to modify "
|
||||
"this application. Make sure this application is installed on "
|
||||
"a hard drive before you try to run it.",
|
||||
errno_string, verb, file);
|
||||
|
||||
system_error (errmsg, 0,
|
||||
"Exit", NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
A3(PUBLIC, void, ROMlib_writenameorgkey, char *, name, char *, org,
|
||||
char *, key)
|
||||
{
|
||||
FILE *read_fp, *write_fp;
|
||||
char *orig_file_name, *new_file_name;
|
||||
|
||||
#if !defined (CYGWIN32)
|
||||
char *backup_file_name;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On Linux Executor can't open itself for writing, so we make a temporary copy
|
||||
* of ourselves by putting a '.' before our name. This won't work on DOS, but
|
||||
* I don't think it's needed there, either.
|
||||
*/
|
||||
|
||||
new_file_name = 0;
|
||||
|
||||
orig_file_name = alloca(ROMlib_startdirlen + 1
|
||||
+ strlen(ROMlib_appname) + 1);
|
||||
sprintf(orig_file_name, "%s/%s", ROMlib_startdir, ROMlib_appname);
|
||||
|
||||
#if defined (MSDOS)
|
||||
/* fopen in read/write mode can succeed under MSDOS even when the
|
||||
* file isn't writeable (as when run off the CD-ROM). This check
|
||||
* works, however.
|
||||
*/
|
||||
if (access (orig_file_name, W_OK))
|
||||
complain_and_die_because_not_writeable ("modify", orig_file_name,
|
||||
strerror (errno));
|
||||
#endif
|
||||
|
||||
#if !defined(LETGCCWAIL)
|
||||
new_file_name = 0;
|
||||
#endif
|
||||
if ((write_fp = Ufopen(orig_file_name, "r+b")))
|
||||
{
|
||||
read_fp = write_fp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((read_fp = Ufopen(orig_file_name, "rb")))
|
||||
{
|
||||
struct stat sbuf;
|
||||
|
||||
new_file_name = alloca(ROMlib_startdirlen + 1 + 1
|
||||
+ strlen(ROMlib_appname) + 1);
|
||||
sprintf(new_file_name, "%s/.%s", ROMlib_startdir, ROMlib_appname);
|
||||
|
||||
/* Fetch original permission bits. */
|
||||
if (Ustat(orig_file_name, &sbuf))
|
||||
errno_fatal ("Unable to stat %s", orig_file_name);
|
||||
|
||||
/* Open the new file for writing. */
|
||||
write_fp = Ufopen(new_file_name, "wb");
|
||||
if (write_fp == NULL)
|
||||
complain_and_die_because_not_writeable ("create",
|
||||
new_file_name,
|
||||
strerror (errno));
|
||||
|
||||
/* Copy permission bits. */
|
||||
if (Uchmod(new_file_name, sbuf.st_mode))
|
||||
errno_fatal ("Unable to chmod %s", new_file_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
errno_fatal ("Couldn't open %s for reading", orig_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(ROMlib_info.name, name, sizeof(ROMlib_info.name));
|
||||
strncpy(ROMlib_info.organization, org, sizeof(ROMlib_info.organization));
|
||||
strncpy(ROMlib_info.key, key, sizeof(ROMlib_info.key));
|
||||
|
||||
copy_with_cookie_substitution (read_fp, write_fp);
|
||||
|
||||
fsync(fileno(write_fp));
|
||||
if (fclose(write_fp) == EOF)
|
||||
{
|
||||
if (write_fp != read_fp)
|
||||
{
|
||||
fclose(read_fp);
|
||||
unlink(orig_file_name);
|
||||
fprintf(stderr, "trouble closing file\n");
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
#if !defined (CYGWIN32)
|
||||
else
|
||||
{
|
||||
if (write_fp != read_fp)
|
||||
{
|
||||
boolean_t failed_p;
|
||||
|
||||
#define BACKUP_SUFFIX ".old"
|
||||
backup_file_name = alloca(strlen(orig_file_name)
|
||||
+ sizeof(BACKUP_SUFFIX));
|
||||
sprintf(backup_file_name, "%s%s", orig_file_name, BACKUP_SUFFIX);
|
||||
unlink(backup_file_name); /* No need to check for error here. */
|
||||
|
||||
failed_p = (Ulink (orig_file_name, backup_file_name) != 0);
|
||||
if (failed_p)
|
||||
warning_errno ("Unable to link \"%s\" to \"%s\".",
|
||||
orig_file_name, backup_file_name);
|
||||
else
|
||||
{
|
||||
failed_p = (unlink (orig_file_name) != 0);
|
||||
if (failed_p)
|
||||
warning_errno ("Unable to unlink \"%s\"\n", orig_file_name);
|
||||
}
|
||||
|
||||
if (failed_p)
|
||||
{
|
||||
fprintf(stderr, "Unable to move \"%s\" to \"%s\"\n"
|
||||
"New file left as \"%s\"\n", orig_file_name,
|
||||
backup_file_name, new_file_name);
|
||||
exit(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ulink (new_file_name, orig_file_name) != 0)
|
||||
{
|
||||
warning_errno ("Unable to link \"%s\" to \"%s\".\n",
|
||||
new_file_name, orig_file_name);
|
||||
Ulink (backup_file_name, orig_file_name);
|
||||
fprintf(stderr, "Unable to move \"%s\" to \"%s\"\n"
|
||||
"New file left as \"%s\"\n", new_file_name,
|
||||
orig_file_name, new_file_name);
|
||||
exit(3);
|
||||
}
|
||||
unlink(new_file_name);
|
||||
/* unlink(backup_file_name); This just doesn't work. */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (CYGWIN32)
|
||||
if (new_file_name)
|
||||
add_to_cleanup ("\"%s\\exemove\" \"%s\" \"%s\"\n", ROMlib_startdir,
|
||||
new_file_name, orig_file_name);
|
||||
#endif
|
||||
|
||||
/* TODO: explain why Executor is quitting and state that the registration
|
||||
process has succeeded if it has */
|
||||
ROMlib_exit = 1;
|
||||
C_ExitToShell();
|
||||
}
|
||||
|
||||
ULONGINT ROMlib_ourmtime;
|
||||
|
||||
/*
|
||||
* TODO: change printf to some sort of alert thing.
|
||||
*/
|
||||
|
||||
PRIVATE void revert_to_demo_mode( const char *stringp )
|
||||
{
|
||||
#if 0
|
||||
#if !defined (REGISTER_BEFORE_USABLE)
|
||||
fprintf(stderr, "Reverting to demo mode: %s\n", stringp);
|
||||
#else
|
||||
fprintf(stderr, "Reverting to unregistered mode: %s\n", stringp);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ROMlib_info.serialnumber = 0;
|
||||
}
|
||||
|
||||
#if defined (NEXTSTEP)
|
||||
|
||||
#if !defined (STRICT_OPENSTEP)
|
||||
@ -1023,144 +658,6 @@ A1(PRIVATE, void, misc_self_examination, char *, us)
|
||||
}
|
||||
#endif /* defined (NEXTSTEP) */
|
||||
|
||||
PRIVATE boolean_t
|
||||
valid_sn_for_this_platform (unsigned long sn)
|
||||
{
|
||||
boolean_t retval;
|
||||
|
||||
retval = FALSE;
|
||||
|
||||
if (ROMlib_first_snp && ROMlib_last_snp)
|
||||
retval = sn >= ROMlib_first_snp->val && sn <= ROMlib_last_snp->val;
|
||||
else
|
||||
{
|
||||
int platform;
|
||||
|
||||
platform = sn % PLATFORM_MOD;
|
||||
|
||||
#if defined(CYGWIN32)
|
||||
if (platform == PLATFORM_DOS)
|
||||
retval = TRUE;
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS)
|
||||
if (platform == PLATFORM_CYGWIN32)
|
||||
retval = TRUE;
|
||||
#endif
|
||||
|
||||
if (platform == VERSION_SIG || platform == PLATFORM_ANY)
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline void
|
||||
info_after_hook (void)
|
||||
{
|
||||
/* dummy hook so we can break here in gdb and set
|
||||
`ROMlib_info.serial_number' to fully enable executor */
|
||||
|
||||
#if defined (RELEASE_INTERNAL)
|
||||
ROMlib_info.serialnumber = 3;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
A1(PRIVATE, void, readinfo, char *, us)
|
||||
{
|
||||
struct stat sbuf;
|
||||
decoded_info_t info;
|
||||
|
||||
if (us[0] == 0)
|
||||
{
|
||||
fprintf (stderr, "don't know where we're being run from\n");
|
||||
exit (10);
|
||||
}
|
||||
if (Ustat(us, &sbuf) < 0)
|
||||
{
|
||||
#ifdef CYGWIN32
|
||||
#define EXE_SUFFIX ".exe"
|
||||
{
|
||||
char *us_plus_exe;
|
||||
|
||||
us_plus_exe = alloca(strlen(us)+strlen(EXE_SUFFIX)+1);
|
||||
sprintf(us_plus_exe, "%s%s", us, EXE_SUFFIX);
|
||||
if (Ustat(us_plus_exe, &sbuf) < 0)
|
||||
{
|
||||
fprintf(stderr, "couldn't stat \"%s\" or \"%s\"\n", us,
|
||||
us_plus_exe);
|
||||
exit(10);
|
||||
}
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "couldn't stat \"%s\"\n", us);
|
||||
exit(10);
|
||||
#endif
|
||||
}
|
||||
ROMlib_ourmtime = sbuf.st_mtime;
|
||||
if (ROMlib_info.serialnumber)
|
||||
{
|
||||
maskkey();
|
||||
byteswapinfo(&ROMlib_info);
|
||||
if (decode((unsigned char *) ROMlib_info.key, &info)
|
||||
&& info.serial_number == ROMlib_info.serialnumber)
|
||||
{
|
||||
struct tm *tmp;
|
||||
unsigned int this_year, this_month;
|
||||
time_t t;
|
||||
|
||||
time(&t);
|
||||
tmp = localtime(&t);
|
||||
this_year = tmp->tm_year + 1900;
|
||||
this_month = tmp->tm_mon + 1;
|
||||
|
||||
if (!valid_sn_for_this_platform(ROMlib_info.serialnumber))
|
||||
revert_to_demo_mode("authorization key not"
|
||||
" valid for this platform");
|
||||
else if (CL(ROMlib_info.serialnumber) == CLC (2392023)
|
||||
|| CL(ROMlib_info.serialnumber) == CLC (2175023)
|
||||
|| CL(ROMlib_info.serialnumber) == CLC (5958004)
|
||||
|| (info.expires_p
|
||||
&& (info.last_year < this_year
|
||||
|| (info.last_year == this_year
|
||||
&& info.last_month < this_month))))
|
||||
revert_to_demo_mode("authorization key expired");
|
||||
else if (info.major_revision < MAJOR_REVISION ||
|
||||
(info.major_revision == MAJOR_REVISION &&
|
||||
!info.updates_p && MINOR_REVISION > 0))
|
||||
revert_to_demo_mode("authorization key not"
|
||||
" valid for this revision");
|
||||
#if !defined(MSDOS) && !defined (CYGWIN32)
|
||||
else
|
||||
protectus(info.serial_number, info.n_cpu);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
revert_to_demo_mode("authorization key vs. serial number"
|
||||
" mismatch");
|
||||
}
|
||||
|
||||
if (ST_INO (sbuf) != ROMlib_info.inodenumber
|
||||
|| (ULONGINT) (sbuf.st_mtime - ROMlib_info.timechanged) > 300)
|
||||
ROMlib_info.key[0] = 0;
|
||||
|
||||
info_after_hook ();
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
patch_phys_gestalt_ROMlib_info (void)
|
||||
{
|
||||
replace_physgestalt_selector (gestaltSerialNumber,
|
||||
ROMlib_info.serialnumber);
|
||||
|
||||
replace_physgestalt_selector (gestaltRegisteredName,
|
||||
US_TO_SYN68K (ROMlib_info.name));
|
||||
|
||||
replace_physgestalt_selector (gestaltRegisteredOrg,
|
||||
US_TO_SYN68K (ROMlib_info.organization));
|
||||
}
|
||||
|
||||
#if defined(MSDOS) || defined (CYGWIN32)
|
||||
PUBLIC char ROMlib_savecwd[MAXPATHLEN];
|
||||
|
||||
@ -1228,7 +725,6 @@ A1(PRIVATE, void, setstartdir, char *, argv0)
|
||||
#if defined(NEXTSTEP)
|
||||
misc_self_examination (lookhere);
|
||||
#endif
|
||||
readinfo(lookhere);
|
||||
suffix = rindex(lookhere, '/');
|
||||
*suffix = 0;
|
||||
getcwd(savedir, sizeof savedir);
|
||||
@ -1294,7 +790,6 @@ A1(PRIVATE, void, setstartdir, char *, argv0)
|
||||
strcpy(ROMlib_startdir, ".");
|
||||
}
|
||||
ROMlib_startdirlen = strlen(ROMlib_startdir);
|
||||
readinfo(argv0);
|
||||
#endif /* defined(MSDOS) */
|
||||
}
|
||||
|
||||
@ -2134,8 +1629,6 @@ A2 (PUBLIC, int, main, int, argc, char **, argv)
|
||||
|
||||
ROMlib_InitZones (force_big_offset ? offset_big : offset_none);
|
||||
|
||||
patch_phys_gestalt_ROMlib_info ();
|
||||
|
||||
{
|
||||
uint32 save_a7;
|
||||
|
||||
@ -2216,10 +1709,6 @@ A2 (PUBLIC, int, main, int, argc, char **, argv)
|
||||
opt_int_val (common_db, "nomouse", &ROMlib_no_mouse, &bad_arg_p);
|
||||
#endif
|
||||
|
||||
#if defined (DISPLAY_SPLASH_INFO_BOX)
|
||||
opt_int_val (common_db, "nosplash", &ROMlib_nosplash, &bad_arg_p);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
opt_int_val (common_db, "noclock", &ROMlib_noclock, &bad_arg_p);
|
||||
#endif
|
||||
@ -2597,15 +2086,6 @@ A2 (PUBLIC, int, main, int, argc, char **, argv)
|
||||
|
||||
restore_virtual_ints (int_state);
|
||||
|
||||
#if defined (DISPLAY_SPLASH_INFO_BOX)
|
||||
if (!ROMlib_no_windows && ROMlib_startupscreen)
|
||||
SysError (0x28); /* welcome to m*cintosh */
|
||||
#endif /* DISPLAY_SPLASH_INFO_BOX */
|
||||
|
||||
if (!ROMlib_info.serialnumber &&
|
||||
(!ROMlib_must_registerp || ROMlib_must_registerp->val))
|
||||
ROMlib_dolicense = register_only;
|
||||
|
||||
WWExist = QDExist = EXIST_NO;
|
||||
|
||||
#if defined (CYGWIN32)
|
||||
|
88
src/menu.c
88
src/menu.c
@ -62,12 +62,6 @@ P0 (PUBLIC pascal trap, void, InvalMenuBar)
|
||||
DrawMenuBar ();
|
||||
}
|
||||
|
||||
#if defined (DISPLAY_DEMO_ON_MENU_BAR)
|
||||
/* Bounding box for "DEMO" text on menu bar. */
|
||||
static Rect menu_demo_text_rect;
|
||||
#endif
|
||||
|
||||
|
||||
P0(PUBLIC pascal trap, void, DrawMenuBar)
|
||||
{
|
||||
if (MBDFHndl)
|
||||
@ -75,57 +69,6 @@ P0(PUBLIC pascal trap, void, DrawMenuBar)
|
||||
TheMenu = 0;
|
||||
MBDFCALL(mbDraw, 0, 0L);
|
||||
|
||||
#if defined (DISPLAY_DEMO_ON_MENU_BAR)
|
||||
if (WWExist == EXIST_YES)
|
||||
{
|
||||
THEPORT_SAVE_EXCURSION
|
||||
(MR (wmgr_port),
|
||||
{
|
||||
static char demo_string[] = DEMO_PREFIX "DEMO";
|
||||
FontInfo font_info;
|
||||
int text_width;
|
||||
int text_height;
|
||||
int left;
|
||||
int top;
|
||||
RGBColor save_fg;
|
||||
RGBColor save_bk;
|
||||
|
||||
save_fg = CPORT_RGB_FG_COLOR (MR (wmgr_port));
|
||||
save_bk = CPORT_RGB_BK_COLOR (MR (wmgr_port));
|
||||
|
||||
/* Set up the pen and colors. */
|
||||
PenNormal ();
|
||||
if (vdriver_bpp > 2)
|
||||
ForeColor (redColor);
|
||||
else
|
||||
ForeColor (blackColor);
|
||||
BackColor (whiteColor);
|
||||
|
||||
/* Set up the font. */
|
||||
TextFont (0);
|
||||
TextSize (0);
|
||||
GetFontInfo (&font_info);
|
||||
text_width = TextWidth ((Ptr) demo_string,
|
||||
0, strlen (demo_string));
|
||||
text_height = (CW (font_info.ascent));
|
||||
|
||||
left = vdriver_width - 16 - text_width;
|
||||
top = (CW (MBarHeight) - text_height) / 2 - 2;
|
||||
|
||||
/* Record the bounding rect. */
|
||||
SetRect (&menu_demo_text_rect,
|
||||
left, top, left + text_width, top + text_height);
|
||||
|
||||
/* Draw the demo text. */
|
||||
MoveTo (left, top + text_height);
|
||||
DrawText_c_string (demo_string);
|
||||
|
||||
/* Restore the foreground and background colors. */
|
||||
RGBForeColor (&save_fg);
|
||||
RGBBackColor (&save_bk);
|
||||
});
|
||||
}
|
||||
#endif /* DISPLAY_DEMO_ON_MENU_BAR */
|
||||
}
|
||||
}
|
||||
|
||||
@ -539,7 +482,6 @@ P2(PUBLIC pascal trap, void, AddResMenu, MenuHandle, mh, ResType, restype)
|
||||
}
|
||||
while (restype == TICK("FONT") && (restype = TICK("FOND")));
|
||||
|
||||
#if defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
/* Add an "About Executor..." menu to the Apple menu when they
|
||||
* ask for desk accessories.
|
||||
*/
|
||||
@ -550,7 +492,6 @@ P2(PUBLIC pascal trap, void, AddResMenu, MenuHandle, mh, ResType, restype)
|
||||
about_box_menu_name_pstr = (StringPtr) "\016\000About CCRS...";
|
||||
if (restype == TICK ("DRVR") && about_box_menu_name_pstr[0])
|
||||
app (about_box_menu_name_pstr, 0, 0, 0, 0, FALSE, &endinf);
|
||||
#endif /* defined (SUPPORT_ABOUT_EXECUTOR_BOX) */
|
||||
|
||||
n = GetHandleSize(temph);
|
||||
sp = (StringPtr) STARH(temph);
|
||||
@ -1184,7 +1125,7 @@ int32 ROMlib_menuhelper (MenuHandle mh, Rect *saverp,
|
||||
restoren(nmenusdisplayed, (RgnHandle) 0, 0);
|
||||
nmenusdisplayed = 0;
|
||||
}
|
||||
whichmenuhit = CRACKER_ZERO;
|
||||
whichmenuhit = 0;
|
||||
if (where == NOTHITINMBAR)
|
||||
{
|
||||
mh = NULL;
|
||||
@ -1233,7 +1174,7 @@ int32 ROMlib_menuhelper (MenuHandle mh, Rect *saverp,
|
||||
item = CW(item);
|
||||
}
|
||||
else
|
||||
item = CRACKER_ZERO;
|
||||
item = 0;
|
||||
where = oldwhere;
|
||||
olditem = 0;
|
||||
}
|
||||
@ -1369,12 +1310,6 @@ P1(PUBLIC pascal trap, LONGINT, MenuSelect, Point, p)
|
||||
|
||||
TopMenuItem = MBarHeight;
|
||||
retval = ROMlib_menuhelper((MenuHandle) 0, &spooeyr, 0, FALSE, 0);
|
||||
|
||||
#if defined (DISPLAY_DEMO_ON_MENU_BAR)
|
||||
if (retval == 0 && PtInRect (p, &menu_demo_text_rect))
|
||||
do_about_box ();
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1394,7 +1329,6 @@ P1(PUBLIC pascal trap, void, FlashMenuBar, INTEGER, mid)
|
||||
MBDFCALL(mbHilite, 0, l);
|
||||
}
|
||||
|
||||
#if 1 || !defined (DISABLE_COMMAND_KEY_EQUIVS)
|
||||
A2(PRIVATE, BOOLEAN, findroot, INTEGER, menuid, INTEGER *, root_unswp)
|
||||
{
|
||||
INTEGER loopcount, i, maxi;
|
||||
@ -1438,15 +1372,9 @@ A2(PRIVATE, BOOLEAN, findroot, INTEGER, menuid, INTEGER *, root_unswp)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* !defined (DISABLE_COMMAND_KEY_EQUIVS) */
|
||||
|
||||
P1(PUBLIC pascal trap, LONGINT, MenuKey, CHAR, thec)
|
||||
{
|
||||
#if defined (DISABLE_COMMAND_KEY_EQUIVS)
|
||||
if (!ROMlib_disable_command_key_equivsp ||
|
||||
!ROMlib_disable_command_key_equivsp->val)
|
||||
#endif
|
||||
{
|
||||
muelem *mp, *mpend;
|
||||
startendpairs mps;
|
||||
unsigned char *p;
|
||||
@ -1482,7 +1410,7 @@ P1(PUBLIC pascal trap, LONGINT, MenuKey, CHAR, thec)
|
||||
if (i == (int) nonhier)
|
||||
menuid = Hx(mh, menuID);
|
||||
else if (!findroot(Hx(mh, menuID), &menuid))
|
||||
/*-->*/ return 0L;
|
||||
/*-->*/ return 0L;
|
||||
retval = ((LONGINT)Hx(mh, menuID) << 16) |
|
||||
(unsigned short) mitem;
|
||||
FlashMenuBar(menuid);
|
||||
@ -1491,21 +1419,13 @@ P1(PUBLIC pascal trap, LONGINT, MenuKey, CHAR, thec)
|
||||
SystemMenu(retval);
|
||||
retval = 0;
|
||||
}
|
||||
/*-->*/ return retval;
|
||||
/*-->*/ return retval;
|
||||
}
|
||||
mitem++;
|
||||
p += U(*p) + SIZEOFMEXT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined (DISABLE_COMMAND_KEY_EQUIVS)
|
||||
else
|
||||
system_error ("Menu command-key equivalents are disabled in the "
|
||||
"demo version of Executor. You must use the mouse "
|
||||
"to select menu items.",
|
||||
0, "OK", NULL, NULL, NULL, NULL, NULL);
|
||||
#endif /* defined (DISABLE_COMMAND_KEY_EQUIVS) */
|
||||
return(0L);
|
||||
}
|
||||
|
||||
|
11
src/mman.c
11
src/mman.c
@ -33,8 +33,13 @@ char ROMlib_rcsid_mman[] =
|
||||
#include "dpmilock.h"
|
||||
#endif
|
||||
|
||||
#if defined (LINUX)
|
||||
#if defined (LINUX) || defined (MACOSX)
|
||||
#include <sys/mman.h>
|
||||
|
||||
#if !defined (MAP_ANONYMOUS)
|
||||
# define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
|
||||
#endif /* LINUX */
|
||||
|
||||
#if defined(NEXT) && !defined (STRICT_OPENSTEP)
|
||||
@ -768,7 +773,7 @@ _NewHandle_flags (Size size, boolean_t sys_p, boolean_t clear_p)
|
||||
newh->p = BLOCK_DATA_X (block);
|
||||
|
||||
if (clear_p)
|
||||
memset (BLOCK_DATA (block), CRACKER_ZERO, size - HDRSIZE);
|
||||
memset (BLOCK_DATA (block), 0, size - HDRSIZE);
|
||||
|
||||
SET_MEM_ERR (noErr);
|
||||
|
||||
@ -1235,7 +1240,7 @@ _NewPtr_flags (Size size, boolean_t sys_p, boolean_t clear_p)
|
||||
p = BLOCK_DATA (b);
|
||||
|
||||
if (clear_p)
|
||||
memset (p, CRACKER_ZERO, size - HDRSIZE);
|
||||
memset (p, 0, size - HDRSIZE);
|
||||
|
||||
TheZone = save_zone;
|
||||
SET_MEM_ERR (noErr);
|
||||
|
@ -41,7 +41,6 @@ char ROMlib_rcsid_osevent[] =
|
||||
#include "rsys/toolevent.h"
|
||||
#include "rsys/osevent.h"
|
||||
#include "rsys/dirtyrect.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/stdfile.h"
|
||||
#include "rsys/system_error.h"
|
||||
|
||||
@ -437,9 +436,6 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp,
|
||||
BOOLEAN retval;
|
||||
static Point oldpoint = { -1, -1 };
|
||||
LONGINT ticks;
|
||||
#if !defined(MSDOS) && !defined(CYGWIN32)
|
||||
static LONGINT protector_ticks;
|
||||
#endif
|
||||
|
||||
/* We tend to call this routine from various ROMlib modal loops, so this
|
||||
* is a good place to check for timer interrupts, etc. */
|
||||
@ -525,31 +521,6 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp,
|
||||
ROMlib_memnomove_p = FALSE; /* this is an icky hack needed for Excel */
|
||||
ticks = TickCount();
|
||||
|
||||
#if !defined(MSDOS) && !defined (CYGWIN32)
|
||||
#define TICKS_PER_MINUTE (60 * 60)
|
||||
if (ticks - protector_ticks > 4 * TICKS_PER_MINUTE)
|
||||
{
|
||||
protectus(0, 0);
|
||||
protector_ticks = ticks;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (TIME_OUT)
|
||||
{
|
||||
static char in_alert = FALSE;
|
||||
|
||||
if (!ROMlib_info.serialnumber && ticks > TIME_OUT * 60 * 60 && !in_alert)
|
||||
{
|
||||
in_alert = TRUE;
|
||||
|
||||
ROMlib_exit = TRUE;
|
||||
system_error ("Time's up!", 0, "Exit", NULL, NULL,
|
||||
C_ExitToShell, NULL, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (X)
|
||||
/* if we are running on a version of linux that doesn't support
|
||||
SIGIO this will handle events (although not asynchronously) */
|
||||
|
@ -37,6 +37,8 @@ pair_t ROMlib_ScreenLocation = { INITIALPAIRVALUE, INITIALPAIRVALUE };
|
||||
unsigned short crcval;
|
||||
int ROMlib_AppleChar = 0;
|
||||
int ROMlib_right_button_modifier = 0;
|
||||
|
||||
void yyerror(const char *str);
|
||||
%}
|
||||
|
||||
%start configuration
|
||||
@ -576,7 +578,7 @@ static long yylex( void ) {
|
||||
}
|
||||
}
|
||||
|
||||
void yyerror(char *str)
|
||||
void yyerror(const char *str)
|
||||
{
|
||||
warning_unexpected ("configuration file parse error (line %ld): %s", linecount, str);
|
||||
}
|
||||
|
454
src/protector.c
454
src/protector.c
@ -1,454 +0,0 @@
|
||||
/* Copyright 1992 by Abacus Research and
|
||||
* Development, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#if !defined (OMIT_RCSID_STRINGS)
|
||||
char ROMlib_rcsid_protector[] =
|
||||
"$Id: protector.c 63 2004-12-24 18:19:43Z ctm $";
|
||||
#endif
|
||||
|
||||
#include "rsys/common.h"
|
||||
|
||||
#if defined(NEXTSTEP) || defined(LINUX) || defined (MACOSX)
|
||||
|
||||
/*
|
||||
* TODO: make sure no one interferes with SIGIO
|
||||
*/
|
||||
|
||||
#include "rsys/next.h"
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "rsys/sigio_multiplex.h"
|
||||
|
||||
#if defined(NEXTSTEP)
|
||||
#include <libc.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Here's the plan:
|
||||
*
|
||||
* We try to get a port number as close to BASEPORT as we can.
|
||||
* We listen on whatever we get.
|
||||
* We broadcast on all ports between BASEPORT and the highest we've seen.
|
||||
* (except the who's alive message is broadcast to all the ports)
|
||||
* We advertise when we start up and when we die.
|
||||
* We send an alive message whenever in response to a who's alive message.
|
||||
* If we don't see an alive message for five minutes we send one.
|
||||
*/
|
||||
|
||||
static LONGINT sock;
|
||||
|
||||
#define WHOLIVES 0x50505050
|
||||
#define ILIVE 0x55555555
|
||||
#define IDIED 0xAAAAAAAA
|
||||
|
||||
#define HASHSIZE 1031
|
||||
|
||||
#define BASEPORT 62331
|
||||
#define NPORTS 10
|
||||
|
||||
#define STALE (5 * 60) /* 5 minutes */
|
||||
|
||||
static LONGINT portcount[NPORTS];
|
||||
|
||||
typedef struct __hashentry {
|
||||
struct sockaddr_in addr;
|
||||
LONGINT datestarted;
|
||||
LONGINT datenow;
|
||||
struct __hashentry *next;
|
||||
} hashentry;
|
||||
|
||||
hashentry *hashtable[HASHSIZE];
|
||||
LONGINT hashcount;
|
||||
|
||||
time_t datestarted;
|
||||
|
||||
typedef struct {
|
||||
LONGINT message;
|
||||
LONGINT serialnumber;
|
||||
LONGINT datenow;
|
||||
LONGINT datestarted;
|
||||
} packet;
|
||||
|
||||
static LONGINT ourserialnumber;
|
||||
static LONGINT maxconcurrent;
|
||||
|
||||
static unsigned short curbigport = BASEPORT;
|
||||
|
||||
static struct sockaddr_in ourname, broadname;
|
||||
|
||||
/*
|
||||
* NOTE: sorted hash chain. This is necessary so we can figure out which
|
||||
* copies are running on which machines.
|
||||
*/
|
||||
|
||||
static int
|
||||
compareaddrs(struct sockaddr_in *addr1, struct sockaddr_in *addr2,
|
||||
char *partialmatchp)
|
||||
{
|
||||
ULONGINT u1, u2;
|
||||
char retval;
|
||||
|
||||
if (partialmatchp)
|
||||
*partialmatchp = FALSE;
|
||||
if ((u1 = addr1->sin_addr.s_addr) < (u2 = addr2->sin_addr.s_addr))
|
||||
retval = -1;
|
||||
else if (u1 == u2) {
|
||||
if (partialmatchp)
|
||||
*partialmatchp = TRUE;
|
||||
if ((u1 = ntohs (addr1->sin_port)) < (u2 = ntohs (addr2->sin_port)))
|
||||
retval = -1;
|
||||
else if (u1 == u2)
|
||||
retval = 0;
|
||||
else
|
||||
retval = 1;
|
||||
} else
|
||||
retval = 1;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static hashentry **find(struct sockaddr_in *fromp, char *partialmatchp)
|
||||
{
|
||||
hashentry **retval;
|
||||
ULONGINT key;
|
||||
|
||||
key = fromp->sin_addr.s_addr;
|
||||
*partialmatchp = FALSE;
|
||||
retval = &hashtable[key % HASHSIZE];
|
||||
while (*retval && compareaddrs(&(*retval)->addr, fromp, partialmatchp) < 0)
|
||||
retval = &(*retval)->next;
|
||||
return retval;
|
||||
}
|
||||
|
||||
hashentry *freechain;
|
||||
|
||||
void mymallocinit(LONGINT nneeded)
|
||||
{
|
||||
hashentry *p;
|
||||
|
||||
freechain = malloc(sizeof(hashentry) * nneeded);
|
||||
for (p = freechain; --nneeded >= 0; ++p) {
|
||||
p->next = p+1;
|
||||
}
|
||||
p[-1].next = 0;
|
||||
}
|
||||
|
||||
void myfree(hashentry *tofree)
|
||||
{
|
||||
tofree->next = freechain;
|
||||
freechain = tofree;
|
||||
}
|
||||
|
||||
hashentry *mymalloc( void )
|
||||
{
|
||||
hashentry *retval;
|
||||
|
||||
retval = freechain;
|
||||
if (freechain)
|
||||
freechain = freechain->next;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void hash_delete(struct sockaddr_in *fromp)
|
||||
{
|
||||
hashentry *totoss;
|
||||
hashentry **loc;
|
||||
char partialmatch;
|
||||
|
||||
loc = find(fromp, &partialmatch);
|
||||
if (*loc && compareaddrs(&(*loc)->addr, fromp, (char *) 0) == 0) {
|
||||
totoss = *loc;
|
||||
*loc = (*loc)->next;
|
||||
myfree(totoss);
|
||||
/* the test after the && is to make sure that there aren't other
|
||||
entries with this addr remaining */
|
||||
if (!partialmatch && (!*loc ||
|
||||
(*loc)->addr.sin_addr.s_addr != fromp->sin_addr.s_addr))
|
||||
--hashcount;
|
||||
if (--portcount[ntohs (fromp->sin_port) - BASEPORT] == 0
|
||||
&& ntohs (fromp->sin_port) == curbigport) {
|
||||
while (!portcount[--curbigport - BASEPORT])
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: we call hash_delete below instead of doing it by hand because we don't
|
||||
* want to worry about the trickiness of when to decrement hashcount
|
||||
* and curbigport.
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(NEXTSTEP)
|
||||
|
||||
/*
|
||||
* NOTE: we need better routines than this eventually
|
||||
*/
|
||||
|
||||
void toomanycopiesonnet( void )
|
||||
{
|
||||
printf("too many copies on net\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void incrhashcount( void )
|
||||
{
|
||||
short i;
|
||||
hashentry **loc;
|
||||
time_t now;
|
||||
|
||||
++hashcount;
|
||||
if (hashcount > maxconcurrent) {
|
||||
time(&now);
|
||||
/* loop through, purging old stuff */
|
||||
for (i = 0; i < HASHSIZE; ++i) {
|
||||
for (loc = &hashtable[i]; *loc; loc = &(*loc)->next) {
|
||||
if (now - (*loc)->datenow >= STALE)
|
||||
hash_delete(&(*loc)->addr);
|
||||
}
|
||||
}
|
||||
if (hashcount > maxconcurrent) {
|
||||
toomanycopiesonnet();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void add(packet *bufp, struct sockaddr_in *fromp)
|
||||
{
|
||||
hashentry **loc;
|
||||
hashentry *newentryp;
|
||||
LONGINT olddate;
|
||||
char partialmatch;
|
||||
|
||||
loc = find(fromp, &partialmatch);
|
||||
if (*loc && compareaddrs(&(*loc)->addr, fromp, (char *) 0) == 0) {
|
||||
if (bufp->datestarted < (olddate = (*loc)->datestarted)) {
|
||||
#if 0
|
||||
fprintf(stderr, "startdate went backwards\n");
|
||||
/* exit(1); */
|
||||
(*loc)->datestarted = bufp->datestarted;
|
||||
if (olddate > datestarted && bufp->datestarted <= datestarted)
|
||||
incrhashcount();
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
newentryp = mymalloc();
|
||||
if (newentryp) {
|
||||
newentryp->addr = *fromp;
|
||||
newentryp->datestarted = bufp->datestarted;
|
||||
newentryp->datenow = bufp->datenow;
|
||||
newentryp->next = *loc;
|
||||
*loc = newentryp;
|
||||
if (!partialmatch && bufp->datestarted <= datestarted + 2)
|
||||
incrhashcount();
|
||||
}
|
||||
}
|
||||
if (ntohs (fromp->sin_port) > curbigport)
|
||||
curbigport = ntohs (fromp->sin_port);
|
||||
++portcount[ntohs (fromp->sin_port) - BASEPORT];
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if defined(BINCOMPAT)
|
||||
#define OURID 0x40000000
|
||||
#else
|
||||
#define OURID 0x20000000
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define OURID 0x00000000
|
||||
|
||||
#endif
|
||||
|
||||
static void sendpacket(LONGINT message)
|
||||
{
|
||||
packet buf;
|
||||
unsigned short lastport;
|
||||
struct sockaddr_in to;
|
||||
time_t thetime;
|
||||
|
||||
if (ourserialnumber)
|
||||
{
|
||||
buf.message = CL(message);
|
||||
buf.serialnumber = CL(ourserialnumber | OURID);
|
||||
time(&thetime);
|
||||
buf.datenow = CL(thetime);
|
||||
buf.datestarted = CL(datestarted);
|
||||
if (message == WHOLIVES)
|
||||
lastport = BASEPORT + NPORTS - 1;
|
||||
else
|
||||
lastport = MAX(ntohs (ourname.sin_port), curbigport);
|
||||
for (to = broadname; ntohs (to.sin_port) <= lastport;
|
||||
to.sin_port = htons (ntohs (to.sin_port) + 1))
|
||||
sendto(sock, &buf, sizeof(buf), 0, (struct sockaddr *) &to,
|
||||
sizeof(to));
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(BINCOMPAT)
|
||||
#define TRAP
|
||||
#else
|
||||
#define TRAP trap
|
||||
#endif
|
||||
|
||||
static TRAP void gotsigio (int signo)
|
||||
{
|
||||
struct sockaddr_in from;
|
||||
packet buf;
|
||||
LONGINT count;
|
||||
time_t currenttime;
|
||||
LONGINT fromlen;
|
||||
|
||||
time(¤ttime);
|
||||
fromlen = sizeof(from);
|
||||
do {
|
||||
count = recvfrom(sock, &buf, sizeof(buf), 0, (struct sockaddr *) &from,
|
||||
(void *) &fromlen);
|
||||
if (count == sizeof(buf) &&
|
||||
buf.serialnumber == CL(ourserialnumber | OURID)) {
|
||||
|
||||
buf.message = CL(buf.message);
|
||||
buf.serialnumber = CL(buf.serialnumber);
|
||||
buf.datenow = CL(buf.datenow);
|
||||
buf.datestarted = CL(buf.datestarted);
|
||||
|
||||
buf.datestarted += currenttime - buf.datenow;
|
||||
buf.datenow = currenttime;
|
||||
switch (buf.message) {
|
||||
case WHOLIVES:
|
||||
add(&buf, &from);
|
||||
sendpacket(ILIVE);
|
||||
break;
|
||||
case ILIVE:
|
||||
add(&buf, &from);
|
||||
break;
|
||||
case IDIED:
|
||||
hash_delete(&from);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (count >= 0);
|
||||
}
|
||||
|
||||
|
||||
#define TRANSFORM_CHAR(c) ((c) ^ 0xA3)
|
||||
|
||||
PRIVATE void
|
||||
transform_string (char *p)
|
||||
{
|
||||
for (;*p;++p)
|
||||
*p = TRANSFORM_CHAR (*p);
|
||||
}
|
||||
|
||||
PRIVATE boolean_t
|
||||
check_net (void)
|
||||
{
|
||||
char env[] =
|
||||
{
|
||||
TRANSFORM_CHAR('E'),
|
||||
TRANSFORM_CHAR('X'),
|
||||
TRANSFORM_CHAR('E'),
|
||||
TRANSFORM_CHAR('C'),
|
||||
TRANSFORM_CHAR('U'),
|
||||
TRANSFORM_CHAR('T'),
|
||||
TRANSFORM_CHAR('O'),
|
||||
TRANSFORM_CHAR('R'),
|
||||
TRANSFORM_CHAR('_'),
|
||||
TRANSFORM_CHAR('N'),
|
||||
TRANSFORM_CHAR('E'),
|
||||
TRANSFORM_CHAR('T'),
|
||||
TRANSFORM_CHAR('C'),
|
||||
TRANSFORM_CHAR('H'),
|
||||
TRANSFORM_CHAR('E'),
|
||||
TRANSFORM_CHAR('C'),
|
||||
TRANSFORM_CHAR('K'),
|
||||
0
|
||||
};
|
||||
boolean_t retval;
|
||||
char *name;
|
||||
|
||||
retval = TRUE;
|
||||
|
||||
transform_string (env);
|
||||
name = getenv (env);
|
||||
transform_string (env);
|
||||
if (name && strcmp (name, "0") == 0)
|
||||
retval = FALSE;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void protectus(LONGINT serialnumber, LONGINT max)
|
||||
{
|
||||
LONGINT err;
|
||||
LONGINT val;
|
||||
static char beenhere;
|
||||
struct ifreq ifr;
|
||||
|
||||
if (check_net ())
|
||||
{
|
||||
if (serialnumber && !freechain)
|
||||
{
|
||||
mymallocinit(MIN(50, max * 4));
|
||||
ourserialnumber = serialnumber;
|
||||
maxconcurrent = max;
|
||||
}
|
||||
if (!beenhere)
|
||||
{
|
||||
int try_port;
|
||||
|
||||
time(&datestarted);
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
sigio_multiplex_install_handler (sock, gotsigio);
|
||||
#if defined(LINUX)
|
||||
strcpy(ifr.ifr_name, "eth0");
|
||||
if (ioctl(sock, SIOCGIFBRDADDR, &ifr) < 0)
|
||||
#endif
|
||||
((struct sockaddr_in *) &ifr.ifr_broadaddr)->sin_addr.s_addr
|
||||
= INADDR_BROADCAST;
|
||||
val = 1;
|
||||
err = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val));
|
||||
err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
||||
ourname.sin_family = AF_INET;
|
||||
ourname.sin_addr.s_addr = INADDR_ANY;
|
||||
memset(ourname.sin_zero, 0, sizeof(ourname.sin_zero));
|
||||
try_port = BASEPORT;
|
||||
do
|
||||
{
|
||||
ourname.sin_port = htons (try_port);
|
||||
err = bind(sock, (struct sockaddr *) &ourname, sizeof(ourname));
|
||||
}
|
||||
while (err < 0 && errno == EADDRINUSE
|
||||
&& ++try_port < BASEPORT + NPORTS);
|
||||
if (err == 0)
|
||||
{
|
||||
err = fcntl(sock, F_SETFL, FASYNC|FNDELAY);
|
||||
err = fcntl(sock, F_SETOWN, getpid());
|
||||
broadname.sin_family = AF_INET;
|
||||
broadname.sin_port = htons (BASEPORT);
|
||||
broadname.sin_addr =
|
||||
((struct sockaddr_in *) &ifr.ifr_broadaddr)->sin_addr;
|
||||
memset(broadname.sin_zero, 0, sizeof(broadname.sin_zero));
|
||||
beenhere = 1;
|
||||
}
|
||||
}
|
||||
if (ourserialnumber && beenhere)
|
||||
sendpacket(WHOLIVES);
|
||||
}
|
||||
}
|
||||
|
||||
void stopprotectingus( void )
|
||||
{
|
||||
sendpacket(IDIED);
|
||||
}
|
||||
#endif /* defined(NEXTSTEP) || defined(LINUX) */
|
@ -86,7 +86,7 @@ A3(PRIVATE, Handle, getindmapresource, resmaphand, map, ResType, typ,
|
||||
if (CL(tr->rtyp) == typ) {
|
||||
nr = Cx(tr->nres) + 1;
|
||||
WALKRR(map, tr, j, rr)
|
||||
if (--*indx == CRACKER_ZERO)
|
||||
if (--*indx == 0)
|
||||
/*-->*/ return ROMlib_mgetres(map, rr);
|
||||
EWALKRR(rr)
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ char ROMlib_rcsid_splash[] =
|
||||
|
||||
#include "rsys/splash.h"
|
||||
#include "rsys/vdriver.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/cquick.h"
|
||||
#include "rsys/slash.h"
|
||||
#include "rsys/notmac.h"
|
||||
|
@ -1546,21 +1546,7 @@ PUBLIC int linuxfloppy_open(int disk, LONGINT *bsizep,
|
||||
*flagsp = 0;
|
||||
#define FLOPPY_PREFIX "/dev/fd"
|
||||
if (strncmp (dname, FLOPPY_PREFIX, sizeof(FLOPPY_PREFIX)-1) == 0)
|
||||
{
|
||||
*flagsp |= DRIVE_FLAGS_FLOPPY;
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
force_read_only = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (DISABLE_SCSI_WRITES)
|
||||
{
|
||||
struct stat sbuf;
|
||||
|
||||
if (stat (dname, &sbuf) == 0 && !S_ISREG (sbuf.st_mode))
|
||||
force_read_only = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!force_read_only)
|
||||
retval = Uopen (dname, O_RDWR);
|
||||
|
@ -57,7 +57,6 @@ char ROMlib_rcsid_stdfile[] =
|
||||
#include "rsys/tempalloc.h"
|
||||
#include "rsys/hook.h"
|
||||
#include "rsys/toolevent.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/string.h"
|
||||
#include "rsys/dcache.h"
|
||||
#include "rsys/menu.h"
|
||||
@ -75,6 +74,7 @@ PUBLIC int nodrivesearch_p = FALSE;
|
||||
#endif
|
||||
|
||||
#include "rsys/print.h"
|
||||
#include "rsys/system_error.h"
|
||||
|
||||
typedef union
|
||||
{
|
||||
@ -1576,21 +1576,7 @@ PUBLIC int linuxfloppy_open(int disk, LONGINT *bsizep,
|
||||
*flagsp = 0;
|
||||
#define FLOPPY_PREFIX "/dev/fd"
|
||||
if (strncmp (dname, FLOPPY_PREFIX, sizeof(FLOPPY_PREFIX)-1) == 0)
|
||||
{
|
||||
*flagsp |= DRIVE_FLAGS_FLOPPY;
|
||||
#if defined (DISABLE_FLOPPY_WRITES)
|
||||
force_read_only = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (DISABLE_SCSI_WRITES)
|
||||
{
|
||||
struct stat sbuf;
|
||||
|
||||
if (stat (dname, &sbuf) == 0 && !S_ISREG (sbuf.st_mode))
|
||||
force_read_only = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!force_read_only)
|
||||
retval = Uopen (dname, O_RDWR, 0);
|
||||
|
@ -396,19 +396,6 @@ draw_item (Rect *rp, struct tableentry *tp, int32 bit, int item, MenuHandle mh,
|
||||
}
|
||||
RGBBackColor (invert_p ? &title_color : &bk_color);
|
||||
|
||||
#if defined (DISABLE_COMMAND_KEY_EQUIVS)
|
||||
if (ROMlib_disable_command_key_equivsp &&
|
||||
ROMlib_disable_command_key_equivsp->val)
|
||||
if (active_p && !dither_cmd_p)
|
||||
{
|
||||
if (!AVERAGE_COLOR (&bk_color, &command_color, 0x8000, &command_color))
|
||||
{
|
||||
command_color = ROMlib_black_rgb_color;
|
||||
dither_cmd_p = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rtmp.top = CW (top);
|
||||
rtmp.bottom = CW (bottom);
|
||||
rtmp.left = rp->left;
|
||||
|
89
src/syserr.c
89
src/syserr.c
@ -28,17 +28,11 @@ char ROMlib_rcsid_syserr[] =
|
||||
#include "rsys/segment.h"
|
||||
#include "rsys/flags.h"
|
||||
#include "rsys/version.h"
|
||||
#include "rsys/license.h"
|
||||
#include "rsys/vdriver.h"
|
||||
#include "rsys/next.h"
|
||||
#include "rsys/osevent.h"
|
||||
#include "rsys/options.h"
|
||||
|
||||
PRIVATE void mydolicense( void )
|
||||
{
|
||||
ROMlib_dolicense = old_license;
|
||||
}
|
||||
|
||||
PRIVATE struct {
|
||||
INTEGER count PACKED;
|
||||
|
||||
@ -163,12 +157,7 @@ PRIVATE struct {
|
||||
|
||||
CWC(156), /* 8. Info "procedure" */
|
||||
CWC(4),
|
||||
#if !defined(LITTLEENDIAN)
|
||||
(void (*)()) mydolicense,
|
||||
#else
|
||||
0, /* dolicense will be filled in later */
|
||||
#endif
|
||||
|
||||
0, /* was mydolicense, which we no longer use */
|
||||
};
|
||||
|
||||
char syserr_msg[256];
|
||||
@ -355,23 +344,6 @@ A4(PRIVATE, void, dobuttons, INTEGER, id, INTEGER, offsetx,
|
||||
}
|
||||
}
|
||||
|
||||
#define DEMO_MODE_VERSION "Time Limited Demo Mode ("
|
||||
#define REGISTERED_VERSION "Fully Enabled Version, Do NOT Redistribute ("
|
||||
|
||||
#if defined (EXPERIMENTAL)
|
||||
#define EXPERIMENTAL_STRING " -- experimental)"
|
||||
#else
|
||||
#define EXPERIMENTAL_STRING ")"
|
||||
#endif
|
||||
|
||||
PRIVATE void
|
||||
DrawVersion (char *str)
|
||||
{
|
||||
DrawText_c_string (str);
|
||||
DrawText_c_string ((char *) ROMlib_executor_version);
|
||||
DrawText_c_string (EXPERIMENTAL_STRING);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: The version of SysError below will only handle natively compiled
|
||||
* code. When we want to be able to run arbitrary code we'll need
|
||||
@ -395,11 +367,6 @@ P1(PUBLIC pascal, void, SysError, short, errorcode)
|
||||
|
||||
main_gd_rect = PIXMAP_BOUNDS (GD_PMAP (MR (MainDevice)));
|
||||
|
||||
#if defined(LITTLEENDIAN)
|
||||
myalerttab.func8 =
|
||||
(void (*)(void)) (long) CL((LONGINT) (long) mydolicense);
|
||||
#endif
|
||||
|
||||
if (!DSAlertTab) {
|
||||
#if defined (CLIFF_CENTERING_ALGORITHM)
|
||||
DSAlertTab = CL((Ptr) &myalerttab);
|
||||
@ -459,13 +426,6 @@ P1(PUBLIC pascal, void, SysError, short, errorcode)
|
||||
|
||||
/* 5, 6. Draw alert box if the errorcode is >= 0 */
|
||||
TRAPBEGIN();
|
||||
if (
|
||||
#if defined (DISPLAY_SPLASH_INFO_BOX)
|
||||
!ROMlib_nosplash
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
) {
|
||||
if (errorcode < 0)
|
||||
errorcode = -errorcode;
|
||||
else {
|
||||
@ -504,56 +464,11 @@ P1(PUBLIC pascal, void, SysError, short, errorcode)
|
||||
|
||||
/* 9. TODO: figure out what to do with the proc ... */
|
||||
|
||||
#define NTK_LINE_1 "Distributed in Asia by NTK, Inc."
|
||||
#define NTK_LINE_2 "+82 2 551 3505 FAX"
|
||||
#define NTK_LINE_3 "+82 2 551 8425 Phone"
|
||||
|
||||
if (errorcode == WELCOME_CODE) {
|
||||
#if 0
|
||||
MoveTo((CW(DSAlertRect.left) + CW(DSAlertRect.right)) / 2,
|
||||
CW(DSAlertRect.bottom) - 48);
|
||||
DrawText_c_string (NTK_LINE_1);
|
||||
MoveTo((CW(DSAlertRect.left) + CW(DSAlertRect.right)) / 2,
|
||||
CW(DSAlertRect.bottom) - 32);
|
||||
DrawText_c_string (NTK_LINE_2);
|
||||
MoveTo((CW(DSAlertRect.left) + CW(DSAlertRect.right)) / 2,
|
||||
CW(DSAlertRect.bottom) - 16);
|
||||
DrawText_c_string (NTK_LINE_3);
|
||||
#endif
|
||||
|
||||
MoveTo (CW(main_gd_rect.left) + 5,
|
||||
CW(main_gd_rect.bottom) - 17);
|
||||
#if defined (USE_VGAVDRIVER)
|
||||
TextMode(srcBic);
|
||||
#endif
|
||||
|
||||
if (ROMlib_info.serialnumber)
|
||||
{
|
||||
Str255 s;
|
||||
|
||||
DrawVersion (REGISTERED_VERSION);
|
||||
MoveTo(CW(main_gd_rect.left) + 5,
|
||||
CW(main_gd_rect.bottom) - 33);
|
||||
DrawText_c_string ("SN:");
|
||||
NumToString(ROMlib_info.serialnumber, s);
|
||||
DrawString(s);
|
||||
DrawText_c_string (" ");
|
||||
DrawText_c_string (ROMlib_info.name);
|
||||
DrawText_c_string (" --- ");
|
||||
DrawText_c_string (ROMlib_info.organization);
|
||||
}
|
||||
else
|
||||
DrawVersion (DEMO_MODE_VERSION);
|
||||
TextMode(srcOr);
|
||||
}
|
||||
|
||||
/* 10, 11, 12, 13. check for non-zero button id */
|
||||
/* #warning We blow off ResumeProc until we can properly handle it */
|
||||
if (ap->buttonid)
|
||||
dobuttons(/* CL(ResumeProc) ? Cx(ap->buttonid) + 1 : */ Cx(ap->buttonid),
|
||||
offsetx, offsety,
|
||||
!ROMlib_info.serialnumber && errorcode == WELCOME_CODE);
|
||||
}
|
||||
offsetx, offsety, false);
|
||||
|
||||
TRAPEND();
|
||||
}
|
||||
|
@ -246,74 +246,6 @@ PUBLIC void ROMlib_circledefault(DialogPtr dp)
|
||||
SetPort(saveport);
|
||||
}
|
||||
|
||||
#if !defined (SUPPORT_ABOUT_EXECUTOR_BOX)
|
||||
|
||||
PRIVATE void substitute(Handle h, const char *findp, const char *replacep)
|
||||
{
|
||||
Munger(h, 0, (Ptr) findp, strlen(findp), (Ptr) replacep, strlen(replacep));
|
||||
}
|
||||
|
||||
/* This is the old, crufty about panel, which should eventually go away.
|
||||
* The nice new about box is in aboutbox.c.
|
||||
*/
|
||||
PRIVATE void do_about_box(void)
|
||||
{
|
||||
HIDDEN_Handle h;
|
||||
Rect r;
|
||||
INTEGER type;
|
||||
DialogPtr dp;
|
||||
INTEGER ihit;
|
||||
INTEGER offset;
|
||||
typedef Rect *RectPtr;
|
||||
typedef struct { RectPtr p PACKED_P; } HIDDEN_RectPtr;
|
||||
typedef HIDDEN_RectPtr *RectHandle;
|
||||
RectHandle rh; /* all we're concerned with is the rect, but more follows */
|
||||
|
||||
if (WWExist != EXIST_YES)
|
||||
SysBeep(5);
|
||||
else
|
||||
{
|
||||
static BOOLEAN already_here = FALSE;
|
||||
if (!already_here)
|
||||
{
|
||||
already_here = TRUE;
|
||||
rh = (RectHandle) GetResource(TICK("DLOG"), ABOUTDIALID);
|
||||
offset = (CW(screenBitsX.bounds.right) -
|
||||
(Hx(rh, right) - Hx(rh, left))) / 2;
|
||||
offset = offset - Hx(rh, left);
|
||||
HxX(rh, left ) = CW(Hx(rh, left ) + offset);
|
||||
HxX(rh, right) = CW(Hx(rh, right) + offset);
|
||||
dp = GetNewDialog(ABOUTDIALID, (Ptr) 0, (WindowPtr) -1);
|
||||
|
||||
GetDItem(dp, 2, &type, &h, &r);
|
||||
h.p = CL(h.p);
|
||||
substitute(h.p, "m.nnx", ROMlib_executor_version);
|
||||
#if defined(LINUX)
|
||||
substitute(h.p, "DOS", "Linux");
|
||||
#elif defined(NEXTSTEP)
|
||||
substitute(h.p, "DOS", "NEXTSTEP");
|
||||
#endif
|
||||
SetDItem(dp, 2, CW(type), h.p, &r);
|
||||
|
||||
GetDItem(dp, 2, &type, &h, &r);
|
||||
h.p = CL(h.p);
|
||||
substitute(h.p, "License", "Info");
|
||||
SetDItem(dp, 2, CW(type), h.p, &r);
|
||||
|
||||
ShowWindow(dp);
|
||||
ROMlib_circledefault(dp);
|
||||
do
|
||||
ModalDialog((ProcPtr) 0, &ihit);
|
||||
while (ihit != CWC(ABOUTOKITEM));
|
||||
DisposDialog(dp);
|
||||
already_here = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !defined (SUPPORT_ABOUT_EXECUTOR_BOX) */
|
||||
|
||||
|
||||
PUBLIC void dofloppymount( void )
|
||||
{
|
||||
#if !defined(MSDOS) && !defined(LINUX) && !defined (CYGWIN32)
|
||||
@ -1311,13 +1243,8 @@ P0 (PUBLIC pascal trap, LONGINT, TickCount)
|
||||
*/
|
||||
|
||||
if (ROMlib_clock)
|
||||
Ticks_UL.u = CL (ticks); /* NOTE: we do it this way so that all four
|
||||
bytes are used, even though if SHORT_TICKS
|
||||
is set, we'll expect the top two bytes to
|
||||
always be zero. If someone cracks out
|
||||
our Time's up test then Ticks upper bytes
|
||||
will get set eventually and that will
|
||||
cause trouble */
|
||||
Ticks_UL.u = CL (ticks);
|
||||
|
||||
new_time = (UNIXTIMETOMACTIME (ROMlib_start_time.tv_sec)
|
||||
+ (long) ((ROMlib_start_time.tv_usec / (1000000.0 / 60) + ticks) / 60));
|
||||
|
||||
|
@ -103,26 +103,21 @@ get_phoney_name_resource (void)
|
||||
{
|
||||
if (!ROMlib_phoney_name_string)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen (ROMlib_info.name);
|
||||
ROMlib_phoney_name_string = (StringHandle) NewHandleSys (len+1);
|
||||
if (ROMlib_phoney_name_string)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = ROMlib_info.name;
|
||||
HSetRBit ((Handle) ROMlib_phoney_name_string);
|
||||
#if defined (linux)
|
||||
if (!name[0])
|
||||
{
|
||||
char *name = "";
|
||||
#if defined (linux) || defined (MACOSX)
|
||||
name = getlogin ();
|
||||
if (!name)
|
||||
name = getenv ("LOGNAME");
|
||||
if (!name)
|
||||
name = "";
|
||||
}
|
||||
#endif
|
||||
int len;
|
||||
|
||||
len = strlen (name);
|
||||
ROMlib_phoney_name_string = (StringHandle) NewHandleSys (len+1);
|
||||
if (ROMlib_phoney_name_string)
|
||||
{
|
||||
HSetRBit ((Handle) ROMlib_phoney_name_string);
|
||||
str255_from_c_string (STARH (ROMlib_phoney_name_string), name);
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +304,8 @@ mmap_lowglobals (void)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined (MACOSX)
|
||||
|
||||
#if !defined (powerpc)
|
||||
PRIVATE caddr_t
|
||||
round_up_to_page_size (unsigned long addr)
|
||||
@ -379,6 +381,7 @@ mmap_conflict (void *start, size_t length)
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif /* defined (MACOSX) */
|
||||
|
||||
/*
|
||||
* This code used to try to get us memory that we could use directly (meaning
|
||||
|
Loading…
Reference in New Issue
Block a user