Interface IMofCompiler
¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>The IMofCompiler interface is implemented by mofd.dll. It provides a COM interface which is used by the MOF Compiler and any other applications which need to compile MOF files. Objects can be obtained using the CLSID_MofCompiler CLSID.
Methods in Vtable Order
IUnknown Methods |
Properties |
QueryInterface _hmm_IMofCompiler_QueryInterface_b |
Determines if the current object supports a given interface. |
AddRef _hmm_IMofCompiler_AddRef |
Increases the object's reference count by 1. |
Release _hmm_IMofCompiler_Release |
Decrements the object's reference count, and frees the object when the reference count is zero. |
IMofCompiler Methods |
Properties |
CompileFile _hmm_IMofCompiler_CompileFile |
This method can be called to compile a particular MOF file. |
CompileBuffer _hmm_IMofCompiler_CompileBuffer |
Takes the information in a buffer and stores it into WINMGMT. The buffer must contain binary MOF data. |
CreateBMOF _hmm_IMofCompiler_CreateBMOF |
Reads a MOF file and outputs binary MOF data to another file. |
‹^
# $ K + ›IMofCompiler::QueryInterface¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>The IMofCompiler::QueryInterface method determines if the object supports a particular COM interface. If it does, the system increases the object's reference count, and the application can use that interface immediately.
HRESULT IMofCompiler::QueryInterface(
[in] REFIID
riid,[out] LPVOID *ppv
);
Parameters
riid
The COM interface identifier of the requested interface.
ppv
Address of a pointer that will be filled with the interface pointer if the query succeeds.
Return Values
Returns standard COM error codes for QueryInterface. It returns WBEM_S_NO_ERROR if the call succeeds. If the call fails because the requested interface was not supported, the method returns E_NOINTERFACE.
Remarks
When the application no longer needs the interface retrieved by a call to this method, it must call the Release method for that interface to free it. The QueryInterface method allows the extension of objects without interfering with each object's existing or future functionality.
This method is part of the IUnknown interface inherited by the object. For more information about this method, see the COM documentation in the Microsoft Platform SDK.
See Also
IUnknown Interface Basics
_hmm_IUnknown_Interface_Basics‹^
# $ K + ›IMofCompiler::AddRef¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>The IMofCompiler::AddRef method increases the object's reference count by 1.
ULONG AddRef( );
Parameters
None.
Return Values
Returns the new reference count.
Remarks
When the object is created, its reference count is set to 1. Every time an application obtains an interface to the object or calls the AddRef method, the object's reference count is increased by 1. Use the Release
_hmm_IMofCompiler_Release method to decrease the object's reference count by 1.This method is part of the IUnknown interface inherited by the object. For a complete discussion of IUnknown methods, see IUnknown Programming Basics.
For more information about this method, see the COM documentation in the Microsoft Platform SDK.
See Also
IUnknown Interface Basics
_hmm_IUnknown_Interface_Basics‹^
# $ K + ›IMofCompiler::Release¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>The IMofCompiler::Release method decreases the object's reference count by 1.
ULONG IMofCompiler::Release( );
Parameters
None.
Return Values
Returns the new reference count.
Remarks
The object deallocates itself when its reference count reaches zero. Use the AddRef
_hmm_IMofCompiler_AddRef method to increase the object's reference count by 1.This method is part of the IUnknown interface inherited by the object. For more information about this method, see the COM documentation in the Microsoft Platform SDK.
See Also
IUnknown Interface Basics
_hmm_IUnknown_Interface_Basics‹^
# $ K + ›IMofCompiler::CompileFile¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>This method compiles a MOF file (including binary MOFs) and stores the information into WINMGMT.
HRESULT IMofCompiler::CompileFile(
[in, string] LPWSTR
[in, string] LPWSTR ServerAndNamespace,
[in, string] LPWSTR User,
[in, string] LPWSTR Authority,
[in, string] LPWSTR Password,
[in] LONG lOptionFlags,
[in] LONG lClassFlags,
[in] LONG lInstanceFlags,
[in, out] WBEM_COMPILE_STATUS_INFO * pInfo
Parameters
FileName
Name of the file to be compiled.
ServerAndNamespace
Path to the default namespace where any classes or instance are to be written. A namespace on remote machine can be specified. Ex; "\\computer\root". This value may be overriden by pragmas and should not be used if auto recovery is desired. If NULL, then the ROOT\DEFAULT namespace on the local machine is the default.
User
Used to specify credentials for compiling on remote machines. If NULL, then the user context is whatever the calling process is using. This is always ignored when connecting to the local machine. See the remarks.
Authority
Used to specify credentials for compiling on remote machines. If NULL, then the Authority context is whatever the calling process is using. This is always ignored when connecting to the local machine. See the remarks.
Password
Used to specify credentials for compiling on remote machine. If NULL, the password of the current context is used. This is always ignored when connecting to the local machine.
lOptionFlags
One or more of the following flags may be combined:
WBEM_FLAG_CHECK_ONLY – Performs a syntax check only
WBEM_FLAG_AUTORECOVER – If successful, add the name of the file to the list of files to that are to be compiled during data base autorecovery. Note that this cannot be combined with either the namespace, class or instance flags.
WBEM_FLAG_CONSOLE_PRINT – If set, various useful messages are output to the console.
WBEM_FLAG_DONT_ADD_TO_LIST – If set, the file will not be added to the list of files to be compiled during auto recovery. This is not compatible with WBEM_FLAG_AUTORECOVER.
lClassFlags
Flags controlling the creation of classes. May be 0 or a combination of:
WBEM_FLAG_UPDATE_ONLY – Class creation is not allowed. May be combined with either WBEM_FLAG_UPDATE_SAFE_MODE or WBEM_FLAG_UPDATE_FORCE_MODE.
WBEM_FLAG_CREATE_ONLY – Only class creation is allowed. May not be combined with the other flags.
WBEM_FLAG_UPDATE_SAFE_MODE – Update unless conflicts exist. May be combined with WBEM_FLAG_UPDATE_ONLY.
WBEM_FLAG_UPDATE_FORCE_MODE – Update and resolve conflicts where possible. May be combined with lInstanceFlags.
lInstanceFlags
Flags controlling the creation of instances. May be either 0 or one of the following:
WBEM_FLAG_UPDATE_ONLY – Allow only updates.
WBEM_FLAG_CREATE_ONLY – Allow only new instances.
pInfo
If not NULL, then this is filled in with error information should an error occur. Note that the ObjectNum, FirstLine, and LastLine only contain values for errors that relate to a particular class of instance in the file.
struct
{
long lPhaseError; // 0 = no error, 1 = argument error, 2 = parsing, 3 error occurred while storing the data
HRESULT hRes; // Actual error code
long ObjectNum; // object which is at fault
long FirstLine; // first line number of the object
long LastLine; // last line number of the object
DWORD dwOutFlags; // reserved
} WBEM_COMPILE_STATUS_INFO;
Return Values
WBEM_S_NO_ERROR. Success.
WBEM_S_FALSE. Failure.
Remarks
The User argument may be of the form "domain\user". If that is the case, then the authority field must be NULL.
See Also
‹^
# $ K + ›IMofCompiler::CompileBuffer¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>This method compiles a buffer containing binary MOF data. Binary MOFs contain parsed data and only needs to be stored in the database.
HRESULT IMofCompiler::CompileBuffer(
[in] long
[in, size_is(BuffSize)]BYTE * pBuffer,
[in, string] LPWSTR ServerAndNamespace,
[in, string] LPWSTR User,
[in, string] LPWSTR Authority,
[in, string] LPWSTR Password,
[in] LONG lOptionFlags,
[in] LONG lClassFlags,
[in] LONG lInstanceFlags,
[in, out] WBEM_COMPILE_STATUS_INFO * pInfo
Parameters
BuffSize
Size of the data pointed to by the pBuffer argument.
pBuffer
A pointer to the binary MOF data.
ServerAndNamespace
,Ignored since the binary MOF contains the information already. Should be NULL.
User
Used to specify credentials for compiling on remote machines. If NULL, then the user context is whatever the current process is using. This is always ignored when connecting to the local machine. See the remarks.
Authority
Used to specify credentials for compiling on remote machines. If NULL, then the Authority context is whatever the current process is using. This is always ignored when connecting to the local machine. See the remarks.
Password
Used to specify credentials for compiling on remote machine. If NULL, the password of the current context is used. This is always ignored when connecting to the local machine.
lOptionFlags
One or more of the following flags may be combined:
WBEM_FLAG_CHECK_ONLY – Performs a syntax check only
WBEM_FLAG_AUTORECOVER – If successful, add the name of the file to the list of files to are to be compiled during data base autorecover. Note that this cannot be combined with either the namespace, class or instance flags.
WBEM_FLAG_CONSOLE_PRINT – If set, various useful messages are output to the console.
WBEM_FLAG_DONT_ADD_TO_LIST – If set, the file will not be added to the list of files to be compiled during auto recovery. This is not compatible with WBEM_FLAG_AUTORECOVER.
lClassFlags
Ignored since the binary MOF contains the information already. Should be 0.
lInstanceFlags
Ignored since the binary MOF contains the information already. Should be 0.
pInfo
If not NULL, then this is filled in with error information should an error occur. Note that the ObjectNum, FirstLine, and LastLine only contain values for errors that relate to a particular class of instance in the file.
struct
{
long lPhaseError; // 0 = no error, 1 = argument error, 2 = parsing, 3 error occurred while storing the data
HRESULT hRes; // Actual error code
long ObjectNum; // object which is at fault
long FirstLine; // first line number of the object
long LastLine; // last line number of the object
DWORD dwOutFlags; // reserved
} WBEM_COMPILE_STATUS_INFO;
Return Values
WBEM_S_NO_ERROR. Success.
WBEM_S_FALSE. Failure.
Remarks
The User argument may be of the form "domain\user". If that is the case, then the authority field must be NULL. Binary MOF data can be generated by CreateBMOF function. That function, stores the binary MOF data into a file, which may be read before calling this functions.
See Also
‹^
# $ K + ›IMofCompiler::CreateBMOF¦@¦<span style=color:#FF0000>
[This is preliminary documentation and subject to change.]</span>This creates a binary MOF file. This is done, by parsing a regular MOF file, and storing a binary representation of the classes and instances into a special file format. Typically, this data blob is stored as a resource in an executable file. That resource can latter be extracted for a call to CompileBuffer.
HRESULT IMofCompiler::CreateBMOF(
[in, string] LPWSTR
[in, string] LPWSTR BMOFFileName,
[in, string] LPWSTR ServerAndNamespace,
[in] LONG lOptionFlags,
[in] LONG lClassFlags,
[in] LONG lInstanceFlags,
[in, out] WBEM_COMPILE_STATUS_INFO * pInfo
Parameters
TextFileName
Name of the text file, which is to be parsed.
BMOFFileName
Name of the file where the resulting binary MOF data is to be stored.
ServerAndNamespace
Path of the default namespace where any classes or instance are to be written. This can be used to specify a namespace on a remote machine. Ex; "\\computer\root". This value may be over riden by pragmas and should not be use if auto recovery is desired. If NULL, then the ROOT\DEFAULT namespace on the local machine is the default.
lOptionFlags
One or more of the following flags may be combined;
WBEM_FLAG_CHECK_ONLY – Performs a syntax check only
WBEM_FLAG_CONSOLE_PRINT – If set, various useful messages are output to the console.
WBEM_FLAG_WMI_CHECK – If set, additional checks are done on the resulting binary MOF file using the WMIMOFCHK program which is part of the WMI SDK.
LClassFlags
Flags controlling the creation of classes. May be 0 or a combination of:
WBEM_FLAG_UPDATE_ONLY – Class creation is not allowed. May be combined with either WBEM_FLAG_UPDATE_SAFE_MODE or WBEM_FLAG_UPDATE_FORCE_MODE.
WBEM_FLAG_CREATE_ONLY – Only class creation is allowed. May not be combined with the other flags.
WBEM_FLAG_UPDATE_SAFE_MODE – Update unless conflicts exist. May be combined with WBEM_FLAG_UPDATE_ONLY.
WBEM_FLAG_UPDATE_FORCE_MODE – Update and resolve conflicts where possible. May be combined with lInstanceFlags
lInstanceFlags
Flags controlling the creation of instances. May be either 0 or one of the following:
WBEM_FLAG_UPDATE_ONLY – Allow only updates.
WBEM_FLAG_CREATE_ONLY – Allow only new instances.
pInfo
If not NULL, then this is filled in with error information should an error occur. Note that the ObjectNum, FirstLine, and LastLine only contain values for errors that relate to a particular class of instance in the file.
struct
{
long lPhaseError; // 0 = no error, 1 = argument error, 2 = parsing, 3 error occurred while store the data
HRESULT hRes; // Actual error code
long ObjectNum; // object which is at fault
long FirstLine; // first line number of the object
long LastLine; // last line number of the object
DWORD dwOutFlags; // reserved
} WBEM_COMPILE_STATUS_INFO;
Return Values
WBEM_S_NO_ERROR. Success.
WBEM_S_FALSE. Failure.
Remarks
See Also