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.

143 lines
3.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1997 - 1998
  5. //
  6. // File: wmiguid.cpp
  7. //
  8. // Contents: Implementation of NT Marta WMI Functions
  9. //
  10. // History: 3-31-1999 kirtd Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <aclpch.hxx>
  14. #pragma hdrstop
  15. #include <krnctx.h>
  16. #include <wmiguid.h>
  17. //
  18. // Functions from wmiguid.h which dispatch unto the CKernelContext class
  19. //
  20. DWORD
  21. MartaAddRefWMIGuidContext(
  22. IN MARTA_CONTEXT Context
  23. )
  24. {
  25. return( ( (CKernelContext *)Context )->AddRef() );
  26. }
  27. DWORD
  28. MartaCloseWMIGuidContext(
  29. IN MARTA_CONTEXT Context
  30. )
  31. {
  32. return( ( (CKernelContext *)Context )->Release() );
  33. }
  34. DWORD
  35. MartaGetWMIGuidProperties(
  36. IN MARTA_CONTEXT Context,
  37. IN OUT PMARTA_OBJECT_PROPERTIES pProperties
  38. )
  39. {
  40. return( ( (CKernelContext *)Context )->GetKernelProperties( pProperties ) );
  41. }
  42. DWORD
  43. MartaGetWMIGuidTypeProperties(
  44. IN OUT PMARTA_OBJECT_TYPE_PROPERTIES pProperties
  45. )
  46. {
  47. if ( pProperties->cbSize < sizeof( MARTA_OBJECT_TYPE_PROPERTIES ) )
  48. {
  49. return( ERROR_INVALID_PARAMETER );
  50. }
  51. assert( pProperties->dwFlags == 0 );
  52. return( ERROR_SUCCESS );
  53. }
  54. DWORD
  55. MartaGetWMIGuidRights(
  56. IN MARTA_CONTEXT Context,
  57. IN SECURITY_INFORMATION SecurityInfo,
  58. OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor
  59. )
  60. {
  61. return( ( (CKernelContext *)Context )->GetKernelRights(
  62. SecurityInfo,
  63. ppSecurityDescriptor
  64. ) );
  65. }
  66. DWORD
  67. MartaOpenWMIGuidNamedObject(
  68. IN LPCWSTR pObjectName,
  69. IN ACCESS_MASK AccessMask,
  70. OUT PMARTA_CONTEXT pContext
  71. )
  72. {
  73. DWORD Result;
  74. CKernelContext* pKernelContext;
  75. pKernelContext = new CKernelContext;
  76. if ( pKernelContext == NULL )
  77. {
  78. return( ERROR_OUTOFMEMORY );
  79. }
  80. Result = pKernelContext->InitializeByWmiName( pObjectName, AccessMask );
  81. if ( Result != ERROR_SUCCESS )
  82. {
  83. pKernelContext->Release();
  84. return( Result );
  85. }
  86. *pContext = pKernelContext;
  87. return( ERROR_SUCCESS );
  88. }
  89. DWORD
  90. MartaOpenWMIGuidHandleObject(
  91. IN HANDLE Handle,
  92. IN ACCESS_MASK AccessMask,
  93. OUT PMARTA_CONTEXT pContext
  94. )
  95. {
  96. DWORD Result;
  97. CKernelContext* pKernelContext;
  98. pKernelContext = new CKernelContext;
  99. if ( pKernelContext == NULL )
  100. {
  101. return( ERROR_OUTOFMEMORY );
  102. }
  103. Result = pKernelContext->InitializeByHandle( Handle );
  104. if ( Result != ERROR_SUCCESS )
  105. {
  106. pKernelContext->Release();
  107. return( Result );
  108. }
  109. *pContext = pKernelContext;
  110. return( ERROR_SUCCESS );
  111. }
  112. DWORD
  113. MartaSetWMIGuidRights(
  114. IN MARTA_CONTEXT Context,
  115. IN SECURITY_INFORMATION SecurityInfo,
  116. IN PSECURITY_DESCRIPTOR pSecurityDescriptor
  117. )
  118. {
  119. return( ( (CKernelContext *)Context )->SetKernelRights(
  120. SecurityInfo,
  121. pSecurityDescriptor
  122. ) );
  123. }