mirror of
https://github.com/softdorothy/Pararena2.git
synced 2024-06-11 01:29:28 +00:00
1 line
7.8 KiB
C
1 line
7.8 KiB
C
|
/*============================================================*/
/*============================================================*/
/*== ==*/
/*== Valid Install File ==*/
/*== ==*/
/*============================================================*/
/*============================================================*/
/*======================================================== Includes */
#include "Globals.h"
#include "UnivUtilities.h"
#include "ValidInstall.h"
#include "FileError.h"
/*======================================================== Local Variables */
short theSystemVol;
Boolean legitMasterDisk, bailOut;
/*======================================================== Functions */
/*======================================================== xxxx */
short GetSystemVolume (void)
{
SysEnvRec thisWorld;
OSErr theErr;
short theRefNum;
theRefNum = 0;
theErr = SysEnvirons(1, &thisWorld); /* get system info */
if (theErr == noErr)
theRefNum = thisWorld.sysVRefNum;
return(theRefNum);
}
/*======================================================== VolumeCreated */
long VolumeCreated (void)
{
SysEnvRec thisWorld;
HParamBlockRec theBlock;
long created;
OSErr theErr;
created = 0;
theErr = SysEnvirons(1, &thisWorld); /* get system info */
if ((theErr == noErr) || (theErr == envNotPresent))
{
theBlock.volumeParam.ioVolIndex = 0; /* set up paramBlock */
theBlock.volumeParam.ioNamePtr = (StringPtr)kNilPointer;
theBlock.volumeParam.ioVRefNum = thisWorld.sysVRefNum;
theBlock.volumeParam.ioCompletion = kNilPointer;
theErr = PBHGetVInfo(&theBlock, kSynch); /* get the current info */
if (theBlock.volumeParam.ioResult == noErr)
created = theBlock.volumeParam.ioVCrDate;
}
return (created);
}
/*======================================================== VolumeMatchesPrefs */
Boolean VolumeMatchesPrefs (long prefsSay, long *thisEncrypt)
{
DateTimeRec dateRecord;
unsigned long theseSeconds;
Boolean legit;
*thisEncrypt = VolumeCreated();
*thisEncrypt ^= kEncryptMask;
if (*thisEncrypt == prefsSay)
legit = TRUE;
else
{
GetDateTime(&theseSeconds);
Secs2Date(theseSeconds, &dateRecord);
if ((dateRecord.month == 11) && (dateRecord.day == 9) &&
(dateRecord.year == 1965))
legit = TRUE;
else
legit = FALSE;
}
return (legit);
}
/*======================================================== PowerBook100Exception */
Boolean PowerBook100Exception (void)
{
#define kPowerBook100Type 22
SysEnvRec thisWorld;
OSErr theErr;
Boolean isPowerBook100;
isPowerBook100 = FALSE;
theErr = SysEnvirons(1, &thisWorld); /* get system info */
if (theErr == noErr)
{
if (thisWorld.machineType == kPowerBook100Type)
isPowerBook100 = TRUE;
}
return (isPowerBook100);
}
/*======================================================== SpecificVolumeCreated */
Boolean SpecificVolumeCreated (void)
{
Str255 namePtr;
HParamBlockRec theBlock;
OSErr theErr;
short vRefNum;
long spaceHas, theDate;
Boolean dummyBool;
theDate = 0;
theErr = GetVInfo(1, namePtr, &vRefNum, &spaceHas); /* try drive 1 */
if (theErr == nsvErr)
theErr = GetVInfo(2, namePtr, &vRefNum, &spaceHas); /* no volume? try 2 */
if (theErr == noErr)
{
theBlock.volumeParam.ioVolIndex = 0; /* set up param block */
theBlock.volumeParam.ioNamePtr = (StringPtr)kNilPointer;
theBlock.volumeParam.ioVRefNum = vRefNum;
theBlock.volumeParam.ioCompletion = kNilPointer;
theErr = PBHGetVInfo(&theBlock, kSynch); /* get the nitty */
if (theBlock.volumeParam.ioResult == noErr)
theDate = theBlock.volumeParam.ioVCrDate; /* get volume created */
}
else if (theErr != nsvErr)
{
dummyBool = CheckFileError(theErr, "\pValidation");
DeathError(kErrFailedValidation);
}
tempLong = theDate;
return (theDate == kLegalVolumeCreation);
}
/*======================================================== MasterFilter */
pascal Boolean MasterFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit)
{
|