DisplaySpecifiers コンテナー
表示指定子は、ロケールによって構成コンテナーの DisplaySpecifiers コンテナーに格納されます。 構成コンテナーはフォレスト全体にレプリケートされるため、表示指定子はフォレスト内のすべてのドメインに伝達されます。
構成コンテナーには DisplaySpecifiers コンテナーが格納され、各ロケールに対応するコンテナーが格納されます。 これらのロケール コンテナーには、ロケール識別子の 16 進数表現を使用して名前が付けられます。 たとえば、米国/英語のロケール コンテナーの名前は 409、ドイツ語のロケールのコンテナーの名前は 407、日本語ロケールのコンテナーの名前は 411 です。 詳細および使用可能な言語識別子の一覧については、「言語識別子定数と文字列」を参照してください。
各ロケール コンテナーには、displaySpecifier クラスのオブジェクトが格納されます。
ロケールのすべての表示指定子を一覧表示するには、DisplaySpecifiers コンテナー内の指定されたロケール コンテナー内のすべての displaySpecifier オブジェクトを列挙します。
次のコード例には、指定したロケールの表示指定子コンテナーにバインドする関数が含まれています。
/**********
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;
}