PSGetNamedPropertyFromPropertyStorage function

Gets a value from serialized property storage by property name.

Syntax


PSSTDAPI PSGetNamedPropertyFromPropertyStorage(
  _In_  PCUSERIALIZEDPROPSTORAGE psps,
  _In_  DWORD                    cb,
  _In_  LPCWSTR                  pszName,
  _Out_ PROPVARIANT              *ppropvar
);

Parameters

psps [in]

Type: PCUSERIALIZEDPROPSTORAGE

A pointer to an allocated buffer that contains the serialized properties. Call IPersistSerializedPropStorage::GetPropertyStorage to obtain the buffer.

cb [in]

Type: DWORD

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

pszName [in]

Type: LPCWSTR

A pointer to a null-terminated, Unicode string that contains the name of the property.

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 by calling PSCreateMemoryPropertyStore, initializing the property store by calling IPersistSerializedPropStorage::SetPropertyStorage, and using INamedPropertyStore or IPropertyStore to retrieve the properties.

Note that PSGetNamedPropertyFromPropertyStorage 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 and PSGetPropertyFromPropertyStorage).

Examples

The following example, to be included as part of a larger program, demonstrates how to use PSGetNamedPropertyFromPropertyStorage 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 = PSGetNamedPropertyFromPropertyStorage(pStorage, cb, L"MyProperty", &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

PSGetPropertyFromPropertyStorage

 

 

Show: