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.

140 lines
3.4 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // ScriptSupport.h : Declaration of scripting support class
  3. // Copyright (c)1997-2001 Microsoft Corporation
  4. //
  5. // Original Create Date: 6/1/2001
  6. // Original Author: shawnwu
  7. // Note: Theoretically, WMI allows us to script its object. That truly
  8. // works for regular scripts. However, I found that any extension
  9. // function written in VBScript (JScript) can't use WMI objects.
  10. // But it can use regular scriptable objects.
  11. //////////////////////////////////////////////////////////////////////
  12. #pragma once
  13. #include "globals.h"
  14. /*
  15. Class description
  16. Naming:
  17. CScriptSupport stands for Scripting Support.
  18. Base class:
  19. (1) CComObjectRootEx for threading model and IUnknown.
  20. (2) CComCoClass for it to be externally creatable.
  21. (3) ISupportErrorInfo for error info support.
  22. (4) INetSecProvMgr, which is what this object really do
  23. Purpose of class:
  24. (1) A scripting support helper object, which is exposed to the outside world
  25. via our Type library under the class name of NetSecProvMgr.
  26. Design:
  27. (1) Very simple and typical Dual interface implementation.
  28. Use:
  29. (1) This class is intended for script to use, really. So, script
  30. can create our object by CreateObject("NetSecProv.NetSecProvMgr");
  31. (2) If you want to use it inside our own code, follow normal CComObject creation
  32. sequence to create it and then call the functions.
  33. Notes:
  34. (1) $undone:shawnwu, This is just testing for now. Don't check in the code.
  35. */
  36. class ATL_NO_VTABLE CScriptSupport :
  37. public CComObjectRootEx<CComMultiThreadModel>,
  38. public CComCoClass<CScriptSupport, &CLSID_NetSecProvMgr>,
  39. public ISupportErrorInfo,
  40. public IDispatchImpl<INetSecProvMgr, &IID_INetSecProvMgr, &LIBID_NetSecProvLib>
  41. {
  42. protected:
  43. CScriptSupport();
  44. virtual ~CScriptSupport();
  45. BEGIN_COM_MAP(CScriptSupport)
  46. COM_INTERFACE_ENTRY(IDispatch)
  47. COM_INTERFACE_ENTRY(INetSecProvMgr)
  48. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  49. END_COM_MAP()
  50. DECLARE_NOT_AGGREGATABLE( CScriptSupport )
  51. DECLARE_REGISTRY_RESOURCEID(IDR_NETSECPROV)
  52. DECLARE_PROTECT_FINAL_CONSTRUCT()
  53. public:
  54. //
  55. // ISupportErrorInfo:
  56. //
  57. STDMETHOD(InterfaceSupportsErrorInfo) (
  58. REFIID riid
  59. );
  60. //
  61. // INetSecProvMgr methods:
  62. //
  63. //
  64. // [id][propget], piLower is [retval][out]
  65. //
  66. STDMETHOD(get_RandomPortLower) (
  67. OUT long * piLower
  68. );
  69. //
  70. // [id][propget], piUpper is [retval][out]
  71. //
  72. STDMETHOD(get_RandomPortUpper) (
  73. OUT long * piUpper
  74. );
  75. STDMETHOD(ExecuteQuery) (
  76. IN BSTR bstrNamespace,
  77. IN BSTR bstrQuery,
  78. IN BSTR bstrDelimiter,
  79. IN BSTR bstrPropName,
  80. OUT BSTR * pbstrResult
  81. );
  82. STDMETHOD(GetProperty) (
  83. IN BSTR bstrNamespace,
  84. IN BSTR bstrObjectPath,
  85. IN BSTR bstrPropName,
  86. OUT VARIANT * pvarValue
  87. );
  88. protected:
  89. HRESULT GetNamespace (
  90. IN BSTR bstrNamespace,
  91. OUT IWbemServices ** ppNS
  92. );
  93. };