/*
 *	Check to make sure cookie is securely installed
 *	by Ken Hollis
 *
 *	Copyright (C) 1994, Bitgate Software, all rights reserved.
 */

#include <stdio.h>
#include <stdlib.h>
#include <screen.h>
#include "winlib.h"

GLOBAL main()
{
	long *cook;
	COOKIE *cookie;
	PROGCOOKIE *pcook;

	Cur_off();
	Rev_on();

	printf("\n\n       WinLIB PRO Cookie Checker      \n");
	printf("  COPYRIGHT \275 1994, Bitgate Software  \n");
	printf(" Compiled on "__DATE__" at "__TIME__"  \n\n");

	get_cookie('WPRO', cook);
	cookie = (COOKIE *) 0x6DD02;

	if (cookie == NULL) {
		Rev_off();
		printf("Cookie not installed.\n");
		exit(1);
	}

	pcook = (PROGCOOKIE *) cookie->cookie_value;

	Rev_off();

	printf("%s\n",(pcook->magic == 0xBEEF) ? "Installation magic matched" : "Cannot locate WPRO magic!");
	printf("%ld\n",pcook->magic);
/*	printf("%s\n",(pcook->draw3d.magic == 0xBEEF) ? "Draw3D magic matched" : "No Draw3D magic");
	printf("%s\n",(pcook->textmagic == 0xBEEF) ? "TEXT magic matched" : "No TEXT magic");
	printf("%s\n",(pcook->custmenu.magic == 0xBEEF) ? "Custom menu magic matched" : "No custom menu magic");
	printf("%s\n",(pcook->deskrouts.magic == 0xBEEF) ? "Desktop rouines magic matched" : "No desktop routines magic");
	printf("%s\n",(pcook->xaes_vdimagic == 0xBEEF) ? "XAES/XVDI magic matched" : "No XAES/XVDI magic");
	printf("%s\n",(pcook->resource.magic == 0xBEEF) ? "Resource file magic matched" : "No resource file magic");
	printf("%s\n",(pcook->clipbrd_magic == 0xBEEF) ? "Clipboard magic matched" : "No clipboard magic"); */

	remove_cookie('WPRO');

	exit(0);
}