Win32 API 日本語リファレンス
ホームNetworking.ActiveDirectory › DSDISPLAYSPECOPTIONS

DSDISPLAYSPECOPTIONS

構造体
サイズx64: 28 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0バージョン管理のための構造体のサイズです。
dwFlagsDWORD4+4+4

オブジェクトに関するデータを示し、構造体の内容を定義するフラグのセットです。0 または次の値の 1 つ以上の組み合わせを指定できます。

DSDSOF_HASUSERANDSERVERINFO (0x00000001)

offsetUserNameoffsetPasswordoffsetServeroffsetServerConfigPath の各メンバーが有効です。

DSDSOF_SIMPLEAUTHENTICATE (0x00000002)

ADsOpenObject を呼び出すときに ADS_SECURE_AUTHENTICATION フラグを指定しません。

DSDSOF_DONTSIGNSEAL (0x00000004)

ディレクトリサービスのオブジェクトを開くときに署名と封印 (sign and seal) を行いません。

DSDSOF_DSAVAILABLE (0x40000000)

クライアントが Active Directory ドメインサービスによって制御されるドメインに属していると想定し、ユーザーが認証されているか、ネットワークが存在するかまたはログオンしているかをクライアントが確認しないように強制します。

offsetAttribPrefixDWORD4+8+8

DSDISPLAYSPECOPTIONS 構造体の先頭から、作成された拡張機能の取得元である表示指定子のプレフィックスを格納した NULL 終端の Unicode 文字列までのオフセットをバイト単位で格納します。この文字列は次の値のいずれかになります。

"admin"

拡張機能は adminPropertyPages 属性から取得されました。

"shell"

拡張機能は shellPropertyPages 属性から取得されました。

次の例は、このメンバーの使用方法を示しています。

pwszAttribPrefix = (LPWSTR)((LPBYTE)pdos + 
    pdso->offsetAttribPrefix);
offsetUserNameDWORD4+12+12

DSDISPLAYSPECOPTIONS 構造体の先頭から、バインドの認証に使用されるユーザーの名前を格納した NULL 終端の Unicode 文字列までのオフセットをバイト単位で格納します。このメンバーは、dwFlagsDSDSOF_HASUSERANDSERVERINFO フラグが含まれている場合にのみ有効です。このメンバーが 0 の場合、ユーザー名は含まれていません。

次の例は、このメンバーの使用方法を示しています。

pwszUserName = (LPWSTR)((LPBYTE)pdso + 
    pdso->offsetUserName);
offsetPasswordDWORD4+16+16

DSDISPLAYSPECOPTIONS 構造体の先頭から、バインドの認証に使用されるパスワードを格納した NULL 終端の Unicode 文字列までのオフセットをバイト単位で格納します。このメンバーは、dwFlagsDSDSOF_HASUSERANDSERVERINFO フラグが含まれている場合にのみ有効です。このメンバーが 0 の場合、パスワードは含まれていません。

次の例は、このメンバーの使用方法を示しています。

pwszPassword = (LPWSTR)((LPBYTE)pdso + 
    pdso->offsetPassword);
offsetServerDWORD4+20+20

DSDISPLAYSPECOPTIONS 構造体の先頭から、サーバーの名前を格納した NULL 終端の Unicode 文字列までのオフセットをバイト単位で格納します。このメンバーは、dwFlagsDSDSOF_HASUSERANDSERVERINFO フラグが含まれている場合にのみ有効です。このメンバーが 0 の場合、サーバー名は含まれていません。

次の例は、このメンバーの使用方法を示しています。

pwszServer = (LPWSTR)((LPBYTE)pdso + 
    pdso->offsetServer);
offsetServerConfigPathDWORD4+24+24

DSDISPLAYSPECOPTIONS 構造体の先頭から、サーバーの ADsPath を格納した NULL 終端の Unicode 文字列までのオフセットをバイト単位で格納します。このメンバーは、dwFlagsDSDSOF_HASUSERANDSERVERINFO フラグが含まれている場合にのみ有効です。このメンバーが 0 の場合、サーバーのパスは含まれていません。

次の例は、このメンバーの使用方法を示しています。

pwszServerConfigPath = (LPWSTR)((LPBYTE)pdso + 
    pdso->offsetServerConfigPath);

公式ドキュメント

DSDISPLAYSPECOPTIONS 構造体は CFSTR_DS_DISPLAY_SPEC_OPTIONS クリップボード形式によって返され、使用される表示指定子に関するデータを、コンテキストメニューまたはプロパティページの拡張機能に提供するために使用されます。Active Directory サーバー上のデータにアクセスするために拡張機能が必要とする資格情報を指定することが重要です。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// DSDISPLAYSPECOPTIONS  (x64 28 / x86 28 バイト)
typedef struct DSDISPLAYSPECOPTIONS {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD offsetAttribPrefix;
    DWORD offsetUserName;
    DWORD offsetPassword;
    DWORD offsetServer;
    DWORD offsetServerConfigPath;
} DSDISPLAYSPECOPTIONS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSDISPLAYSPECOPTIONS
{
    public uint dwSize;
    public uint dwFlags;
    public uint offsetAttribPrefix;
    public uint offsetUserName;
    public uint offsetPassword;
    public uint offsetServer;
    public uint offsetServerConfigPath;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSDISPLAYSPECOPTIONS
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public offsetAttribPrefix As UInteger
    Public offsetUserName As UInteger
    Public offsetPassword As UInteger
    Public offsetServer As UInteger
    Public offsetServerConfigPath As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DSDISPLAYSPECOPTIONS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("offsetAttribPrefix", wintypes.DWORD),
        ("offsetUserName", wintypes.DWORD),
        ("offsetPassword", wintypes.DWORD),
        ("offsetServer", wintypes.DWORD),
        ("offsetServerConfigPath", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DSDISPLAYSPECOPTIONS {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub offsetAttribPrefix: u32,
    pub offsetUserName: u32,
    pub offsetPassword: u32,
    pub offsetServer: u32,
    pub offsetServerConfigPath: u32,
}
import "golang.org/x/sys/windows"

type DSDISPLAYSPECOPTIONS struct {
	dwSize uint32
	dwFlags uint32
	offsetAttribPrefix uint32
	offsetUserName uint32
	offsetPassword uint32
	offsetServer uint32
	offsetServerConfigPath uint32
}
type
  DSDISPLAYSPECOPTIONS = record
    dwSize: DWORD;
    dwFlags: DWORD;
    offsetAttribPrefix: DWORD;
    offsetUserName: DWORD;
    offsetPassword: DWORD;
    offsetServer: DWORD;
    offsetServerConfigPath: DWORD;
  end;
const DSDISPLAYSPECOPTIONS = extern struct {
    dwSize: u32,
    dwFlags: u32,
    offsetAttribPrefix: u32,
    offsetUserName: u32,
    offsetPassword: u32,
    offsetServer: u32,
    offsetServerConfigPath: u32,
};
type
  DSDISPLAYSPECOPTIONS {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    offsetAttribPrefix: uint32
    offsetUserName: uint32
    offsetPassword: uint32
    offsetServer: uint32
    offsetServerConfigPath: uint32
struct DSDISPLAYSPECOPTIONS
{
    uint dwSize;
    uint dwFlags;
    uint offsetAttribPrefix;
    uint offsetUserName;
    uint offsetPassword;
    uint offsetServer;
    uint offsetServerConfigPath;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSDISPLAYSPECOPTIONS サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; offsetAttribPrefix : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; offsetUserName : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; offsetPassword : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; offsetServer : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; offsetServerConfigPath : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSDISPLAYSPECOPTIONS
    #field int dwSize
    #field int dwFlags
    #field int offsetAttribPrefix
    #field int offsetUserName
    #field int offsetPassword
    #field int offsetServer
    #field int offsetServerConfigPath
#endstruct

stdim st, DSDISPLAYSPECOPTIONS        ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize