Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.1 KiB

  1. #include <windows.h>
  2. #include <winioctl.h>
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <time.h>
  6. #include <ntddsac.h>
  7. #include <sacapi.h>
  8. #include <assert.h>
  9. #include <stdlib.h>
  10. //
  11. // General stress constants
  12. //
  13. #define THREADCOUNT 16
  14. #define THREAD_WAIT_TIMEOUT 2
  15. #define MAX_STRING_LENGTH 2048
  16. #define MAX_ITER_COUNT 2000
  17. //
  18. // Random # generator
  19. //
  20. #define GET_RANDOM_NUMBER(_k) ((rand()*((DWORD) _k))/RAND_MAX)
  21. //
  22. // Function type of stress threads
  23. //
  24. typedef DWORD (*CHANNEL_STRESS_THREAD)(PVOID);
  25. //
  26. // Structure passed to each stress thread
  27. //
  28. typedef struct _CHANNEL_THREAD_DATA {
  29. ULONG ThreadId;
  30. HANDLE ExitEvent;
  31. } CHANNEL_THREAD_DATA, *PCHANNEL_THREAD_DATA;
  32. //
  33. // Prototypes
  34. //
  35. PWSTR
  36. GenerateRandomStringW(
  37. IN ULONG Length
  38. );
  39. PSTR
  40. GenerateRandomStringA(
  41. IN ULONG Length
  42. );
  43. int
  44. RunStress(
  45. IN CHANNEL_STRESS_THREAD *ChannelTests,
  46. IN ULONG ChannelTestCount
  47. );