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.

132 lines
4.5 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // File: StressInstance.h
  3. //
  4. // Copyright (c) 2001 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // Purpose:
  7. // StressInstance.h: interface for the StressInstance class.
  8. // This class is used spawn and monitor instances of the stressEXE app.
  9. //
  10. // History:
  11. // 02/15/01 DennisCh Created
  12. //
  13. //////////////////////////////////////////////////////////////////////
  14. //////////////////////////////////////////////////////////////////////
  15. // Includes
  16. //////////////////////////////////////////////////////////////////////
  17. //
  18. // WIN32 headers
  19. //
  20. #define UNICODE
  21. #define _UNICODE
  22. #include <stdio.h>
  23. #include <windows.h>
  24. #include <tchar.h>
  25. #include <winhttp.h>
  26. //
  27. // Project headers
  28. //
  29. #include <debugger.h>
  30. //////////////////////////////////////////////////////////////////////
  31. // Constants
  32. //////////////////////////////////////////////////////////////////////
  33. #if !defined(AFX_STRESSINSTANCE_H__806226FB_2170_4FE3_ACCA_EF8952E6A524__INCLUDED_)
  34. #define AFX_STRESSINSTANCE_H__806226FB_2170_4FE3_ACCA_EF8952E6A524__INCLUDED_
  35. #if _MSC_VER > 1000
  36. #pragma once
  37. #endif // _MSC_VER > 1000
  38. #define RESPONSE_HEADER__STRESS_BEGIN _T("WinHttpStress_Begin: Begin Stress")
  39. #define RESPONSE_HEADER__STRESS_END _T("WinHttpStress_End: End Stress")
  40. // ***************************
  41. // ** max string URL length
  42. #define MAX_STRESS_URL MAX_PATH * 2
  43. // ***************************
  44. // ** time to check the stress exe in milliseconds
  45. #define STRESSINSTANCE_MONITOR_EXE_TIME 1200000 // 20 minutes
  46. // ***************************
  47. // ** Command line CreateProcess will use. Takes two params: the path+filename of the stressExe and CDB pipe name
  48. //#define STRESSINSTANCE_DEBUG_COMMANDLINE _T("c:\\debuggers\\remote.exe /s \"c:\\debuggers\\cdb.exe -g -G \"%s\"\" %s")
  49. #define STRESSINSTANCE_DEBUG_COMMANDLINE _T("\"%s\"")
  50. // ***************************
  51. // ** Memory dump path
  52. #define STRESSINSTANCE_DEFAULT_MEMORY_DUMP_PATH _T("\\\\hairball\\dump$\\")
  53. // ***************************
  54. // ** relative path to the directory where the stressExe files will be downloaded to.
  55. #define STRESSINSTANCE_STRESS_EXE_DOWNLOAD_DIR _T("stressExe")
  56. // ***************************
  57. // ** Time to wait for stressExe to close after telling it
  58. #define STRESSINSTANCE_STRESS_EXE_CLOSE_TIMEOUT 100
  59. // ***************************
  60. // ** Cross process event object names. We append the PID of the process to the end to prevent name collisions.
  61. #define STRESSINSTANCE_STRESS_EXE_EVENT_EXITPROCESS _T("ExitProcessEvent")
  62. class StressInstance
  63. {
  64. public:
  65. StressInstance();
  66. virtual ~StressInstance();
  67. BOOL Begin();
  68. VOID End();
  69. BOOL IsRunning(DWORD);
  70. DWORD Get_ID();
  71. LPTSTR Get_StressExeMemoryDumpPath();
  72. VOID Set_StressExeMemoryDumpPath(LPTSTR);
  73. VOID Set_StressExeURL(LPTSTR);
  74. VOID Set_StressExePdbURL(LPTSTR);
  75. VOID Set_StressExeSymURL(LPTSTR);
  76. VOID Set_StressExeID(DWORD);
  77. VOID Set_PageHeapCommands(LPCTSTR);
  78. VOID Set_UMDHCommands(LPCTSTR);
  79. BOOL DownloadStressExe();
  80. // This is the timer callback proc that monitors the stressExe process.
  81. friend VOID CALLBACK StressExe_TimerProc(HWND, UINT, UINT_PTR, DWORD);
  82. // This is the timer callback proc for the debugger object
  83. friend DWORD DebuggerCallbackProc(DWORD, LPVOID, LPTSTR, LPVOID);
  84. private:
  85. DWORD m_dwStressExe_ID; // ID from the stressAdmin DB uniquely identifying this stress EXE.
  86. LPTSTR m_szStressExe_URL; // URL to the stress app
  87. LPTSTR m_szStressExe_PDB_URL; // URL to the stress app's pdb file
  88. LPTSTR m_szStressExe_SYM_URL; // URL to the stress app's sym file
  89. LPTSTR m_szStressExe_FilePath; // Local relative path of the downloaded stress EXE
  90. LPTSTR m_szStressExe_FileName; // Local filename of the downloaded stress EXE
  91. LPTSTR m_szStressExe_FilePathAndName; // Path and filename to the local stressExe downloaded
  92. LPTSTR m_szStressExe_PageHeapCommandLine; // Command line params when enabling pageheap.
  93. LPTSTR m_szStressExe_UMDHCommandLine; // Command line params when enabling UMDH.
  94. LPTSTR m_szStressExe_MemDumpPath; // path that the minidump will dump to
  95. Debugger *m_objDebugger; // the debughelp debugger object
  96. PROCESS_INFORMATION m_piStressExeProcess; // stuct containing info on the stressExe process
  97. HANDLE m_hStressExe_ProcessExitEvent; // Cross process event we send stressExe to tell it to exit
  98. };
  99. #endif // !defined(AFX_STRESSINSTANCE_H__806226FB_2170_4FE3_ACCA_EF8952E6A524__INCLUDED_)