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.

210 lines
7.0 KiB

  1. #ifndef HANDLER_H
  2. #define HANDLER_H
  3. interface IScriptletHandlerConstructor;
  4. interface IScriptletHandler;
  5. /***************************************************************************
  6. Scriptlet Interface Handlers
  7. ============================
  8. This is a preliminary draft. Changes may need to be made based on
  9. review feedback, support needed for client side security, and support
  10. for MTS scalability.
  11. The primary responsibility of a scriptlet interface handler is to
  12. aggregate a set of COM interfaces with the scriptlet base runtime
  13. and translate calls made on those COM interfaces into calls to the
  14. script name space.
  15. Interface handlers are created using a constructor object. The
  16. constructor object takes on the role similar to that of class
  17. objects in most other languages. It is intialized with the XML
  18. data nested in the implements element and then can be used for:
  19. 1. Execution - creating handler objects for scriptlet instances
  20. 2. Registration - performing handler specific registration for an object
  21. 3. Type library generation - generating a typelibrary for use with MTS
  22. ***************************************************************************/
  23. typedef WORD PK;
  24. #define pkELEMENT 0
  25. #define pkATTRIBUTE 1
  26. #define pkTEXT 2
  27. #define pkCOMMENT 3
  28. #define pkPI 4
  29. #define pkXMLDECL 5
  30. #define pkVALUE 6
  31. #define fcompileIsXML 0x0001
  32. #define fcompileValidate 0x0002
  33. #define fcompileAllowDebug 0x8000
  34. struct PNODE
  35. {
  36. PK pk;
  37. ULONG line;
  38. ULONG column;
  39. ULONG cchToken;
  40. LPCOLESTR pstrToken;
  41. PNODE *pnodeNext;
  42. union
  43. {
  44. struct
  45. {
  46. PNODE *pnodeAttr;
  47. PNODE *pnodeData;
  48. void *pvLim; // Used to calc amount of memory to allocate
  49. } element;
  50. struct
  51. {
  52. PNODE *pnodeAttr;
  53. void *pvLim;
  54. } xmldecl;
  55. struct
  56. {
  57. PNODE *pnodeValue;
  58. void *pvLim; // Used to calc amount of memory to allocate
  59. } attribute, pi;
  60. struct
  61. {
  62. void *pvLim; // Used to calc amount of memory to allocate
  63. } text, comment, value;
  64. };
  65. };
  66. DEFINE_GUID(IID_IScriptletHandlerConstructor, 0xa3d52a50, 0xb7ff, 0x11d1, 0xa3, 0x5a, 0x0, 0x60, 0x8, 0xc3, 0xfb, 0xfc);
  67. interface IScriptletHandlerConstructor : public IUnknown
  68. {
  69. STDMETHOD(Load)(WORD wFlags, PNODE *pnode) PURE;
  70. STDMETHOD(Create)(IUnknown *punkContext, IUnknown *punkOuter,
  71. IUnknown **ppunkHandler) PURE;
  72. STDMETHOD(Register)(LPCOLESTR pstrPath, REFCLSID rclisid,
  73. LPCOLESTR pstrProgId) PURE;
  74. STDMETHOD(Unregister)(REFCLSID rclsid, LPCOLESTR pstrProgId) PURE;
  75. STDMETHOD(AddInterfaceTypeInfo)(ICreateTypeLib *ptclib,
  76. ICreateTypeInfo *pctiCoclass, UINT *puiImplIndex) PURE;
  77. };
  78. DEFINE_GUID(IID_IScriptletHandler, 0xa001a870, 0xa7df, 0x11d1, 0x89, 0xbe, 0x0, 0x60, 0x8, 0xc3, 0xfb, 0xfc);
  79. interface IScriptletHandler : public IUnknown
  80. {
  81. STDMETHOD(GetNameSpaceObject)(IUnknown **ppunk) PURE;
  82. STDMETHOD(SetScriptNameSpace)(IUnknown *punkNameSpace) PURE;
  83. };
  84. #define IScriptletHandlerConstructorNew IScriptletHandlerConstructor
  85. #define IID_IScriptletHandlerConstructorNew IID_IScriptletHandlerConstructorNew
  86. /***************************************************************************
  87. Scriptlet XML Object Model Interfaces
  88. In an ideal world, we would be using a standard IPersistXML interface
  89. with a standardized XML DOM to load interface handlers from the XML
  90. data stream. Unfortunately, these interface definitions will not be ready
  91. in time for our ship date. As a result, we define our own private
  92. intefaces which we will use until the official stuff becomes available.
  93. These interfaces are designed to provide the minimal set of methods
  94. needed to implement persistence support for scriptlet interface handlers.
  95. Matching the proposed XML interfaces was a consideration, but not an
  96. overwhelming factor. The main constraint in this design is the time
  97. required to implement.
  98. The return values of the methods name and data depend on the node
  99. type. Here's a table that describes the return values for each of the
  100. types. NOTHING is signalled by the method returning S_FALSE and setting
  101. the bstr pointer to NULL.
  102. Type name method data method
  103. ==== =========== ===========
  104. ELEMENT Tag name NOTHING
  105. ATTRIBUTE Attribute name NOTHING or attribute value if exists
  106. TEXT NOTHING Characters in text
  107. COMMENT NOTHING Characters in comment
  108. PI Processing instruction Data for the PI.
  109. XMLDECL NOTHING NOTHING
  110. The getFirstChild and getAttributes methods are only valid for
  111. nodes of type ELEMENT. The nodes returned by getFirstAttribute will
  112. always be of type ScriptletXML_ATTRIBUTE.
  113. The getNext method gets the next sibling. The grfxml parameter allows
  114. you to filter out the types of nodes you're interested in. The flag
  115. fxmlText will only return only those text sequences that are not
  116. all white space. Passing in fxmlAllText will get all text nodes.
  117. ***************************************************************************/
  118. interface IScriptletXML;
  119. typedef enum
  120. {
  121. ScriptletXML_ELEMENT,
  122. ScriptletXML_ATTRIBUTE,
  123. ScriptletXML_TEXT,
  124. ScriptletXML_COMMENT,
  125. ScriptletXML_PI,
  126. ScriptletXML_XMLDECL,
  127. } ScriptletXMLNodeType;
  128. #define fxmlElement (1<<ScriptletXML_ELEMENT)
  129. #define fxmlAttribute (1<<ScriptletXML_ATTRIBUTE)
  130. #define fxmlText (1<<ScriptletXML_TEXT)
  131. #define fxmlComment (1<<ScriptletXML_COMMENT)
  132. #define fxmlPI (1<<ScriptletXML_PI)
  133. #define fxmlXMLDecl (1<<ScriptletXML_XMLDECL)
  134. #define fxmlHasText 0x0100
  135. #define kgrfxmlNormal (fxmlElement|fxmlHasText)
  136. #define kgrfxmlAll (fxmlElement|fxmlAttribute|fxmlText|fxmlComment| \
  137. fxmlPI|fxmlXMLDecl)
  138. #define fattrFailOnUnknown 0x0001
  139. DEFINE_GUID(IID_IScriptletXML, 0xddd30cc0, 0xa3fe, 0x11d1, 0xb3, 0x82, 0x0, 0xa0, 0xc9, 0x11, 0xe8, 0xb2);
  140. interface IScriptletXML : public IUnknown
  141. {
  142. STDMETHOD(getNodeType)(long *ptype) PURE;
  143. STDMETHOD(getPosition)(ULONG *pline, ULONG *pcolumn) PURE;
  144. STDMETHOD(getName)(BSTR *pbstrName) PURE;
  145. STDMETHOD(getData)(BSTR *pbstrValue) PURE;
  146. STDMETHOD(getNext)(WORD grfxmlFilter, IScriptletXML **ppxml) PURE;
  147. STDMETHOD(getFirstChild)(WORD grfxmlFilter, IScriptletXML **ppxml) PURE;
  148. STDMETHOD(getFirstAttribute)(IScriptletXML **ppxml) PURE;
  149. STDMETHOD(getAttributes)(WORD grfattr, long cattr,
  150. LPCOLESTR *prgpstrAttributes, BSTR *prgbstrValues) PURE;
  151. };
  152. DEFINE_GUID(IID_IScriptletHandlerConstructorOld, 0x67463cd0, 0xb371, 0x11d1, 0x89, 0xca, 0x0, 0x60, 0x8, 0xc3, 0xfb, 0xfc);
  153. interface IScriptletHandlerConstructorOld : public IUnknown
  154. {
  155. STDMETHOD(Load)(WORD wFlags, IScriptletXML *pxmlElement) PURE;
  156. STDMETHOD(Create)(IUnknown *punkContext, IUnknown *punkOuter,
  157. IUnknown **ppunkHandler) PURE;
  158. STDMETHOD(Register)(LPCOLESTR pstrPath, REFCLSID rclisid,
  159. LPCOLESTR pstrProgId) PURE;
  160. STDMETHOD(Unregister)(REFCLSID rclsid, LPCOLESTR pstrProgId) PURE;
  161. STDMETHOD(AddInterfaceTypeInfo)(ICreateTypeLib *ptclib,
  162. ICreateTypeInfo *pctiCoclass, UINT *puiImplIndex) PURE;
  163. };
  164. #endif // HANDLER_H