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

DS_SELECTION_LIST

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

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

フィールド

フィールドサイズx64x86説明
cItemsDWORD4+0+0aDsSelection配列に含まれる選択項目の個数。
cFetchedAttributesDWORD4+4+4各選択項目について取得した属性の個数。
aDsSelectionDS_SELECTION48/24+8+8選択されたオブジェクトを表すDS_SELECTIONの可変長配列。

各言語での定義

#include <windows.h>

// DS_SELECTION  (x64 48 / x86 24 バイト)
typedef struct DS_SELECTION {
    LPWSTR pwzName;
    LPWSTR pwzADsPath;
    LPWSTR pwzClass;
    LPWSTR pwzUPN;
    VARIANT* pvarFetchedAttributes;
    DWORD flScopeType;
} DS_SELECTION;

// DS_SELECTION_LIST  (x64 56 / x86 32 バイト)
typedef struct DS_SELECTION_LIST {
    DWORD cItems;
    DWORD cFetchedAttributes;
    DS_SELECTION aDsSelection[1];
} DS_SELECTION_LIST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DS_SELECTION
{
    public IntPtr pwzName;
    public IntPtr pwzADsPath;
    public IntPtr pwzClass;
    public IntPtr pwzUPN;
    public IntPtr pvarFetchedAttributes;
    public uint flScopeType;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DS_SELECTION_LIST
{
    public uint cItems;
    public uint cFetchedAttributes;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DS_SELECTION[] aDsSelection;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DS_SELECTION
    Public pwzName As IntPtr
    Public pwzADsPath As IntPtr
    Public pwzClass As IntPtr
    Public pwzUPN As IntPtr
    Public pvarFetchedAttributes As IntPtr
    Public flScopeType As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DS_SELECTION_LIST
    Public cItems As UInteger
    Public cFetchedAttributes As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aDsSelection() As DS_SELECTION
End Structure
import ctypes
from ctypes import wintypes

class DS_SELECTION(ctypes.Structure):
    _fields_ = [
        ("pwzName", ctypes.c_void_p),
        ("pwzADsPath", ctypes.c_void_p),
        ("pwzClass", ctypes.c_void_p),
        ("pwzUPN", ctypes.c_void_p),
        ("pvarFetchedAttributes", ctypes.c_void_p),
        ("flScopeType", wintypes.DWORD),
    ]

class DS_SELECTION_LIST(ctypes.Structure):
    _fields_ = [
        ("cItems", wintypes.DWORD),
        ("cFetchedAttributes", wintypes.DWORD),
        ("aDsSelection", DS_SELECTION * 1),
    ]
#[repr(C)]
pub struct DS_SELECTION {
    pub pwzName: *mut core::ffi::c_void,
    pub pwzADsPath: *mut core::ffi::c_void,
    pub pwzClass: *mut core::ffi::c_void,
    pub pwzUPN: *mut core::ffi::c_void,
    pub pvarFetchedAttributes: *mut core::ffi::c_void,
    pub flScopeType: u32,
}

#[repr(C)]
pub struct DS_SELECTION_LIST {
    pub cItems: u32,
    pub cFetchedAttributes: u32,
    pub aDsSelection: [DS_SELECTION; 1],
}
import "golang.org/x/sys/windows"

type DS_SELECTION struct {
	pwzName uintptr
	pwzADsPath uintptr
	pwzClass uintptr
	pwzUPN uintptr
	pvarFetchedAttributes uintptr
	flScopeType uint32
}

type DS_SELECTION_LIST struct {
	cItems uint32
	cFetchedAttributes uint32
	aDsSelection [1]DS_SELECTION
}
type
  DS_SELECTION = record
    pwzName: Pointer;
    pwzADsPath: Pointer;
    pwzClass: Pointer;
    pwzUPN: Pointer;
    pvarFetchedAttributes: Pointer;
    flScopeType: DWORD;
  end;

  DS_SELECTION_LIST = record
    cItems: DWORD;
    cFetchedAttributes: DWORD;
    aDsSelection: array[0..0] of DS_SELECTION;
  end;
const DS_SELECTION = extern struct {
    pwzName: ?*anyopaque,
    pwzADsPath: ?*anyopaque,
    pwzClass: ?*anyopaque,
    pwzUPN: ?*anyopaque,
    pvarFetchedAttributes: ?*anyopaque,
    flScopeType: u32,
};

const DS_SELECTION_LIST = extern struct {
    cItems: u32,
    cFetchedAttributes: u32,
    aDsSelection: [1]DS_SELECTION,
};
type
  DS_SELECTION {.bycopy.} = object
    pwzName: pointer
    pwzADsPath: pointer
    pwzClass: pointer
    pwzUPN: pointer
    pvarFetchedAttributes: pointer
    flScopeType: uint32

  DS_SELECTION_LIST {.bycopy.} = object
    cItems: uint32
    cFetchedAttributes: uint32
    aDsSelection: array[1, DS_SELECTION]
struct DS_SELECTION
{
    void* pwzName;
    void* pwzADsPath;
    void* pwzClass;
    void* pwzUPN;
    void* pvarFetchedAttributes;
    uint flScopeType;
}

struct DS_SELECTION_LIST
{
    uint cItems;
    uint cFetchedAttributes;
    DS_SELECTION[1] aDsSelection;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DS_SELECTION_LIST サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cItems : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cFetchedAttributes : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; aDsSelection : DS_SELECTION (+8, 24byte)  varptr(st)+8 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DS_SELECTION_LIST サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; cItems : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cFetchedAttributes : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; aDsSelection : DS_SELECTION (+8, 48byte)  varptr(st)+8 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DS_SELECTION
    #field intptr pwzName
    #field intptr pwzADsPath
    #field intptr pwzClass
    #field intptr pwzUPN
    #field intptr pvarFetchedAttributes
    #field int flScopeType
#endstruct

#defstruct global DS_SELECTION_LIST
    #field int cItems
    #field int cFetchedAttributes
    #field DS_SELECTION aDsSelection 1
#endstruct

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