CBaseStorageVariant
The CBaseStorageVariant structure contains the value on which to perform a match operation for a property specified in the CPropertyRestriction structure.
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
|
vType
|
vData1
|
vData2
|
vValue (variable)
|
...
|
vType (2 bytes): A type indicator that indicates the type of vValue. It MUST be one of the values specified in the following table.
Value
|
Meaning
|
VT_EMPTY
0x0000
|
vValue is not present.
|
VT_NULL
0x0001
|
vValue is not present.
|
VT_I1
0x0010
|
A 1-byte signed integer.
|
VT_UI1
0x0011
|
A 1-byte unsigned integer.
|
VT_I2
0x0002
|
A 2-byte signed integer.
|
VT_UI2
0x0012
|
A 2-byte unsigned integer.
|
VT_BOOL
0x000B
|
A Boolean value; a 2-byte integer.
Note Contains 0x0000 (FALSE) or 0xFFFF (TRUE).
|
VT_I4
0x0003
|
A 4-byte signed integer.
|
VT_UI4
0x0013
|
A 4-byte unsigned integer.
|
VT_R4
0x0004
|
An IEEE 32-bit floating point number, as defined in [IEEE754].
|
VT_INT
0x0016
|
A 4-byte signed integer.
|
VT_UINT
0x0017
|
A 4-byte unsigned integer. Note that this is identical to VT_UI4, except that VT_UINT cannot be used with VT_VECTOR (defined below); the value chosen is up to the higher layer that provides it to the Windows Search Protocol Specification, but the Windows Search Protocol Specification treats VT_UINT and VT_UI4 as identical with the exception noted above.
|
VT_ERROR
0x000A
|
A 4-byte unsigned integer containing an HRESULT, as specified in [MS-ERREF] section 2.1.
|
VT_I8
0x0014
|
An 8-byte signed integer.
|
VT_UI8
0x0015
|
An 8-byte unsigned integer.
|
VT_R8
0x0005
|
An IEEE 64-bit floating point number as defined in [IEEE754].
|
VT_CY
0x0006
|
An 8-byte two's complement integer (vValue divided by 10,000).
|
VT_DATE
0x0007
|
A 64-bit floating point number representing the number of days since 00:00:00 on December 31, 1899 (Coordinated Universal Time).
|
VT_FILETIME
0x0040
|
A 64-bit integer representing the number of 100-nanosecond intervals since 00:00:00 on January 1, 1601 (Coordinated Universal Time).
|
VT_DECIMAL
0x000E
|
A DECIMAL structure as specified in section 2.2.1.1.1.1.
|
VT_CLSID
0x0048
|
A 16-byte binary value containing a GUID.
|
VT_BLOB
0x0041
|
A 4-byte unsigned integer count of bytes in the blob, followed by that many bytes of data.
|
VT_BLOB_OBJECT
0x0046
|
A 4-byte unsigned integer count of bytes in the blob, followed by that many bytes of data.
|
VT_BSTR
0x0008
|
A 4-byte unsigned integer count of bytes in the string, followed by a string, as specified below under vValue.
|
VT_LPSTR
0x001E
|
A null-terminated string using the system code page.
|
VT_LPWSTR
0x001F
|
A null-terminated, 16-bit Unicode string. See [UNICODE].
Note The protocol uses UTF-16 LE encoding.
|
VT_COMPRESSED_LPWSTR
0x0023
|
A compressed version of a null-terminated, 16-bit Unicode string as specified in section 2.2.1.1.1.6.
Note The protocol uses UTF-16 LE encoding.
|
VT_VARIANT
0x000C
|
CBaseStorageVariant.
|
The following table specifies the type modifiers for vType. Type modifiers can be binary OR'd with vType to change the meaning of vValue to indicate that it is one of two possible array types.
Value
|
Meaning
|
VT_VECTOR
0x1000
|
If the type indicator is combined with VT_VECTOR by using an OR operator, vValue is a counted array of values of the indicated type. See section 2.2.1.1.1.2.
This type modifier MUST NOT be combined with the following types: VT_INT, VT_UINT, VT_DECIMAL, VT_BLOB, and VT_BLOB_OBJECT.
|
VT_ARRAY
0x2000
|
If the type indicator is combined with VT_ARRAY by an OR operator, the value is a SAFEARRAY containing values of the indicated type.
This type modifier MUST NOT be combined with the following types: VT_I8, VT_UI8, VT_FILETIME, VT_CLSID, VT_BLOB, VT_BLOB_OBJECT, VT_LPSTR, and VT_LPWSTR.
|
vData1 (1 byte): When vType is VT_DECIMAL, the value of this field is specified as the Scale field in section 2.2.1.1.1.1. For all other vTypes, the value MUST be set to 0x00.
vData2 (1 byte): When vType is VT_DECIMAL, the value of this field is specified as the Sign field in section 2.2.1.1.1.1. For all other vTypes, the value MUST be set to 0x00.
vValue (variable): The value for the match operation. The syntax MUST be as indicated in the vType field.
For fixed-length data types, the following table specifies the size of the vValue field in bytes.
vType
|
Size
|
VT_I1, VT,_UI1
|
1
|
VT_I2, VT_UI2, VT_BOOL
|
2
|
VT_I4, VT_UI4, VT_R4, VT_INT, VT_UINT, VT_ERROR
|
4
|
VT_I8, VT_UI8, VT_R8, VT_CY, VT_DATE, VT_FILETIME
|
8
|
VT_DECIMAL, VT_CLSID
|
16
|
For other types, the structure of vValue depends upon the value of vType as shown in the following table and diagrams.
Value of vType
|
Structure of vValue
|
Notes
|
VT_BLOB
|
First diagram.
|
|
VT_BLOB_OBJECT
|
First diagram.
|
|
VT_BSTR
|
First diagram.
|
|
VT_LPSTR
|
Second diagram.
|
string is a null-terminated system code page string. cLen is the string's length in system code page characters.
|
VT_LPWSTR
|
Second diagram.
|
String is a null-terminated Unicode string. cLen is the string's length in Unicode characters.
|
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
|
cbSize
|
blobData (variable)
|
...
|
cbSize (4 bytes): A 32-bit unsigned integer.
Note Indicates the size of the blobData field in bytes. If vType is set to VT_BSTR, cbSize MUST be set to 0x00000000 when the string represented is an empty string.
blobData (variable): MUST be of length cbSize in bytes.
For vType set to VT_BLOB or VT_BLOB_OBJECT, this field is opaque binary blob data.
For vType set to VT_BSTR, this field is a set of characters in an OEM–selected character set. The client and server MUST be configured to have interoperable character sets. There is no requirement that it be null-terminated.
For a vType set to either VT_LPSTR or VT_LPWSTR, the structure of vValue is shown in the diagram below, with the following caveats:
If vType is set to VT_LPSTR, then cLen indicates the size of the string in system code page characters and string is null-terminated.
If vType is set to VT_LPWSTR, then cLen indicates the size of the string in Unicode characters and string is a null-terminated Unicode string.
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
|
cLen
|
string (variable)
|
...
|
cLen (4 bytes): A 32-bit unsigned integer, indicating the size of the string field including the terminating null.
Note A value of 0x00000000 indicates that no such string is present.
string (variable): Null-terminated string.
Note This field MUST be absent if cLen equals 0x00000000.
CBaseStorageVariant Structures
The following structures are used in the CBaseStorageVariant structure.
DECIMAL
DECIMAL is used to represent an exact numeric value with a fixed precision and fixed scale.
When vType is set to VT_DECIMAL (0x0000E), the vData1 and vData2 fields of CBaseStorageVariant MUST be interpreted as follows:
vData1: The number of digits to the right of the decimal point. MUST be in the range 0 to 28.
vData2: The sign of the numeric value. Set to 0x00 if positive; set to 0x80 if negative.
When vType is set to VT_DECIMAL, the format of the vValue field is specified in the following diagram.
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
|
Hi32
|
Lo32
|
Mid32
|
Hi32 (4 bytes): The highest 32 bits of the 96-bit integer.
Lo32 (4 bytes): The lowest 32 bits of the 96-bit integer.
Mid32 (4 bytes): The middle 32 bits of the 96-bit integer.
VT_VECTOR
VT_Vector is used to pass one-dimensional arrays.
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
|
vVectorElements
|
vVectorData (variable)
|
...
|
vVectorElements (4 bytes): Unsigned 32-bit integer, indicating the number of elements in the vVectorData field.
vVectorData (variable): An array of items that have a type indicated by vType with the 0x1000 bit cleared. The size of an individual fixed-length item can be obtained from the fixed-length data type table, as specified in section 2.2.1.1. The length of this field, in bytes, can be calculated by multiplying vVectorElements by the size of an individual item.
For variable-length data types, vVectorData contains a sequence of consecutively marshaled simple types where the type is indicated by vType with the 0x1000 bit cleared. This includes a special case indicated by vType VT_ARRAY | VT_VARIANT (that is, 0x100C).
The elements in the vVectorData field MUST be separated by 0 to 3 padding bytes such that each element begins at an offset that is a multiple of 4 bytes from the beginning of the message that contains this array. If padding bytes are present, the value they contain is arbitrary. The content of the padding bytes MUST be ignored by the receiver.
For a vType set to VT_ARRAY | VT_VARIANT, the type for items in this sequence is CBaseStorageVariant.
SAFEARRAY
SAFEARRAY is used to pass multidimensional arrays. The structure contains array size information as well as the data in the array.
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
|
cDims
|
fFeatures
|
cbElements
|
Rgsabound (variable)
|
...
|
vData (variable)
|
...
|
cDims (2 bytes): Unsigned 16-bit integer, indicating the number of dimensions of the multidimensional array.
fFeatures (2 bytes): A 16-bit bitfield. The values represent features defined by upper-layer applications and MUST be ignored.
cbElements (4 bytes): A 32-bit unsigned integer specifying the size of each element of the array.
Rgsabound (variable): An array that contains one SAFEARRAYBOUND structure per dimension in the SAFEARRAY. This array has the left-most dimension first and the right-most dimension last.
vData (variable): A vector of marshaled items of a particular type, indicated by the vType of the containing CBaseStorageVariant, with the bit 0x2000 cleared.
vData is marshaled similarly to VT_Vector, as specified in section 2.2.1.1.1.2, but the number of items is not stored in front of the vector. Rather, the number of items is calculated by multiplying the cElements value with all safe array bounds given in the Rgsabound field. Elements are stored in a vector in order of dimensions, iterating beginning with the right-most dimension.
The following table visually represents a sample two-dimensional array. The first dimension has cElements equal to 4 (represented horizontally) and lLbound equal to 0. The second dimension has cElements equal to 2 (represented vertically) and lLbound equal to 0.
cElement 0
|
cElement 1
|
cElement 2
|
cElement 3
|
0x00000001
|
0x00000002
|
0x00000003
|
0x00000005
|
0x00000007
|
0x00000011
|
0x00000013
|
0x00000017
|
Using the previous diagram, vData will contain the following sequence: 0x00000001, 0x00000007, 0x00000002, 0x00000011, 0x00000003, 0x00000013, 0x00000005, 0x00000017 (iterating through the rightmost dimension first, and then incrementing the next dimension). The preceding Rgsabound (which records cElements and lLbound) would be: 0x00000004, 0x00000000, 0x00000002, and 0x00000000.
SAFEARRAYBOUND
The SAFEARRAYBOUND structure represents the bounds of one dimension of a SAFEARRAY or SAFEARRAY2. Its format is 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
|
cElements
|
lLbound
|
cElements (4 bytes): A 32-bit unsigned integer, specifying the number of elements in the dimension.
lLbound (4 bytes): A 32-bit unsigned integer, specifying the lower bound of the dimension.
SAFEARRAY2
SAFEARRAY2 is used to pass multidimensional arrays in SERIALIZEDPROPERTYVALUE. The structure contains boundary information as well as the data.
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
|
cDims
|
Rgsabound (variable)
|
...
|
vData (variable)
|
...
|
cDims (4 bytes): Unsigned 32-bit integer, indicating the number of dimensions of the SAFEARRAY2.
Rgsabound (variable): An array that contains one SAFEARRAYBOUND structure per dimension in the SAFEARRAY2. This array has the left-most dimension first and the right-most dimension last.
vData (variable): A vector of marshaled items of a particular type, indicated by the dwType of the containing SERIALIZEDPROPERTYVALUE, with bit 0x2000 cleared. The format of vData is the same as that specified for the vData field of SAFEARRAY.
VT_COMPRESSED_LPWSTR
The VT_COMPRESSED_LPWSTR structure contains a compressed version of a null-terminated, 16-bit Unicode string.
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
|
ccLen
|
bytes (variable)
|
...
|
ccLen (4 bytes): A 32-bit unsigned integer, indicating the number of characters in the compressed Unicode string, excluding the terminating null character. A value of 0x00000000 indicates that no such string is present.
bytes (variable): A sequence of bytes, each representing the lower byte of a two-byte Unicode character, where the higher byte of the character is always set to zero. Note that only the first 255 Unicode characters can be represented with this encoding scheme. This field MUST be absent if ccLen is set to 0x00000000.
|