PSGetPropertyFromPropertyStorage function

Gets the value of a property as stored in serialized property storage.

Syntax


PSSTDAPI PSGetPropertyFromPropertyStorage(
  _In_  PCUSERIALIZEDPROPSTORAGE psps,
  _In_  DWORD                    cb,
  _In_  REFPROPERTYKEY           rpkey,
  _Out_ PROPVARIANT              **ppropvar
);

Parameters

psps [in]

Type: PCUSERIALIZEDPROPSTORAGE

Pointer to an allocated buffer that contains the serialized properties. This buffer is obtained by a call to IPersistSerializedPropStorage::GetPropertyStorage.

cb [in]

Type: DWORD

The size, in bytes, of the USERIALIZESPROPSTORAGE buffer pointed to by psps.

rpkey [in]

Type: REFPROPERTYKEY

Reference to the PROPERTYKEY that identifies the property for which to get the value.

ppropvar [out]

Type: PROPVARIANT**

When this function returns, contains the requested value.

Return value

Type: PSSTDAPI

Returns S_OK if successful, or an error value otherwise.

Remarks

This function is intended to be called if the calling application already has a serialized property storage and needs no more than a few properties from storage. If many properties need to be retrieved, performance can be enhanced by creating a memory property store through PSCreateMemoryPropertyStore, initializing the property store by calling IPersistSerializedPropStorage::SetPropertyStorage, and by using IPropertyStore to retrieve the properties.

Note that PSGetPropertyFromPropertyStorage works only on serialized buffers created by the system implementation of IPersistSerializedPropStorage. You must first obtain a memory property store by calling PSCreateMemoryPropertyStore. That store can then create a serialized buffer using the IPersistSerializedPropStorage interface.

Although SERIALIZEDPROPSTORAGE is an opaque serialized data structure whose format may change in the future, earlier formats will be supported on subsequent versions of Windows. Because the format is opaque, applications should use supported property storage APIs to access and manipulate the serialized buffer (see IPersistSerializedPropStorage).

Examples

The following example, to be included as part of a larger program, demonstrates how to use PSGetPropertyFromPropertyStorage to read a value from serialized property storage.


// SERIALIZEDPROPSTORAGE *pStorage;
// DWORD cbStorage;
// Assume the variables pStorage and cbStorage are initialized and valid.  
PROPVARIANT propvar;

HRESULT hr = PSGetPropertyFromPropertyStorage(pStorage, cb, PKEY_Rating, &propvar);

if (SUCCEEDED(hr))
{
    // propvar is now valid.
 
    PropVariantClear(&propvar);
}

Requirements

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propsys.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

PSGetNamedPropertyFromPropertyStorage

 

 

Show: