diff --git a/cipher/ChangeLog b/cipher/ChangeLog index d62219ede..6e138f4af 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,9 @@ +2002-07-02 Werner Koch + + * rndw32.c (slow_gatherer_windowsNT): Use a simple array for the + disk performance structure and increase it to the size required by + W2000. + 2002-06-29 Werner Koch * rndlinux.c: Removed HAVE_LINUX_RANDOM_H conditional because it diff --git a/cipher/rndw32.c b/cipher/rndw32.c index 484b11c52..f58d45866 100644 --- a/cipher/rndw32.c +++ b/cipher/rndw32.c @@ -318,6 +318,9 @@ gather_random_fast( void (*add)(const void*, size_t, int), int requester ) #define VER_PLATFORM_WIN32_WINDOWS 1 #endif +#define SIZEOF_DISK_PERFORMANCE_STRUCT (6*8+5*4+8*2) + + typedef struct { DWORD dwSize; DWORD th32ProcessID; @@ -617,7 +620,7 @@ slow_gatherer_windowsNT( void (*add)(const void*, size_t, int), int requester ) /* Get disk I/O statistics for all the hard drives */ for (nDrive = 0;; nDrive++) { - DISK_PERFORMANCE diskPerformance; + char diskPerformance[SIZEOF_DISK_PERFORMANCE_STRUCT]; char szDevice[50]; /* Check whether we can access this device */ @@ -630,13 +633,13 @@ slow_gatherer_windowsNT( void (*add)(const void*, size_t, int), int requester ) /* Note: This only works if you have turned on the disk performance * counters with 'diskperf -y'. These counters are off by default */ if (DeviceIoControl (hDevice, IOCTL_DISK_PERFORMANCE, NULL, 0, - &diskPerformance, sizeof (DISK_PERFORMANCE), + diskPerformance, SIZEOF_DISK_PERFORMANCE_STRUCT, &dwSize, NULL)) { if ( debug_me ) log_debug ("rndw32#slow_gatherer_nt: iostats drive %d\n", nDrive ); - (*add) ( &diskPerformance, dwSize, requester ); + (*add) (diskPerformance, dwSize, requester ); } else { log_info ("NOTE: you should run 'diskperf -y' "