Changeset 1670 for trunk/eraser6/Eraser.Manager/EntropySource.cs
- Timestamp:
- 1/25/2010 4:57:38 AM (3 years ago)
- Location:
- trunk/eraser6
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
Eraser.Manager/EntropySource.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6
- Property svn:mergeinfo changed
/branches/eraser6/6.0 merged: 1669
- Property svn:mergeinfo changed
-
trunk/eraser6/Eraser.Manager/EntropySource.cs
r1363 r1670 418 418 } 419 419 #endif 420 421 //Query performance data. Because the Win32 version of this API (through422 //the registry) may be buggy, use the NT Native API instead.423 //424 //Scan the first 64 possible information types (we don't bother with increasing425 //the buffer size as we do with the Win32 version of the performance data426 //read, we may miss a few classes but it's no big deal). In addition the427 //returned size value for some classes is wrong (eg 23 and 24 return a428 //size of 0) so we miss a few more things, but again it's no big deal. This429 //scan typically yields around 20 pieces of data, there's nothing in the430 //range 65...128 so chances are there won't be anything above there either.431 uint dataWritten = 0;432 byte[] infoBuffer = new byte[65536];433 uint totalEntropy = 0;434 for (uint infoType = 0; infoType < 64; ++infoType)435 {436 uint sysInfo = NTApi.NtQuerySystemInformation(infoType, infoBuffer,437 (uint)infoBuffer.Length, out dataWritten);438 439 if (sysInfo == 0 /*ERROR_SUCCESS*/ && dataWritten > 0)440 {441 byte[] entropy = new byte[dataWritten];442 Buffer.BlockCopy(infoBuffer, 0, entropy, 0, (int)dataWritten);443 result.AddRange(entropy);444 totalEntropy += dataWritten;445 }446 }447 448 result.AddRange(StructToBuffer(totalEntropy));449 450 420 //Finally, our good friend CryptGenRandom() 451 421 byte[] cryptGenRandom = new byte[1536];
Note: See TracChangeset
for help on using the changeset viewer.
