As far as I can tell, `CryptGenRandom` can never return less than `size` bytes, so this loop can be simplified to just checking for errors and retrying?