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

DSOP_INIT_INFO

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズをバイト単位で格納します。
pwzTargetComputerLPWSTR8/4+8+4対象コンピューターの名前を格納する、null で終わる Unicode 文字列へのポインターです。ダイアログ ボックスは対象コンピューター上で実行されているかのように動作し、参加しているドメインおよびエンタープライズの判別に対象コンピューターを使用します。この値が NULL の場合、対象コンピューターはローカル コンピューターになります。
cDsScopeInfosDWORD4+16+8aDsScopeInfos 配列の要素数を指定します。
aDsScopeInfosDSOP_SCOPE_INIT_INFO*8/4+24+12ユーザーがオブジェクトを選択できるスコープを記述する DSOP_SCOPE_INIT_INFO 構造体の配列へのポインターです。オブジェクト ピッカーは少なくとも 1 つのスコープがなければ動作できないため、このメンバーを NULL にすることはできず、配列には少なくとも 1 つの要素が含まれていなければなりません。
flOptionsDWORD4+32+16

オブジェクト ピッカーのオプションを決定するフラグです。このメンバーには 0、または次のフラグの 1 つ以上の組み合わせを指定できます。

DSOP_FLAG_MULTISELECT (0x00000001)

このフラグが設定されている場合、ユーザーは複数のオブジェクトを選択できます。このフラグが設定されていない場合、ユーザーは 1 つのオブジェクトのみを選択できます。

DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK (0x00000002)

このフラグが設定されており、かつ aDsScopeInfos 配列で DSOP_SCOPE_TYPE_TARGET_COMPUTER フラグが設定されている場合、対象コンピューターは常に Look in ドロップダウン リストに含まれます。

このフラグが設定されておらず、対象コンピューターがアップレベルまたはダウンレベルのドメイン コントローラーである場合、DSOP_SCOPE_TYPE_TARGET_COMPUTER フラグは無視され、対象コンピューターは Look in ドロップダウン リストに含まれません。

初期化にかかる時間を短縮するため、対象コンピューターがドメイン コントローラーではないと分かっている場合は、このフラグを設定してください。ただし、対象コンピューターがドメイン コントローラーである場合は、ドメイン コントローラー自体からではなくドメイン スコープからドメイン オブジェクトを選択する方がユーザーにとって望ましいため、このフラグを設定しないでください。

cAttributesToFetchDWORD4+36+20apwzAttributeNames 配列の要素数を格納します。このメンバーは 0 でもかまいません。
apwzAttributeNamesLPWSTR*8/4+40+24選択された各オブジェクトについて取得する属性の名前を格納する、null で終わる Unicode 文字列の配列へのポインターです。cAttributesToFetch が 0 の場合、このメンバーは無視されます。

公式ドキュメント

DSOP_INIT_INFO 構造体は、オブジェクト ピッカー ダイアログ ボックスを初期化するために必要なデータを格納します。この構造体は IDsObjectPicker::Initialize メソッドで使用します。

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

各言語での定義

#include <windows.h>

// DSOP_INIT_INFO  (x64 48 / x86 28 バイト)
typedef struct DSOP_INIT_INFO {
    DWORD cbSize;
    LPWSTR pwzTargetComputer;
    DWORD cDsScopeInfos;
    DSOP_SCOPE_INIT_INFO* aDsScopeInfos;
    DWORD flOptions;
    DWORD cAttributesToFetch;
    LPWSTR* apwzAttributeNames;
} DSOP_INIT_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSOP_INIT_INFO
{
    public uint cbSize;
    public IntPtr pwzTargetComputer;
    public uint cDsScopeInfos;
    public IntPtr aDsScopeInfos;
    public uint flOptions;
    public uint cAttributesToFetch;
    public IntPtr apwzAttributeNames;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSOP_INIT_INFO
    Public cbSize As UInteger
    Public pwzTargetComputer As IntPtr
    Public cDsScopeInfos As UInteger
    Public aDsScopeInfos As IntPtr
    Public flOptions As UInteger
    Public cAttributesToFetch As UInteger
    Public apwzAttributeNames As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DSOP_INIT_INFO(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("pwzTargetComputer", ctypes.c_void_p),
        ("cDsScopeInfos", wintypes.DWORD),
        ("aDsScopeInfos", ctypes.c_void_p),
        ("flOptions", wintypes.DWORD),
        ("cAttributesToFetch", wintypes.DWORD),
        ("apwzAttributeNames", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DSOP_INIT_INFO {
    pub cbSize: u32,
    pub pwzTargetComputer: *mut core::ffi::c_void,
    pub cDsScopeInfos: u32,
    pub aDsScopeInfos: *mut core::ffi::c_void,
    pub flOptions: u32,
    pub cAttributesToFetch: u32,
    pub apwzAttributeNames: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DSOP_INIT_INFO struct {
	cbSize uint32
	pwzTargetComputer uintptr
	cDsScopeInfos uint32
	aDsScopeInfos uintptr
	flOptions uint32
	cAttributesToFetch uint32
	apwzAttributeNames uintptr
}
type
  DSOP_INIT_INFO = record
    cbSize: DWORD;
    pwzTargetComputer: Pointer;
    cDsScopeInfos: DWORD;
    aDsScopeInfos: Pointer;
    flOptions: DWORD;
    cAttributesToFetch: DWORD;
    apwzAttributeNames: Pointer;
  end;
const DSOP_INIT_INFO = extern struct {
    cbSize: u32,
    pwzTargetComputer: ?*anyopaque,
    cDsScopeInfos: u32,
    aDsScopeInfos: ?*anyopaque,
    flOptions: u32,
    cAttributesToFetch: u32,
    apwzAttributeNames: ?*anyopaque,
};
type
  DSOP_INIT_INFO {.bycopy.} = object
    cbSize: uint32
    pwzTargetComputer: pointer
    cDsScopeInfos: uint32
    aDsScopeInfos: pointer
    flOptions: uint32
    cAttributesToFetch: uint32
    apwzAttributeNames: pointer
struct DSOP_INIT_INFO
{
    uint cbSize;
    void* pwzTargetComputer;
    uint cDsScopeInfos;
    void* aDsScopeInfos;
    uint flOptions;
    uint cAttributesToFetch;
    void* apwzAttributeNames;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DSOP_INIT_INFO サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pwzTargetComputer : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cDsScopeInfos : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; aDsScopeInfos : DSOP_SCOPE_INIT_INFO* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; flOptions : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; cAttributesToFetch : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; apwzAttributeNames : LPWSTR* (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSOP_INIT_INFO サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pwzTargetComputer : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cDsScopeInfos : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; aDsScopeInfos : DSOP_SCOPE_INIT_INFO* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; flOptions : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; cAttributesToFetch : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; apwzAttributeNames : LPWSTR* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSOP_INIT_INFO
    #field int cbSize
    #field intptr pwzTargetComputer
    #field int cDsScopeInfos
    #field intptr aDsScopeInfos
    #field int flOptions
    #field int cAttributesToFetch
    #field intptr apwzAttributeNames
#endstruct

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