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。
cDsScopeInfosDWORD4+16+8aDsScopeInfos配列のスコープ情報数を示す。
aDsScopeInfosDSOP_SCOPE_INIT_INFO*8/4+24+12DSOP_SCOPE_INIT_INFO配列を指すポインタ。検索スコープ群を定義する。
flOptionsDWORD4+32+16オブジェクトピッカー全体のオプションフラグ(複数選択許可等)。
cAttributesToFetchDWORD4+36+20apwzAttributeNamesに含まれる取得属性名の個数。
apwzAttributeNamesLPWSTR*8/4+40+24選択時に取得する属性名文字列の配列を指すポインタ。

各言語での定義

#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