Names in IStorage

A property set is identified with a format identifier (FMTID) in the IPropertySetStorage interface. In the IStorage interface, a property set is named with a null-terminated Unicode string with a maximum length of 32 characters. To enable interoperability, a mapping between an FMTID and a corresponding null-terminated Unicode string must be established.

Converting a property set from a FMTID to a string name

When converting from an FMTID to a corresponding Unicode string name, first verify that the FMTID is a well-known value, listed in the following table. If so, then use the corresponding well-known string name.

FMTIDString nameSemantic
F29F85E0-4FF9-1068-AB91-08002B27B3D9"\005SummaryInformation"COM2 summary information


"\005DocumentSummaryInformation"Office document summary information and user-defined properties.


Note  The DocumentSummaryInformation and UserDefined property set is unique in that it contains two sections. Multiple sections are not permitted in any other property set. For more information, see Structured Storage Serialized Property Set Format, and The DocumentSummaryInformation and UserDefined Property Sets. The first section was defined as part of COM; the second was defined by Microsoft Office.

If the FMTID is not a well-known value, then use the following procedure to algorithmically form a string name.

Aa380052.wedge(en-us,VS.85).gifTo algorithmically form a string name

  1. Convert the FMTID to little-endian byte order, if necessary.
  2. Take the 128 bits of the FMTID and consider them as one long bit string by concatenating each of the bytes together. The first bit of the 128 bit value is the least significant bit of the first byte in memory of the FMTID; the last bit of the 128 bit value is the most significant bit of the last byte in memory of the FMTID. Extend these 128 bits to 130 bits by adding two zero bits to the end.
  3. Divide the 130 bits into groups of five bits; there will be 26 such groups. Consider each group as an integer with reversed bit precedence. For example, the first of the 128 bits is the least significant bit of the first group of five bits; the fifth of the 128 bits is the most significant bit of the first group.
  4. Map each of these integers as an index into the array of thirty-two characters: ABCDEFGHIJKLMNOPQRSTUVWXYZ012345. This yields a sequence of 26 Unicode characters that uses only uppercase characters and numerals. Case sensitive and case insensitive considerations do not apply, causing each character to be unique in any locale.
  5. Create the final string by concatenating the string "\005" onto the front of these 26 characters, for a total length of 27 characters.

The following example code shows how to map from an FMTID to a property string.

#define CBIT_BYTE        8
#define CBIT_CHARMASK    5
#define CCH_MAP          (1 << CBIT_CHARMASK)    // 32
#define CHARMASK         (CCH_MAP - 1)           // 0x1f
CHAR awcMap[CCH_MAP + 1] = "abcdefghijklmnopqrstuvwxyz012345";
    return((WCHAR) awcMap[i & CHARMASK]);
VOID GuidToPropertyStringName(GUID *pguid, WCHAR awcname[]) {
    BYTE *pb = (BYTE *) pguid;
    BYTE *pbEnd = pb + sizeof(*pguid);
    ULONG cbitRemain = CBIT_BYTE;
    WCHAR *pwc = awcname;
    *pwc++ = ((WCHAR) 0x0005);
    while (pb < pbEnd) {
        ULONG i = *pb >> (CBIT_BYTE - cbitRemain);
        if (cbitRemain >= CBIT_CHARMASK) {
            *pwc = MapChar(i);
            if (cbitRemain == CBIT_BYTE && 
                                    *pwc >= L'a' && *pwc <= L'z')
                *pwc += (WCHAR) (L'A' - L'a');
            cbitRemain -= CBIT_CHARMASK;
            if (cbitRemain == 0) {
                cbitRemain = CBIT_BYTE;
        else {
            if (++pb < pbEnd) {
                i |= *pb << cbitRemain;
            *pwc++ = MapChar(i);
            cbitRemain += CBIT_BYTE - CBIT_CHARMASK;
    *pwc = L'\0';

Converting a property set from a string name to a FMTID

Converters of property string names to GUIDs should accept lowercase letters as synonymous with their uppercase counterparts.

The following example code shows how to map from a property string to an FMTID.

#include "stdafx.h"
#define _INC_OLE
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define CBIT_BYTE     8
#define CBIT_GUID    (CBIT_BYTE * sizeof(GUID))
#define WC_PROPSET0  ((WCHAR) 0x0005)
#define CCH_MAP      (1 << CBIT_CHARMASK)        // 32
#define CHARMASK     (CCH_MAP - 1)            // 0x1f
CHAR awcMap[CCH_MAP + 1] = "abcdefghijklmnopqrstuvwxyz012345";
#define CALPHACHARS  ('z' - 'a' + 1)

GUID guidSummary =
{ 0xf29f85e0,0x4ff9, 0x1068,
{ 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9 } };

WCHAR wszSummary[] = L"SummaryInformation";

GUID guidDocumentSummary =
    { 0xd5cdd502,
      0x2e9c, 0x101b,
      { 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae } };

WCHAR wszDocumentSummary[] = L"DocumentSummaryInformation";
__inline WCHAR

MapChar(IN ULONG i)
    return((WCHAR) awcMap[i & CHARMASK]);

ULONG PropertySetNameToGuid(
    IN ULONG cwcname,
    IN WCHAR const awcname[],
    OUT GUID *pguid)
    WCHAR const *pwc = awcname;

    if (pwc[0] == WC_PROPSET0)
        //Note: cwcname includes the WC_PROPSET0, and
        //sizeof(wsz...) includes the trailing L'\0', but
        //the comparison excludes both the leading
        //WC_PROPSET0 and the trailing L'\0'.
        if (cwcname == sizeof(wszSummary)/sizeof(WCHAR) &&
            wcsnicmp(&pwc[1], wszSummary, cwcname - 1) == 0)
            *pguid = guidSummary;
        if (cwcname == CWC_PROPSET)
            ULONG cbit;
            BYTE *pb = (BYTE *) pguid - 1;
            ZeroMemory(pguid, sizeof(*pguid));
            for (cbit = 0; cbit < CBIT_GUID; cbit += 
                ULONG cbitUsed = cbit % CBIT_BYTE;
                ULONG cbitStored;
                WCHAR wc;
                if (cbitUsed == 0)
                wc = *++pwc - L'A';        //assume uppercase
                if (wc > CALPHACHARS)
                    wc += (WCHAR) (L'A' - L'a'); //try lowercase
                    if (wc > CALPHACHARS)
                        wc += L'a' - L'0' + CALPHACHARS; 
                        if (wc > CHARMASK)
                            goto fail;       //invalid character
                *pb |= (BYTE) (wc << cbitUsed);
                cbitStored = min(CBIT_BYTE - cbitUsed, 

                //If the translated bits will not fit in the 
                //current byte
                if (cbitStored < CBIT_CHARMASK)
                    wc >>= CBIT_BYTE - cbitUsed;
                    if (cbit + cbitStored == CBIT_GUID)
                       if (wc != 0)
                           goto fail;        //extra bits
                    *pb |= (BYTE) wc;
           Status = NO_ERROR;

When attempting to open an existing property set, in IPropertySetStorage::Open, the (root) FMTID is converted to a string as described above. If an element of the IStorage of that name exists, it is used. Otherwise, the open fails.

When creating a new property set, the above mapping determines the string name used.