Changeset 1669 for branches/eraser6/6.0


Ignore:
Timestamp:
1/25/2010 4:55:32 AM (5 years ago)
Author:
lowjoel
Message:

Removed NtQuerySystemInformation? calls for entropy gathering since .NET calls seem to cause the system to go berserk. Fixes #316: Eraser causes lag when running

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser.Manager/EntropySource.cs

    r1363 r1669  
    418418            } 
    419419#endif 
    420  
    421             //Query performance data. Because the Win32 version of this API (through 
    422             //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 increasing 
    425             //the buffer size as we do with the Win32 version of the performance data 
    426             //read, we may miss a few classes but it's no big deal).  In addition the 
    427             //returned size value for some classes is wrong (eg 23 and 24 return a 
    428             //size of 0) so we miss a few more things, but again it's no big deal. This 
    429             //scan typically yields around 20 pieces of data, there's nothing in the 
    430             //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  
    450420            //Finally, our good friend CryptGenRandom() 
    451421            byte[] cryptGenRandom = new byte[1536]; 
Note: See TracChangeset for help on using the changeset viewer.