2.2.5 Class Factory Wrapper

If a client with a COMVERSION ([MS-DCOM] section 2.2.11) greater than or equal to 5.6 requests a class factory reference during activation ([MS-DCOM] section 3.1.2.5.2.3.2), the server MUST return an OBJREF_CUSTOM instance containing a marshaled representation of the class factory. The unmarshaler of the OBJREF_CUSTOM instance on the client MUST convert object creation requests on the class factory reference to normal object activation requests. This process enables the client to send its client and prototype context properties during class-factory-based object activation requests in the same way that these properties are sent during normal object activation requests.

CLSID_CFW (see section 1.9) MUST be the unmarshaler CLSID for the OBJREF_CUSTOM instance.

The format of the OBJREF_CUSTOM.pObjectData buffer for this CLSID_CFW MUST be specified as follows.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

MaxVersion

MinVersion

Clsid (16 bytes)

...

...

ServerName (variable)

...

ShortNameCount

ShortNames (variable)

...

PartitionID (16 bytes, optional)

...

...

Clsctx (optional)

BytesRemaining (optional)

LongNameCount (optional)

LongNameBytes (optional)

LongNames (variable)

...

MaxVersion (2 bytes): The major version number for this Class Factory Wrapper format; this field MUST be set to 0x0002, 0x0003, 0x0004, or 0x0005. The value indicates which fields are present, as noted in the following relevant fields.

MinVersion (2 bytes): The minor version number for this Class Factory Wrapper format; this field MUST be set to 0x0002.

Clsid (16 bytes):  A CLSID is a UUID that MUST identify the object class of the object to be created.

ServerName (variable):  A LengthPrefixedName (section 2.2.1) that contains the name of the server machine on which the object is to be created.

ShortNameCount (4 bytes):  A DWORD that MUST specify the number of elements in the ShortNames array.

ShortNames (variable):  An array of LengthPrefixedName (section 2.2.1) that MUST specify alternate names or addresses for the server machine on which the object is to be created. The Length field of each element in the array MUST be less than 16.

PartitionID (16 bytes): A GUID that MUST specify the partition ID of the partition of the object class of the server object. This field MUST NOT be present if MaxVersion is less than 0x0003 and MUST be present otherwise.

Clsctx (4 bytes):  A DWORD that MUST be set to the value of the dwOrigClsCtx field contained in the SpecialPropertiesData structure ([MS-DCOM] section 2.2.22.2.2) specified in an activation request for the class factory. This field MUST NOT be present if MaxVersion is less than 0x0003 and MUST be present otherwise.

BytesRemaining (4 bytes):  A DWORD that MUST specify the number of bytes remaining in the buffer after the BytesRemaining field. This value MUST be equal to the sum of LongNameBytes plus 8. This field MUST NOT be present if MaxVersion is less than 0x0004 and MUST be present otherwise.

LongNameCount (4 bytes):  A DWORD that MUST specify the number of elements in the LongNames array. This field MUST NOT be present if MaxVersion is less than 0x0005 and MUST be present otherwise.

LongNameBytes (4 bytes):  A DWORD that MUST specify the number of bytes needed to contain all of the names contained in the LongNames array. This field MUST NOT be present if MaxVersion is less than 0x0005 and MUST be present otherwise.

LongNames (variable):  An array of NULL-terminated Unicode strings that MUST specify alternate names or addresses for the server machine on which the object is to be created. This field MUST NOT be present if MaxVersion is less than 0x0005.