21 #include <FeatureMgr.h>
25 #include <MemoryMgr.h>
26 #include <SystemMgr.h>
27 #include <SysThread.h>
38 #define RANDOM_BUFSIZE 1024
54 flag = EvtEventAvail();
56 flag = EvtSysEventAvail(
TRUE );
58 EvtGetPen( &xCoord, &yCoord, &flag );
61 winHandle = EvtGetFocusWindow();
67 ticks = TimGetTicks();
68 addRandomData( randomState, &ticks,
sizeof( uint64_t ) );
69 nsTime = SysGetRunTime();
70 addRandomData( randomState, &nsTime,
sizeof( nsecs_t ) );
76 nsTime = system_real_time();
77 addRandomData( randomState, &nsTime,
sizeof( nsecs_t ) );
78 nsTime = system_time();
79 addRandomData( randomState, &nsTime,
sizeof( nsecs_t ) );
82 endRandomData( randomState, 5 );
90 struct batteryInfoType {
91 uint16_t warnThreshold;
92 uint16_t criticalThreshold;
93 uint16_t shutdownThreshold;
99 const FontType *fontPtr;
100 MenuBarType *menuPtr;
101 void *stackStart, *stackEnd;
102 MemHeapInfoType memInfo;
103 RectangleType rectangleInfo;
104 EvtQueueHandle evtQueueHandle;
105 DatabaseID databaseID;
108 WinFlagsType winFlags;
120 evtQueueHandle = EvtGetThreadEventQueue();
122 SysCurAppDatabase( &databaseID );
124 SysGetStackInfo( &stackStart, &stackEnd );
125 addRandomData( randomState, &stackStart,
sizeof(
void * ) );
126 addRandomData( randomState, &stackEnd,
sizeof(
void * ) );
127 fontID = FntGetFont();
129 fontPtr = FntGetFontPtr();
130 addRandomData( randomState, &fontPtr,
sizeof( FontType * ) );
131 formID = FrmGetActiveFormID();
137 formPtr = FrmGetFormPtr( formID );
138 addRandomData( randomState, &formPtr,
sizeof( FormType * ) );
140 menuPtr = MenuGetActiveMenu();
141 addRandomData( randomState, &menuPtr,
sizeof( MenuBarType * ) );
146 MemDynHeapGetInfo( &memInfo );
147 addRandomData( randomState, &memInfo,
sizeof( MemHeapInfoType ) );
153 winHandle = WinGetActiveWindow();
155 winFlags = WinGetWindowFlags( winHandle );
157 WinGetWindowFrameRect( winHandle, &rectangleInfo );
158 addRandomData( randomState, &rectangleInfo,
sizeof( RectangleType ) );
159 winHandle = WinGetDisplayWindow();
161 winHandle = WinGetDrawWindow();
163 winFlags = WinGetWindowFlags( winHandle );
165 WinGetDrawWindowBounds( &rectangleInfo );
166 addRandomData( randomState, &rectangleInfo,
sizeof( RectangleType ) );
167 WinGetClip( &rectangleInfo );
168 addRandomData( randomState, &rectangleInfo,
sizeof( RectangleType ) );
169 pattern = WinGetPatternType();
171 if( FtrGet( sysFtrCreator, sysFtrNumWinVersion, &version ) == errNone && \
178 scaleType = WinGetScalingMode();
186 if( FtrGet( sysFileCExpansionMgr,expFtrIDVersion, &version ) == errNone )
188 uint32_t slotIterator = expIteratorStart;
191 while( slotIterator != expIteratorStop && \
192 ExpSlotEnumerate( &slotRefNum, &slotIterator ) == errNone )
194 ExpCardInfoType cardInfo;
195 CardMetricsType cardMetrics;
198 ExpCardInfo( slotRefNum, &cardInfo );
199 addRandomData( randomState, &cardInfo,
sizeof( ExpCardInfoType ) );
200 ExpCardMetrics( slotRefNum, &cardMetrics );
201 addRandomData( randomState, &cardMetrics,
sizeof( CardMetricsType ) );
207 if( FtrGet( sysFileCVFSMgr, vfsFtrIDVersion, &version ) == errNone )
209 uint32_t volIterator = vfsIteratorStart;
212 while( volIterator != vfsIteratorStop && \
213 VFSVolumeEnumerate( &volRefNum, &volIterator ) == errNone )
215 VolumeInfoType volInfo;
216 uint32_t volUsed, volTotal;
219 VFSVolumeInfo( volRefNum, &volInfo );
220 addRandomData( randomState, &volInfo,
sizeof( VolumeInfoType ) );
221 VFSVolumeSize( volRefNum, &volUsed, &volTotal );
228 if( SysBatteryInfo(
FALSE, &batteryInfo.warnThreshold,
229 &batteryInfo.criticalThreshold,
230 &batteryInfo.shutdownThreshold,
231 &batteryInfo.timeout, &batteryInfo.type,
232 &batteryInfo.pluggedIn,
233 &batteryInfo.powerLevel ) == errNone )
234 addRandomData( randomState, &batteryInfo,
235 sizeof(
struct batteryInfoType ) );
238 value = SysLCDBrightness(
FALSE, 0 );
240 value = SysLCDContrast(
FALSE, 0 );
245 if( !addedFixedItems )
252 uint16_t ftrIterator, romTokenSize;
259 for( ftrIterator = 0; \
260 FtrGetByIndex( ftrIterator,
FALSE, &ftrInfo.creator, \
261 &ftrInfo.number, &ftrInfo.value ) == errNone; \
263 addRandomData( randomState, &ftrInfo,
sizeof(
struct ftrInfoType ) );
269 if( SysGetROMToken( sysROMTokenSnum, &romToken, \
270 &romTokenSize ) == errNone && \
271 romToken != NULL && *romToken != 0xFF )
272 addRandomData( randomState, &romToken, romTokenSize );
274 addedFixedItems =
TRUE;
278 endRandomData( randomState, 100 );