Kontainer DisplaySpecifiers

Penentu tampilan disimpan, menurut lokal, dalam kontainer DisplaySpecifiers kontainer Konfigurasi. Karena kontainer Konfigurasi direplikasi di seluruh forest, penentu tampilan disebarluaskan di semua domain di forest.

Kontainer Konfigurasi menyimpan kontainer DisplaySpecifiers, yang kemudian menyimpan kontainer yang sesuai dengan setiap lokal. Kontainer lokal ini diberi nama menggunakan representasi heksadesimal dari pengidentifikasi lokal. Misalnya, kontainer lokal AS/Inggris bernama 409, kontainer lokal Jerman bernama 407, dan kontainer lokal Jepang bernama 411. Untuk informasi selengkapnya, dan daftar kemungkinan pengidentifikasi bahasa, lihat Konstanta dan String Pengidentifikasi Bahasa.

Setiap kontainer lokal menyimpan objek kelas displaySpecifier.

Untuk mencantumkan semua penentu tampilan untuk lokal, hitung semua objek displaySpecifier dalam kontainer lokal yang ditentukan dalam kontainer DisplaySpecifiers.

Contoh kode berikut berisi fungsi yang mengikat ke kontainer penentu tampilan untuk lokal yang ditentukan:

/**********
This function returns a pointer to the display specifier container 
for the specified locale.

If locale is NULL, use default system locale and then return the 
locale in the locale parameter.
***********/
HRESULT BindToDisplaySpecifiersContainerByLocale(
    LCID *locale,
    IADs **ppDispSpecCont)
{
HRESULT hr = E_FAIL;
 
if ((!ppDispSpecCont)||(!locale))
    return E_POINTER;
 
// If no locale is specified, use the default system locale.
if (!(*locale))
{
    *locale = GetSystemDefaultLCID();
    if (!(*locale))
        return E_FAIL;
}
 
// Be sure that the locale is valid.
if (!IsValidLocale(*locale, LCID_SUPPORTED))
    return E_INVALIDARG;
 
LPOLESTR szPath = new OLECHAR[MAX_PATH*2];
IADs *pObj = NULL;
VARIANT var;
 
hr = ADsOpenObject(L"LDAP://rootDSE",
                     NULL,
                     NULL,
                     ADS_SECURE_AUTHENTICATION,
                     IID_IADs,
                     (void**)&pObj);
 
if (SUCCEEDED(hr))
{
    // Get the DN to the configuration container.
    hr = pObj->Get(CComBSTR("configurationNamingContext"), &var);
    if (SUCCEEDED(hr))
    {
        // Build the string to bind to the container for the
        // specified locale in the DisplaySpecifiers container.
        swprintf_s(
            szPath, 
            L"LDAP://cn=%x,cn=DisplaySpecifiers,%s", 
            *locale, 
            var.bstrVal);

        // Bind to the container.
        *ppDispSpecCont = NULL;
        hr = ADsOpenObject(szPath,
                     NULL,
                     NULL,
                     ADS_SECURE_AUTHENTICATION,
                     IID_IADs,
                     (void**)ppDispSpecCont);
 
        if(FAILED(hr))
        {
            if ((*ppDispSpecCont))
            {
                (*ppDispSpecCont)->Release();
                (*ppDispSpecCont) = NULL;
            }
        }
    }
}
 
// Cleanup.
VariantClear(&var);
if (pObj)
    pObj->Release();
 
return hr;
}