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.

103 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. instancehelper.h
  5. Abstract:
  6. Definition of:
  7. CInstanceHelper
  8. Author:
  9. Mohit Srivastava 22-Mar-2001
  10. Revision History:
  11. --*/
  12. #ifndef _instancehelper_h_
  13. #define _instancehelper_h_
  14. #include <windows.h>
  15. #include <wbemprov.h>
  16. #include <genlex.h>
  17. #include <opathlex.h>
  18. #include <objpath.h>
  19. #include <atlbase.h>
  20. #include "sqllex.h"
  21. #include <sql_1ext.h>
  22. #include "schema.h"
  23. #include "wbemservices.h"
  24. //
  25. // forward decl
  26. //
  27. class CMetabase;
  28. class CInstanceHelper
  29. {
  30. public:
  31. CInstanceHelper(
  32. ParsedObjectPath* i_pParsedObjPath,
  33. CWbemServices* i_pNamespace);
  34. CInstanceHelper(
  35. BSTR i_bstrObjPath,
  36. CWbemServices* i_pNamespace);
  37. ~CInstanceHelper()
  38. {
  39. if(m_pParsedObjPath && m_bOwnObjPath)
  40. {
  41. m_PathParser.Free(m_pParsedObjPath);
  42. }
  43. }
  44. void GetAssociation(
  45. IWbemClassObject** o_ppObj,
  46. bool i_bVerifyLeft =true,
  47. bool i_bVerifyRight=true);
  48. void GetInstance(
  49. bool i_bCreateKeyIfNotExist,
  50. CMetabase* io_pMetabase,
  51. IWbemClassObject** o_ppObj,
  52. SQL_LEVEL_1_RPN_EXPRESSION_EXT* i_pExp=NULL);
  53. bool IsAssoc()
  54. {
  55. return (m_pWmiAssoc != NULL);
  56. }
  57. private:
  58. void Init(
  59. ParsedObjectPath* i_pParsedObjPath,
  60. CWbemServices* i_pNamespace);
  61. void PutProperty(
  62. IWbemClassObject* i_pInstance,
  63. const BSTR i_bstrPropName,
  64. VARIANT* i_vtPropValue,
  65. BOOL i_bIsInherited,
  66. BOOL i_bIsDefault);
  67. bool CheckForQueryMatch(
  68. const SQL_LEVEL_1_TOKEN* i_pToken,
  69. const VARIANT* i_pvtMatch);
  70. bool m_bOwnObjPath;
  71. ParsedObjectPath* m_pParsedObjPath;
  72. CObjectPathParser m_PathParser;
  73. WMI_CLASS* m_pWmiClass;
  74. WMI_ASSOCIATION* m_pWmiAssoc;
  75. CWbemServices* m_pNamespace;
  76. };
  77. #endif