34 #include <Processes.h>
39 #include <AppleTalk.h>
43 #include <SpeechSynthesis.h>
44 #include <Resources.h>
47 #if defined __MWERKS__
48 #pragma mpwc_relax off
49 #pragma extended_errorcheck on
54 #define RANDOM_BUFSIZE 4096
64 EventRecord eventRecord;
67 PScrapStuff scrapInfo;
68 UnsignedWide usSinceStartup;
69 BYTE dataBuffer[ 2 + 8 ];
97 GetDateTime( &dateTime );
100 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
112 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
121 if( EventAvail( everyEvent, &eventRecord ) )
122 addRandomData( randomState, &eventRecord,
sizeof( EventRecord ) );
123 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
124 if( OSEventAvail( everyEvent, &eventRecord ) )
125 addRandomData( randomState, &eventRecord,
sizeof( EventRecord ) );
133 if( ( windowPtr = FrontWindow() ) != NULL )
137 #if !defined OPAQUE_TOOLBOX_STRUCTS || !OPAQUE_TOOLBOX_STRUCTS
138 addRandomData( randomState, windowPtr,
sizeof( GrafPort ) );
156 addRandomData( randomState, &point,
sizeof( Point ) );
157 FindWindow( point, &windowPtr );
158 #if !defined OPAQUE_TOOLBOX_STRUCTS || !OPAQUE_TOOLBOX_STRUCTS
159 if( windowPtr != NULL )
160 addRandomData( randomState, windowPtr,
sizeof( GrafPort ) );
164 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
165 scrapInfo = InfoScrap();
166 addRandomData( randomState, scrapInfo,
sizeof( ScrapStuff ) );
170 threadID = kCurrentThreadID;
171 GetThreadState( threadID, &threadState );
172 addRandomData( randomState, &threadState,
sizeof( ThreadState ) );
176 SndManagerStatus(
sizeof( SMStatus ), &soundStatus );
177 addRandomData( randomState, &soundStatus,
sizeof( SMStatus ) );
202 endRandomData( randomState, 10 );
209 ProcessSerialNumber psn;
210 GDHandle deviceHandle;
220 deviceHandle = GetDeviceList();
221 while( deviceHandle != NULL )
223 GDHandle currentHandle = deviceHandle;
226 HLock( ( Handle ) currentHandle );
227 devicePtr = *currentHandle;
228 deviceHandle = devicePtr->gdNextGD;
229 addRandomData( randomState, devicePtr,
sizeof( GDevice ) );
230 HUnlock( ( Handle ) currentHandle );
237 psn.highLongOfPSN = 0;
238 psn.lowLongOfPSN = kNoProcess;
239 while( !GetNextProcess( &psn ) )
241 ProcessInfoRec infoRec;
242 GetProcessInformation( &psn, &infoRec );
243 addRandomData( randomState, &infoRec,
sizeof( ProcessInfoRec ) );
251 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
252 if( ( queueHdr = GetFSQHdr() ) != NULL )
253 queuePtr = queueHdr->qHead;
254 while( queuePtr != NULL )
259 addRandomData( randomState, queuePtr, 32 );
260 queuePtr = queuePtr->qLink;
265 if( !addedFixedItems )
267 Str255 appName, volName;
268 GDHandle deviceHandle;
271 MachineLocation machineLocation;
272 ProcessInfoRec processInfo;
274 SysEnvRec sysEnvirons;
276 DefStartRec startupInfo;
277 DefVideoRec videoInfo;
279 XPPParamBlock appleTalkParams;
280 unsigned char *driverNames[] = {
281 "\p.AIn",
"\p.AOut",
"\p.AppleCD",
"\p.ATP",
"\p.BIn",
"\p.BOut",
"\p.MPP",
282 "\p.Print",
"\p.Sony",
"\p.Sound",
"\p.XPP", NULL
284 SInt16 count,
dummy, i, node, net, vRefNum, script;
285 SInt32 lcount, volume;
298 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
304 GetSysBeepVolume( &volume );
306 GetDefaultOutputVolume( &volume );
308 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
316 GetSysBeepVolume( &lcount );
322 GetFreeThreadCount( kCooperativeThread, &count );
326 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
327 GetTimeout( &count );
356 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
357 if( !DriveStatus( 1, &driveStatus ) )
358 addRandomData( randomState, &driveStatus,
sizeof (DrvSts) );
360 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
361 if( !GetVInfo( 1, volName, &vRefNum, &lcount ) )
363 addRandomData( randomState, volName,
sizeof( Str255 ) );
368 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
369 if( !DriveStatus( 2, &driveStatus ) )
370 addRandomData( randomState, &driveStatus,
sizeof (DrvSts) );
372 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
373 if( !GetVInfo( 2, volName, &vRefNum, &lcount ) )
375 addRandomData( randomState, volName,
sizeof( Str255 ) );
382 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
383 if( ( vblQueue = GetVBLQHdr() ) != NULL )
384 addRandomData( randomState, vblQueue,
sizeof( QHdr ) );
387 pramPtr = GetSysPPtr();
388 addRandomData( randomState, pramPtr,
sizeof( SysParmType ) );
391 ReadLocation( &machineLocation );
392 addRandomData( randomState, &machineLocation,
393 sizeof( MachineLocation ) );
401 deviceHandle = GetDeviceList();
407 HLock( ( Handle ) deviceHandle );
408 gdPtr = ( GDPtr ) *deviceHandle;
409 addRandomData( randomState, gdPtr,
sizeof( GDevice ) );
410 addRandomData( randomState, gdPtr->gdPMap,
sizeof( PixMap ) );
411 HUnlock( ( Handle ) deviceHandle );
413 while( ( deviceHandle = GetNextDevice( deviceHandle ) ) != NULL );
419 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
420 SysEnvirons( curSysEnvVers, &sysEnvirons );
421 addRandomData( randomState, &sysEnvirons,
sizeof( SysEnvRec ) );
425 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
426 if( GetNodeAddress( &node, &net ) )
435 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
439 ADBDataBlock adbInfo;
441 GetIndADB( &adbInfo, count );
442 addRandomData( randomState, &adbInfo,
sizeof( ADBDataBlock ) );
474 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
475 GetVol( volName, &vRefNum );
476 addRandomData( randomState, volName,
sizeof( Str255 ) );
484 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
485 if( ( queueHdr = GetVCBQHdr() ) != NULL )
486 queuePtr = queueHdr->qHead;
487 while ( queuePtr != NULL )
489 addRandomData( randomState, queuePtr,
sizeof( VCB ) );
490 queuePtr = queuePtr->qLink;
496 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
497 if( ( queueHdr = GetDrvQHdr() ) != NULL )
498 queuePtr = queueHdr->qHead;
499 while ( queuePtr != NULL )
501 addRandomData( randomState, queuePtr,
sizeof( DrvQEl ) );
502 queuePtr = queuePtr->qLink;
508 for( count = 0; count < 30; count++ )
514 script = FontScript();
516 for( count = 0; count < 30; count++ )
517 addRandomValue( randomState, GetScriptVariable( script, count ) );
518 script = IntlScript();
520 for( count = 0; count < 30; count++ )
521 addRandomValue( randomState, GetScriptVariable( script, count ) );
525 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
526 GetDefaultStartup( &startupInfo );
527 addRandomData( randomState, &startupInfo,
sizeof( DefStartRec ) );
530 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
531 GetVideoDefault( &videoInfo );
532 addRandomData( randomState, &videoInfo,
sizeof( DefVideoRec ) );
535 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
536 GetOSDefault( &osInfo );
537 addRandomData( randomState, &osInfo,
sizeof( DefOSRec ) );
541 #if !defined CALL_NOT_IN_CARBON || CALL_NOT_IN_CARBON
542 ASPGetParms( &appleTalkParams,
FALSE );
543 addRandomData( randomState, &appleTalkParams,
544 sizeof( XPPParamBlock ) );
546 addedFixedItems =
TRUE;
550 endRandomData( randomState, 100 );