import "msxml.idl";
import "wbemdisp.idl";

[
	uuid(979D18F7-D1D2-4ee2-803D-A4C7A98DF75B),
	lcid(0x00),
	version(1.0),
	helpstring("Microsoft WMI XML Transformer V1.0")
]
library WmiXMLTransformer
{
    importlib("stdole32.tlb");

    interface IWmiXMLTransformer;

	typedef 
	[
		v1_enum, 
		uuid(28D1EEA5-D41E-46c2-B42D-6CE0B9B4D7A7),
		helpstring("Specifies Encoding required")
	] 
	enum WmiXMLEncoding
    {
		// TODO - integrate this enumeration with the core team's when they are ready
		wmiXML_CIM_DTD_2_0 = 0x0, // The DMTF DTD
		wmiXML_WMI_DTD_2_0 = 0x1, // Same as the WMI Nova DTD
		wmiXML_WMI_DTD_WHISTLER = 0x2
   	} WmiXMLEncoding;

	typedef 
	[
		v1_enum, 
		uuid(598BCA7A-E40E-4265-8517-C9A86E2FC07E),
		helpstring("Specifies the compilation operation to perform")
	] 
	enum WmiXMLCompilationTypeEnum
    {
		WmiXMLCompilationWellFormCheck = 0x0,
		WmiXMLCompilationValidityCheck = 0x1,
		WmiXMLCompilationFullCompileAndLoad = 0x2
    } WmiXMLCompilationTypeEnum;

	[
		uuid(A2BB0F35-458E-4075-8A4B-F92664943917),
		helpstring("WMI XML Transformer Control")
	]
    	coclass WmiXMLTransformer
    	{
        		[default] interface IWmiXMLTransformer;
    	};
};

/************************************************* 
 * A collection of IXMLDOMDocuments
 * This is used for output from enumerations and queries
 * The primary purpose of this is to prevent reading of all the data from a socket
 * in the XML/HTTP case. Instead every call to Next() on the enumerator results in further data
 * being read from the socket.
 **************************************************/
[
	local, 
	object, 
	uuid(3E46A227-5207-4603-8440-9FCC5AF16407), 
	oleautomation, 
	dual,
	hidden,
	nonextensible,
	helpstring("A collection of IXMLDOMDocument objects")
]
interface ISWbemXMLDocumentSet : IDispatch
{
	// Standard property required on all collections
	[id(DISPID_NEWENUM), propget, restricted] HRESULT _NewEnum ([out, retval] IUnknown **pUnk);

	[
		id(DISPID_VALUE),
		helpstring("Not Implemented")
	]
	HRESULT Item (
		[in] BSTR strObjectPath, 
		[in, defaultvalue(0)] long iFlags,
		[out, retval] IXMLDOMDocument **ppXMLDocument
		);

	[
		id(1), 
		propget,
		helpstring("Not Implemented")
	] 
	HRESULT Count ([out, retval] long *iCount);

	[
		id(2), 
		helpstring("The next item in this collection. This is primarily for C++ programs that dont want to use the enumerator")
	] 
	HRESULT NextDocument ([out, retval, unique] IXMLDOMDocument **ppDoc);

	[
		id(3), 
		helpstring("Skips past the next document in the enumerator")
	] 
	HRESULT SkipNextDocument ();

};

/************************************************* 
 * The primary interface for the transformer.
 * This scriptable interface allows for both read (get, enums, queries)
 * and write (compile) operations. It also exposes a few
 * properties to control the amount of information in the output,
 * for authentication credentials etc.
 **************************************************/
[
	object, 
	local, 
	uuid(FB624102-3145-4daf-B0EA-FF5A31178600), 
	dual,
	hidden,
	nonextensible,
	oleautomation,
	helpstring("WMI XML Transformer Dual Interface")
]
interface IWmiXMLTransformer  : IDispatch
{
	[
		propget, 
		id(1),
		helpstring("Specifies the type of XML Encoding to use")
	] 
	HRESULT XMLEncodingType([retval, out] WmiXMLEncoding *piEncoding);
	[
		propput, 
		id(1)
	] 
	HRESULT XMLEncodingType([in] WmiXMLEncoding iEncoding);

	[
		propget, 
		id(2),
		helpstring("Specifies the level of Qualifier information in the output XML")
	] 
	HRESULT QualifierFilter([retval, out] VARIANT_BOOL *bQualifierFilter);
	[
		propput, 
		id(2)
	] 
	HRESULT QualifierFilter([in] VARIANT_BOOL bQualifierFilter);

	[
		propget, 
		id(3),
		helpstring("Specifies whether to decorate elements with Class origin information")
	] 
	HRESULT ClassOriginFilter([retval, out] VARIANT_BOOL *bClassOriginFilter);
	[
		propput, 
		id(3)
	] 
	HRESULT ClassOriginFilter([in] VARIANT_BOOL bClassOriginFilter);

	[
		propget, 
		id(4),
		helpstring("Specifies the user name to be used for the operation")
	] 
	HRESULT User([retval, out] BSTR * strUser);
	[
		propput, 
		id(4)
	] 
	HRESULT User ([in] BSTR strUser);

	[
		propget, 
		id(5),
		helpstring("Specifies the password name to be used for the operation")
	] 
	HRESULT Password([retval, out] BSTR * strPassword);
	[
		propput, 
		id(5)
	] 
	HRESULT Password ([in] BSTR strPassword);

	[
		propget, 
		id(6),
		helpstring("Specifies the Authority (domain/machine)name to be used for the operation")
	] 
	HRESULT Authority([retval, out] BSTR * strAuthority);
	[
		propput, 
		id(6)
	] 
	HRESULT Authority ([in] BSTR strAuthority);

	[
		propget, 
		id(7),
		helpstring("Specifies the Impersonation level used for the operation. Standard RPC constants")
	] 
	HRESULT ImpersonationLevel([retval, out] DWORD * pdwImpersonationLevel);
	[
		propput, 
		id(7)
	] 
	HRESULT ImpersonationLevel ([in] DWORD dwImpersonationLevel);

	[
		propget, 
		id(8),
		helpstring("Specifies the AuthenticationLevel  used for the operation. Standard RPC constants")
	] 
	HRESULT AuthenticationLevel([retval, out] DWORD * pdwAuthenticationLevel);
	[
		propput, 
		id(8)
	] 
	HRESULT AuthenticationLevel ([in] DWORD dwAuthenticationLevel);

	[
		propget, 
		id(9),
		helpstring("Specifies the locale name to be used for the operation")
	] 
	HRESULT Locale([retval, out] BSTR * strLocale);
	[
		propput, 
		id(9)
	] 
	HRESULT Locale ([in] BSTR strLocale);


	[
		propget, 
		id(10),
		helpstring("Specifies whether only local elements (properties and methods) are to be included in output")
	] 
	HRESULT LocalOnly([retval, out] VARIANT_BOOL *bLocalOnly);
	[
		propput, 
		id(10)
	] 
	HRESULT LocalOnly([in] VARIANT_BOOL bLocalOnly);


	[
		helpstring("Maps a single class or instance to XML"),
		id(11)
	]
	HRESULT GetObject(
	// Identifies an object name to get
		[in]	BSTR	strObjectPath,
	// The IWbemContext object
		[in, defaultvalue(0)]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
	// On successful return contains XML document stream
        [out,retval]   IXMLDOMDocument **ppXMLDocument
    	);

	[
		helpstring("Maps a query result set to XML"),
		id(12)
	]
	HRESULT ExecQuery(
	// Identifies a namespace to connect to
		[in]	BSTR	strNamespacePath,
	// CIM query to be evaluated
		[in]	BSTR	strQuery,
	// The language name of the query to be evaluated
		[in, defaultvalue("WQL")]	BSTR	strQueryLanguage,
	// The IWbemContext object
		[in, defaultvalue(0)]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
	// On successful return contains a collection of documents
        [out,retval]   ISWbemXMLDocumentSet **ppXMLDocumentSet
   	 );

	[
		helpstring("Enumerates sub classes of a specified class"),
		id(13)
	]
	HRESULT EnumClasses(
		// Identifies the class path of the super class
		[in]	BSTR	strSuperClassPath,
		// Whether to do a deep enumeration
		[in]	VARIANT_BOOL bDeep,
		// The IWbemContext object
		[in, defaultvalue(0)]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
		// On successful return contains a collection of documents
        [out,retval]   ISWbemXMLDocumentSet **ppXMLDocumentSet
    	);

	[
		helpstring("Enumerates instances of a specific class"),
		id(14)
	]
	HRESULT EnumInstances(
		// Identifies the class path of the class whose instances are to be enumerated
		[in]	BSTR	strClassPath,
		// Whether to do a deep enumeration
		[in]	VARIANT_BOOL bDeep,
		// The IWbemContext object
		[in, defaultvalue(0)]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
		// On successful return contains a collection of documents
        [out,retval]   ISWbemXMLDocumentSet **ppXMLDocumentSet
    	);

	[
		helpstring("Enumerates sub class names of a specific class"),
		id(15)
	]
	HRESULT EnumClassNames(
		// Identifies the class path of the super class
		[in]	BSTR	strSuperClassPath,
		// Whether to do a deep enumeration
		[in]	VARIANT_BOOL bDeep,
		// The IWbemContext object
		[in, defaultvalue(0)]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
		// On successful return contains a collection of documents
        [out,retval]   ISWbemXMLDocumentSet **ppXMLDocumentSet
    	);

	[
		helpstring("Enumerate instance names of a specific class"),
		id(16)
	]
	HRESULT EnumInstanceNames(
		// Identifies the class path of the class whose instances are to be enumerated
		[in]	BSTR	strClassPath,
		// The IWbemContext object
		[in, defaultvalue(0)]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
		// On successful return contains a collection of documents
        [out,retval]   ISWbemXMLDocumentSet **ppXMLDocumentSet
    	);

	[
		helpstring("Compile a specified file"),
		id(17)
	]
	HRESULT Compile (
	// If this is a VT_BSTR, then it the string is used as the input XML data
	// If this is a VT_UNKNOWN, then it is queried for Istream and the result is used
	// as the input stream
	[in]	VARIANT 	*pvInputSource,
	// Identifies a namespace to connect to
	[in]	BSTR	strNamespacePath,
	// Class Flags - A combination of the flags used for PutClass WMI call
	[in]	LONG	lClassFlags,
	// Instance Flags - A combination of the flags used for PutInstance WMI call
	[in]	LONG	lInstanceFlags,
	// What operation to do
	[in]	WmiXMLCompilationTypeEnum iOperation,
	// The IWbemContext object
	[in]	/*ISWbemNamedValueSet*/IDispatch *pCtx,
	// Whether the compilation was successful
	[out, retval]	VARIANT_BOOL *pStatus
	);

	[
		id(18),
		propget,
		helpstring ("The collection of privileges for this object")
	]
	HRESULT Privileges ([out, retval] ISWbemPrivilegeSet **objWbemPrivilegeSet);

	[
		id(19),
		propget,
		helpstring ("The last compilation error, if any")
	]
	HRESULT CompilationErrors ([out, retval] BSTR *pstrErrors);

};

