共用方式為


屬性集顯示名稱字典

屬性顯示名稱的字典可讓使用者將意義附加至屬性,而超出類型指標所提供的屬性。

字典結構

字典包含清單中的專案計數,後面接著字典專案清單。

typedef struct tagDICTIONARY 
{ 
    DWORD  cEntries ;               // Count of entries in the list 
    ENTRY  rgEntry[ cEntries ] ;    // Property ID/String pair 
} DICTIONARY ;

字典專案結構

清單中的每個字典專案都是屬性識別碼/字串組。 以下是字典專案的虛擬結構定義。 它是虛擬結構,因為 sz[] 成員的大小是可變的。

typedef struct tagENTRY 
{ 
    DWORD  propid ;    // Property ID 
    DWORD  cch ;       // Count of characters in the string 
    char  sz[cch];     // Zero-terminated string 
} ENTRY ;

範例字典

下列股票市場資料傳輸範例可能包含整個集合的可顯示名稱 「Stock Quote」,以及PID_SYMBOL的 「Ticker Symbol」。 如果屬性集只包含符號和字典,則屬性集區段會有如下所示的位元組資料流程。

Offset     Bytes 
; Start of section 
0000    5C 01 00 00    ; DWORD size of section 
0004    04 00 00 00    ; DWORD number of properties in section 
 
; Start of PropID/Offset pairs 
0008    01 00 00 00    ; DWORD Property ID (1 == code page) 
000C    28 00 00 00    ; DWORD offset to property ID 
0010    00 00 00 80    ; DWORD Property ID (0x80000000 == locale
                                                 ID) 
0014    30 00 00 00    ; DWORD offset to property ID 
0018    00 00 00 00    ; DWORD Property ID (0 == dictionary) 
001C    38 00 00 00    ; DWORD offset to property ID 
0020    07 00 00 00    ; DWORD Property ID (7 == PID_SYMBOL)
0024    5C 01 00 00    ; DWORD offset to property ID
 
; Start of Property 1 (code page)
0028    01 00 00 00    ; DWORD type indicator (VT_12)
002C    B0 04          ; USHORT codepage (0x04b0 == 1200 ==
                                                 unicode)
002E    00 00          ; Pad to 32-bit boundary
 
; Start of Property 0x80000000 (Local ID)
0030    13 00 00 00    ; DWORD type indicator (VT_U14)
0034    09 04 00 00    ; ULONG locale ID (0x0409 == American 
                                                 English)
 
; Start of Property 0 (the dictionary)
0038    08 00 00 00    ; DWORD number of entries in dictionary
                             (Note:  No type indicator)
003C    00 00 00 00    ; DWORD propid == 0 (the dictionary)
0040    0C 00 00 00    ; DWORD cch == wcslen(L"Stock Quote") +
                                                 sizeof(L'\0') == 12
0044    L"Stock Quote" ; wchar_t wsz(12)
005C    05 00 00 00    ; DWORD propid == 5 (PID_HIGH)
0060    0B 00 00 00    ; DWORD cch == wcslen(L"High Price") + 
                                                 sizeof(L'\0') == 11
0064    L"High Price\0"; wchar_t wsz(11)
007A    00 00          ; padding for 32-bit alignment (necessary
                             because the codepage is unicode)
007C    07 00 00 00    ; DWORD propid == 7 (PID_SYMBOL)
0080    0E 00 00 00    ; DWORD cch - wcslen(L"Ticker Symbol\0") 
                             == 14
0084    L"Ticker Symbol\0" ; wchar_t wsz(14)
 
    // The dictionary would continue, but may not contain entries 
    // for every possible property, and may contain entries for 
    // properties that are not present. Entries are not required  
    // to be in order.

請注意有關屬性集字典的下列問題:

  • 屬性識別碼 0 沒有類型指標。 指出專案計數的 DWORD 資料類型位於類型指標位置。
  • cch字串中的字元計數包含終止字串的零個字元。 當屬性集的字碼頁不是 Unicode 時,此欄位實際上是 位元組 計數。 對於格式為 0 的屬性集,此計數可能不會超過 256。 對於格式為 1 的屬性集,此計數可能會與屬性集大小總計所允許的大小一樣大。
  • 字典是選擇性的。 並非集合中的所有屬性名稱都必須出現在字典中。 相反地,並非字典中的所有名稱都需要對應至集合中的屬性。 字典應該省略假設由操作屬性集的應用程式可通用辨識的屬性專案。 一般而言,會省略廣泛接受標準之基底屬性集的名稱,但特殊用途屬性集可能包含供瀏覽器使用的字典。
  • 字典中的屬性名稱會儲存在 屬性識別碼 1所指示的字碼頁中。 針對 ANSI 字碼頁,每個字典專案都是位元組對齊。 因此,屬性識別碼為 0 的屬性名稱之間沒有間距。 唯一的案例是 DWORD 資料類型的值 (屬性識別碼和屬性名稱長度 DWORDs) 不需要在 32 位界限上對齊。 針對 Unicode 頁面,每個字典專案都對齊 32 位。
  • 以二進位 Unicode 字元開頭的屬性名稱,0x0001透過 0x001F 保留供日後使用。
  • 與屬性識別碼 0 相關聯的屬性名稱代表整個屬性集的名稱。