The IWbemObjectInternals interface is intended to allow direct access to and manipulation of binary data underlying an instance of IWbemClassObject. For instance, if you have a series of IWbemClassObjects that are all instances of the same class, in order to limit consumption of memory, you can use IWbemObjectInternals::MergeClassPart to cause all objects to use a shared piece of data for the class part information, since this piece of data cannot be modified for instances.
This interface is derived from IUnknown and supports its methods.
IWbemCallResult Methods | Description |
QueryObjectInfo | Returns a bitmask containing information regarding availability of various pieces of data in the object.. |
SetObjectMemory | Sets the object's binary data to the supplied buffer. |
GetObjectMemory | Returns the object's underlying binary data in the supplied buffer. |
IsObjectInstance | Returns whether or not the object's underlying binary data describes an instance or a class. |
SetObjectParts | Sets the specified portions of the object's binary data to the data in the supplied buffer. |
GetObjectParts | Gets the specified portions of the object's binary data and copies the data into the supplied buffer |
StripClassPart | Removes the class part of an Instance object. |
SetClassPart | Sets the class part of an Instance object to the data pointed to by the supplied buffer. |
MergeClassPart | Merges the current Instance with the class part of the supplied IWbemClassObject. IWbemClassObject::AddRef() is called on the supplied object. |
The IWbemObjectInternals::QueryObjectInfo method returns a bitmap that describes the actual data underlying an IWbemClassObject. At this time, for Class Objects, this function will not return any data.
HRESULT QueryObjectInfo(Parameters
pdwInfo
Provides storage for the returned flags..
Return Values
WBEM_S_NO_ERROR | The object successfully returned . |
Notes
Note that for class objects, although the call will succeed, at this time, the flags will not contain any useful information.
The flags that can be returned in pdwInfo are as follows:
WBEM_OBJ_DECORATION_PART | The decoration part is available. |
WBEM_OBJ_INSTANCE_PART | The instance part is available. |
WBEM_OBJ_CLASS_PART | The class part is available. |
WBEM_OBJ_CLASS_PART_INTERNAL | The class part is contained internally by the object. |
WBEM_OBJ_CLASS_PART_SHARED | The class part information is held outside of the object and is shared with another object. |
The first three flags indicate whether or not specific parts are available from the object. The last two flags pertain to the class part and indicate whether or not the part is contained internally, or points to a shared piece of data. Please note that the behavior of instance objects that do not have all three parts available, is undefined.
See Also
IWbemObjectInternals::SetObjectMemory
The IWbemObjectInternals::SetObjectMemory method sets the underlying data of an IWbemClassObject to point to a supplied buffer.
HRESULT SetObjectMemory(Parameters
pMem
Specifies the underlying buffer for use by the IWbemClassObject.
dwMemSize
Specifies the size of the buffer pMem points to.
Return Values
WBEM_S_NO_ERROR | The object path was retrieved. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified. |
Note that the object memory is what defines an IWbemClassObject. The memory must contain information understood by the IWbemClassObject code or the behavior of the object will be undefined.
See Also
IWbemServices::GetObjectMemory
IWbemServices::SetObjectParts
IWbemServices::GetObjectParts
IWbemObjectInternals::GetObjectMemory
You can use the IWbemObjectInternals::GetObjectMemory method to retrieve a copy of the block of memory underlying an IWbemClassObject.
HRESULT GetObjectMemory(Parameters
pDestination
Buffer to copy data into.
dwDestBuffSize
Size of the destination buffer.
pdwUsed
Number of bytes used in the destination buffer.
Return Values
WBEM_S_NO_ERROR | The call succeeded and returned an IWbemServices pointer. |
WBEM_E_BUFFER_TOO_SMALL | The supplied buffer was too small to copy data into. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified. |
To get the size of the buffer required to copy the data into, pass a NULL for pDestination and a 0 for dwDestBuffSize. pdwUsed will be filled with the size of the internal buffer. The function will return WBEM_E_BUFFER_TOO_SMALL. Note that whenever WBEM_E_BUFFER_TOO_SMALL is returned, pdwUsed will contain the size of the internal buffer.
See Also
IWbemServices::SetObjectMemory
IWbemServices::SetObjectParts
IWbemServices::GetObjectParts
IWbemObjectInternals::IsObjectInstance
You can use the IWbemObjectInternals::IsObjectInstance method to quickly determine if an IWbemClassObject is an instance or a class.
HRESULT IsObjectInstance(Parameters
None.
Return Values
WBEM_S_NO_ERROR | The object is an instance. |
WBEM_S_FALSE | The object is not an instance.. |
This function directly accesses the Decoration Part of an IWbemClassObject to quickly determine if the object is an Instance or not.
See Also
IWbemServices::QueryObjectInfo
IWbemObjectInternals::SetObjectParts
You can use the IWbemObjectInternals::SetObjectParts method to quickly set the underlying memory for an IWbemClassObject to point to partial or full object data.
HRESULT SetObjectParts(Parameters
pMem
Buffer to copy data from.
dwMemSize
Size of the buffer pointed to by pMem.
dwParts
Bitmask of flags describing the data pointed to by pMem .
Return Values
WBEM_S_NO_ERROR | The call succeeded and reset the memory underlying the object. |
WBEM_E_INVALID_OPERATION | An invalid operation was specified. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified. |
pMem must not be NULL for this operation to succeed, and it must contain the Decoration Part (specified by dwParts).
Valid flags for dwParts are as follows:WBEM_OBJ_DECORATION_PART | The decoration part is available. |
WBEM_OBJ_INSTANCE_PART | The instance part is available. |
WBEM_OBJ_CLASS_PART | The class part is available. |
See Also
IWbemServices::GetObjectParts
IWbemServices::SetObjectMemory
IWbemServices::GetObjectMemory
IWbemObjectInternals::GetObjectParts
You can use the IWbemObjectInternals::GetObjectParts method to retrieve a copy of the specified underlying parts from an IWbemClassObject. These parts will be placed one after the other in the destinatio buffer.
HRESULT GetObjectParts(
[out] LPVOID pDestination,
[in] DWORD dwDestBuffSize,
[in] DWORD dwParts,
[out] DWORD* pdwUsed
);
Parameters
pDestination
Buffer to copy data into.
dwDestBuffSize
Size of the destination buffer.
dwParts
Parts to copy into the supplied buffer. Values described below.
pdwUsed
Number of bytes used in the destination buffer.
Return Values
WBEM_S_NO_ERROR | The call succeeded and returned appropriate data in the supplied buffer. |
WBEM_E_BUFFER_TOO_SMALL | The supplied buffer was too small to copy data into. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified. |
WBEM_E_INVALID_OPERATION | An invalid operation was requested. |
To get the size of the buffer required to copy the data into, pass a NULL for pDestination and a 0 for dwDestBuffSize. pdwUsed will be filled with the size required to copy the specified parts. The function will return WBEM_E_BUFFER_TOO_SMALL. Note that whenever WBEM_E_BUFFER_TOO_SMALL is returned, pdwUsed will contain the size required to copy the specified parts.
To specify the parts, you can use any or all of the following flags:
WBEM_OBJ_DECORATION_PART | The decoration part. |
WBEM_OBJ_INSTANCE_PART | The instance part.. |
WBEM_OBJ_CLASS_PART | The class part. |
The data will be copied out Decoration, Class then Instance, maintaining that order in terms of the actual parts copied out.
The requested part(s) must be avaliable or the operation will return WBEM_E_INVALID_OPERATION.
See Also
IWbemServices::SetObjectParts
IWbemServices::SetObjectMemory
IWbemServices::GetObjectMemory
You can use the IWbemObjectInternals::StripClassPart method to remove the class part from the IWbemClassObject. Behavior of the object until a class part is reapplied is undefined.
HRESULT StripClassPart(
void
);
Parameters
None.
Return Values
WBEM_S_NO_ERROR | The call succeeded and the class part was stripped from the underlying buffer. |
WBEM_E_OUT_OF_MEMORY | Unable to reallocate the buffer. |
WBEM_E_INVALID_OPERATION | An invalid operation was specified. |
For this operation to succeed, the class part MUST be internal. If it is not, WBEM_E_INVALID_OPERATION will be returned.
See Also
IWbemServices::SetClassPart
IWbemServices::MergeClassPart
You can use the IWbemObjectInternals::SetClassPart method to set the class part in an IWbemClassObject.
HRESULT StripClassPart(
[in] LPVOID pClassPart,
[in] DWORD dwSize
);
Parameters
pClassPart
Buffer to copy class part data from.
dwSize
Size of the buffer we are copying from.
Return Values
WBEM_S_NO_ERROR | The call succeeded and the class part was stripped from the underlying buffer. |
WBEM_E_OUT_OF_MEMORY | Unable to reallocate the buffer. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified. |
This operation will resize the underlying buffer to accomodate the class part. The class part will be copied into the resized buffer.
See Also
IWbemServices::StripClassPart
IWbemServices::MergeClassPart
You can use the IWbemObjectInternals::MergeClassPart method to set the class part in an IWbemClassObject to point to the class part of another IWbemClassObject.
HRESULT MergeClassPart(
[in] IWbemClassObject* pObj
);
Return Values
WBEM_S_NO_ERROR | The call succeeded and the class part was stripped from the underlying buffer. |
WBEM_E_OUT_OF_MEMORY | Unable to reallocate the buffer. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified. |
WBEM_E_INVALID_OPERATION | An invalid operation was specified. |
This operation will point the class part of the current object at the class part of the specified object. The specified object must be an Instance object, and it must contain a class part, or WBEM_E_INVALID_OPERATION will be returned. This function will call IWbemClassObject::AddRef() on the supplied object. When the current object is destroyed, it will call IWbemClassObject::Release() on the object it is merged with.
See Also
IWbemServices::StripClassPart
IWbemServices::SetClassPart
IWbemServices::QueryObjectInfo
IWbemServices::SetObjectParts
IWbemServices::GetObjectParts