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.

107 lines
3.2 KiB

  1. /*
  2. - perfdll.h
  3. -
  4. * Purpose:
  5. * Declare Perfmon Init function.
  6. * To be included in the Perfmon Extension DLL portion
  7. * of an App's Perfmon Counter code.
  8. *
  9. *
  10. */
  11. #pragma once
  12. #include <perfcommon.h>
  13. //
  14. // PERF_DATA_INFO Tells the PerfMon DLL lib how to read & manage
  15. // the shared memory blocks which contain PerfMon Counter Data
  16. //
  17. typedef struct _PERF_DATA_INFO {
  18. WCHAR wszSvcName [MAX_PATH]; // Service Name of App
  19. WCHAR wszPerfSvcName [MAX_PATH]; // Service Name of Perfmon DLL
  20. WCHAR wszGlobalSMName [MAX_PATH]; // Shared Memory Block Name for Global Counters
  21. DWORD cGlobalCounters; // Count of Global Counters
  22. DWORD * rgdwGlobalCounterTypes; // Array of counter types for Global Counters
  23. WCHAR wszInstSMName [MAX_PATH]; // Shared Memory Name for Instance Counters
  24. WCHAR wszInstMutexName [MAX_PATH]; // Mutex Name for Instance Counters
  25. DWORD cInstCounters; // Count of Instance Counters
  26. DWORD * rgdwInstCounterTypes; // Array of counter types for Instance Counters
  27. DWORD * rgdwGlobalCntrScale; // Array of counter scales for global Counters
  28. } PERF_DATA_INFO;
  29. //
  30. // HrInitPerf should be called only once during the DllMain
  31. // function for your PerfMon DLL for (DLL_PROCESS_ATTACH)
  32. HRESULT HrInitPerf(PERF_DATA_INFO *pPDI);
  33. //
  34. // HrShutdownPerf should be called only once during the
  35. // DllMain function for your PerfMon DLL (DLL_PROCESS_DETACH)
  36. HRESULT HrShutdownPerf();
  37. // Function prototypes from winperf.h
  38. PM_OPEN_PROC OpenPerformanceData;
  39. PM_COLLECT_PROC CollectPerformanceData;
  40. PM_CLOSE_PROC ClosePerformanceData;
  41. HRESULT RegisterPerfDll(LPCWSTR szService,
  42. LPCWSTR szOpenFnName,
  43. LPCWSTR szCollectFnName,
  44. LPCWSTR szCloseFnName) ;
  45. // ----------------------------------------------------------------------
  46. // RegisterPerfDllEx -
  47. // Create the registry keys we need, checking to see if they're already
  48. // there.
  49. //
  50. // Parameters:
  51. // szService Service Name
  52. // szPerfSvc Service Name of Performance DLL (for Event Logging)
  53. // szPerfMsgFile Event Log Message File for the Perfmon DLL
  54. // szOpenFnName Name of the "Open" function
  55. // szCollectFnName " " " "Collect" "
  56. // szCloseFnName " " " "Close" "
  57. //
  58. // Returns:
  59. // S_OK
  60. // E_INVALIDARG
  61. // PERF_W_ALREADY_EXISTS Register Succeeded
  62. // PERF_E_ALREADY_EXISTS Register Failed
  63. // <downstream error>
  64. // ----------------------------------------------------------------------
  65. HRESULT RegisterPerfDllEx(
  66. IN LPCWSTR szService,
  67. IN LPCWSTR szPerfSvc,
  68. IN LPCWSTR szPerfMsgFile,
  69. IN LPCWSTR szOpenFnName,
  70. IN LPCWSTR szCollectFnName,
  71. IN LPCWSTR szCloseFnName ) ;
  72. // ----------------------------------------------------------------------
  73. // RegisterPerfDllEx -
  74. // Calls unlodctr to remove perf counter names and descriptions then
  75. // deletes the registry keys created by RegisterPerfDllEx.
  76. //
  77. // Parameters:
  78. // szService Service Name
  79. //
  80. // Returns:
  81. // S_OK
  82. // E_INVALIDARG
  83. // <downstream error>
  84. // ----------------------------------------------------------------------
  85. HRESULT
  86. HrUninstallPerfDll(
  87. IN LPCWSTR szService ) ;