Windows NT 4.0 source code leak
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.

102 lines
1.9 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. taststrs.c
  5. Abstract:
  6. Tasking stress test.
  7. Author:
  8. Mark Lucovsky (markl) 26-Sep-1990
  9. Revision History:
  10. --*/
  11. #include <assert.h>
  12. #include <stdio.h>
  13. #include <windows.h>
  14. #include <string.h>
  15. VOID
  16. NewProcess()
  17. {
  18. SMALL_RECT Window;
  19. Window.Left = 0;
  20. Window.Top = 0;
  21. Window.Right = 15;
  22. Window.Bottom = 5;
  23. SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE),
  24. TRUE,
  25. &Window
  26. );
  27. TerminateProcess(GetCurrentProcess(),0);
  28. }
  29. DWORD
  30. _cdecl
  31. main(
  32. int argc,
  33. char *argv[],
  34. char *envp[]
  35. )
  36. {
  37. STARTUPINFO StartupInfo;
  38. PROCESS_INFORMATION ProcessInfo;
  39. BOOL Success;
  40. DWORD st;
  41. DWORD ProcessCount;
  42. SMALL_RECT Window;
  43. ProcessCount = 0;
  44. if ( strchr(GetCommandLine(),'+') ) {
  45. NewProcess();
  46. }
  47. GetStartupInfo(&StartupInfo);
  48. Window.Left = 0;
  49. Window.Top = 0;
  50. Window.Right = 15;
  51. Window.Bottom = 5;
  52. SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE),
  53. TRUE,
  54. &Window
  55. );
  56. while ( TRUE ) {
  57. Success = CreateProcess(
  58. NULL,
  59. "constrs +",
  60. NULL,
  61. NULL,
  62. FALSE,
  63. CREATE_NEW_CONSOLE,
  64. NULL,
  65. NULL,
  66. &StartupInfo,
  67. &ProcessInfo
  68. );
  69. if (Success) {
  70. ProcessCount++;
  71. printf("Process %d Created\n",ProcessCount);
  72. st = WaitForSingleObject(ProcessInfo.hProcess,-1);
  73. (st == 0);
  74. CloseHandle(ProcessInfo.hProcess);
  75. CloseHandle(ProcessInfo.hThread);
  76. }
  77. }
  78. }