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.

136 lines
3.5 KiB

  1. /*****************************************************************************
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. ETCommon.h
  5. Abstract:
  6. This module contains all necessary header files required by
  7. this project.
  8. Author:
  9. Akhil Gokhale 03-Oct.-2000
  10. Revision History:
  11. ******************************************************************************/
  12. #ifndef _ETCOMMON_H
  13. #define _ETCOMMON_H
  14. //
  15. // general purpose macros
  16. //
  17. #define ERROR_EXIT 2500
  18. #define OPTION_HELP _T("?")
  19. #define OPTION_CREATE _T("CREATE")
  20. #define OPTION_DELETE _T("DELETE")
  21. #define OPTION_QUERY _T("QUERY")
  22. #define OPTION_SERVER _T("s")
  23. #define OPTION_USERNAME _T("u")
  24. #define OPTION_PASSWORD _T("p")
  25. #define OPTION_TRIGGERNAME _T("tr")
  26. #define OPTION_LOGNAME _T("l")
  27. #define OPTION_EID _T("eid")
  28. #define OPTION_TYPE _T("t")
  29. #define OPTION_SOURCE _T("so")
  30. #define OPTION_DESCRIPTION _T("d")
  31. #define OPTION_FORMAT _T("fo")
  32. #define OPTION_NOHEADER _T("nh")
  33. #define OPTION_VERBOSE _T("v")
  34. #define OPTION_TASK _T("tk")
  35. #define OPTION_TID _T("tid")
  36. #define OPTION_RU _T("ru")
  37. #define OPTION_RP _T("rp")
  38. HRESULT PropertyGet1( IWbemClassObject* pWmiObject,
  39. LPCTSTR szProperty,
  40. DWORD dwType, LPVOID pValue, DWORD dwSize );
  41. void PrintProgressMsg(HANDLE hOutput,LPCWSTR pwszMsg,const CONSOLE_SCREEN_BUFFER_INFO& csbi);
  42. extern DWORD g_dwOptionFlag;
  43. // CLS stands for class
  44. #define CLS_TRIGGER_EVENT_CONSUMER L"CmdTriggerConsumer"
  45. #define CLS_FILTER_TO_CONSUMERBINDING L"__FilterToConsumerBinding"
  46. #define CLS_WIN32_NT_EVENT_LOGFILE L"Win32_NTEventLogFile"
  47. #define CLS_EVENT_FILTER L"__EventFilter"
  48. // FN stands for Function name
  49. #define FN_CREATE_ETRIGGER L"CreateETrigger"
  50. #define FN_DELETE_ETRIGGER L"DeleteETrigger"
  51. #define FN_QUERY_ETRIGGER L"QueryETrigger"
  52. // FPR stands for function-parameter
  53. #define FPR_TRIGGER_NAME L"TriggerName"
  54. #define FPR_TRIGGER_DESC L"TriggerDesc"
  55. #define FPR_TRIGGER_QUERY L"TriggerQuery"
  56. #define FPR_TRIGGER_ACTION L"TriggerAction"
  57. #define FPR_TRIGGER_ID L"TriggerID"
  58. #define FPR_RETURN_VALUE L"ReturnValue"
  59. #define FPR_RUN_AS_USER L"RunAsUser"
  60. #define FPR_RUN_AS_USER_PASSWORD L"RunAsPwd"
  61. #define FPR_TASK_SCHEDULER L"ScheduledTaskName"
  62. #define QUERY_STRING L"select * from __instancecreationevent where targetinstance isa \"win32_ntlogevent\""
  63. #define ERROR_INVALID_SYNTAX 1
  64. #define RELEASE_BSTR(bstrVal) \
  65. if (bstrVal!=NULL) \
  66. { \
  67. SysFreeString(bstrVal); \
  68. bstrVal = NULL; \
  69. }\
  70. 1
  71. #define RELEASE_MEMORY( block ) \
  72. if ( (block) != NULL ) \
  73. { \
  74. delete (block); \
  75. (block) = NULL; \
  76. } \
  77. 1
  78. #define RELEASE_MEMORY_EX( block ) \
  79. if ( (block) != NULL ) \
  80. { \
  81. delete [] (block); \
  82. (block) = NULL; \
  83. } \
  84. 1
  85. #define DESTROY_ARRAY( array ) \
  86. if ( (array) != NULL ) \
  87. { \
  88. DestroyDynamicArray( &(array) ); \
  89. (array) = NULL; \
  90. } \
  91. 1
  92. #define SAFE_RELEASE_BSTR(bstr)\
  93. if(bstr != NULL)\
  94. {\
  95. SysFreeString(bstr);\
  96. bstr = NULL;\
  97. }
  98. #define ON_ERROR_THROW_EXCEPTION( hr )\
  99. if(FAILED(hr))\
  100. {\
  101. WMISaveError(hr);\
  102. _com_issue_error(hr);\
  103. }
  104. #define SAFE_RELEASE_INTERFACE( interfacepointer ) \
  105. if ( (interfacepointer) != NULL ) \
  106. { \
  107. (interfacepointer)->Release(); \
  108. (interfacepointer) = NULL; \
  109. } \
  110. 1
  111. #endif