Source code of Windows XP (NT5)
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.

139 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. iscaptrc.cpp
  5. Abstract:
  6. Source file to contain variables required for capacity planning tracing
  7. of IIS.
  8. Author:
  9. 07-Nov-1998 SaurabN
  10. Revision History:
  11. --*/
  12. //
  13. //
  14. //
  15. #include "isatq.hxx"
  16. #include <objbase.h>
  17. #include <initguid.h>
  18. #include <iscaptrc.h>
  19. #define ResourceName L"MofResource"
  20. #define ImagePath L"inetinfo.exe"
  21. DWORD IISCapTraceFlag = 0;
  22. TRACEHANDLE IISCapTraceRegistrationHandle = (TRACEHANDLE) 0;
  23. TRACEHANDLE IISCapTraceLoggerHandle = (TRACEHANDLE) 0;
  24. ULONG
  25. IISCapTraceControlCallback(
  26. IN WMIDPREQUESTCODE RequestCode,
  27. IN PVOID RequestContext,
  28. IN OUT ULONG *InOutBufferSize,
  29. IN OUT PVOID Buffer
  30. );
  31. TRACE_GUID_REGISTRATION IISCapTraceGuids[] =
  32. {
  33. { (LPGUID) &IISCapTraceGuid,
  34. NULL
  35. },
  36. };
  37. ULONG
  38. _stdcall
  39. IISInitializeCapTrace(
  40. PVOID Param
  41. )
  42. {
  43. ULONG status;
  44. status = RegisterTraceGuidsW(
  45. IISCapTraceControlCallback,
  46. NULL,
  47. (LPGUID) &IISCapControlGuid,
  48. 1,
  49. IISCapTraceGuids,
  50. NULL,
  51. NULL,
  52. &IISCapTraceRegistrationHandle);
  53. if (status != ERROR_SUCCESS) {
  54. DBGPRINTF((DBG_CONTEXT,"Capacity Planning Trace registration failed with %x\n",status));
  55. }
  56. return status;
  57. }
  58. ULONG
  59. IISCapTraceControlCallback(
  60. IN WMIDPREQUESTCODE RequestCode,
  61. IN PVOID RequestContext,
  62. IN OUT ULONG *InOutBufferSize,
  63. IN OUT PVOID Buffer
  64. )
  65. {
  66. PWNODE_HEADER Wnode = (PWNODE_HEADER)Buffer;
  67. ULONG Status;
  68. ULONG RetSize;
  69. Status = ERROR_SUCCESS;
  70. switch (RequestCode)
  71. {
  72. case WMI_ENABLE_EVENTS:
  73. {
  74. IISCapTraceLoggerHandle =
  75. GetTraceLoggerHandle(Buffer);
  76. IISCapTraceFlag = 1;
  77. RetSize = 0;
  78. break;
  79. }
  80. case WMI_DISABLE_EVENTS:
  81. {
  82. IISCapTraceFlag = 0;
  83. RetSize = 0;
  84. IISCapTraceLoggerHandle = (TRACEHANDLE) 0;
  85. break;
  86. }
  87. default:
  88. {
  89. RetSize = 0;
  90. Status = ERROR_INVALID_PARAMETER;
  91. break;
  92. }
  93. }
  94. *InOutBufferSize = RetSize;
  95. return Status;
  96. } // IISCapTraceControlCallback
  97. DWORD GetIISCapTraceFlag()
  98. {
  99. return IISCapTraceFlag;
  100. }
  101. TRACEHANDLE GetIISCapTraceLoggerHandle()
  102. {
  103. return IISCapTraceLoggerHandle;
  104. }
  105. VOID SetIISCapTraceFlag(DWORD dwFlag)
  106. {
  107. IISCapTraceFlag = dwFlag;
  108. }