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

DOMAINDESC

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

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

フィールド

フィールドサイズx64x86説明
pszNameLPWSTR8/4+0+0ドメインの表示名(NetBIOS名)を示す文字列。
pszPathLPWSTR8/4+8+4ドメインのパス(DNS名)を示す文字列。
pszNCNameLPWSTR8/4+16+8ドメインの名前付けコンテキスト(DN)を示す文字列。
pszTrustParentLPWSTR8/4+24+12信頼関係上の親ドメイン名を示す文字列。ルートではNULLになり得る。
pszObjectClassLPWSTR8/4+32+16ドメインオブジェクトのクラス名を示す文字列。
ulFlagsDWORD4+40+20ドメインの属性を示すフラグ。
fDownLevelBOOL4+44+24TRUEならダウンレベル(NT4以前)ドメインであることを示す論理値。
pdChildListDOMAINDESC*8/4+48+28子ドメイン記述子リストの先頭を指すポインタ。子がなければNULL。
pdNextSiblingDOMAINDESC*8/4+56+32同一階層の次の兄弟ドメイン記述子を指すポインタ。末尾はNULL。

各言語での定義

#include <windows.h>

// DOMAINDESC  (x64 64 / x86 36 バイト)
typedef struct DOMAINDESC {
    LPWSTR pszName;
    LPWSTR pszPath;
    LPWSTR pszNCName;
    LPWSTR pszTrustParent;
    LPWSTR pszObjectClass;
    DWORD ulFlags;
    BOOL fDownLevel;
    DOMAINDESC* pdChildList;
    DOMAINDESC* pdNextSibling;
} DOMAINDESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOMAINDESC
{
    public IntPtr pszName;
    public IntPtr pszPath;
    public IntPtr pszNCName;
    public IntPtr pszTrustParent;
    public IntPtr pszObjectClass;
    public uint ulFlags;
    [MarshalAs(UnmanagedType.Bool)] public bool fDownLevel;
    public IntPtr pdChildList;
    public IntPtr pdNextSibling;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOMAINDESC
    Public pszName As IntPtr
    Public pszPath As IntPtr
    Public pszNCName As IntPtr
    Public pszTrustParent As IntPtr
    Public pszObjectClass As IntPtr
    Public ulFlags As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public fDownLevel As Boolean
    Public pdChildList As IntPtr
    Public pdNextSibling As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DOMAINDESC(ctypes.Structure):
    _fields_ = [
        ("pszName", ctypes.c_void_p),
        ("pszPath", ctypes.c_void_p),
        ("pszNCName", ctypes.c_void_p),
        ("pszTrustParent", ctypes.c_void_p),
        ("pszObjectClass", ctypes.c_void_p),
        ("ulFlags", wintypes.DWORD),
        ("fDownLevel", wintypes.BOOL),
        ("pdChildList", ctypes.c_void_p),
        ("pdNextSibling", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DOMAINDESC {
    pub pszName: *mut core::ffi::c_void,
    pub pszPath: *mut core::ffi::c_void,
    pub pszNCName: *mut core::ffi::c_void,
    pub pszTrustParent: *mut core::ffi::c_void,
    pub pszObjectClass: *mut core::ffi::c_void,
    pub ulFlags: u32,
    pub fDownLevel: i32,
    pub pdChildList: *mut core::ffi::c_void,
    pub pdNextSibling: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DOMAINDESC struct {
	pszName uintptr
	pszPath uintptr
	pszNCName uintptr
	pszTrustParent uintptr
	pszObjectClass uintptr
	ulFlags uint32
	fDownLevel int32
	pdChildList uintptr
	pdNextSibling uintptr
}
type
  DOMAINDESC = record
    pszName: Pointer;
    pszPath: Pointer;
    pszNCName: Pointer;
    pszTrustParent: Pointer;
    pszObjectClass: Pointer;
    ulFlags: DWORD;
    fDownLevel: BOOL;
    pdChildList: Pointer;
    pdNextSibling: Pointer;
  end;
const DOMAINDESC = extern struct {
    pszName: ?*anyopaque,
    pszPath: ?*anyopaque,
    pszNCName: ?*anyopaque,
    pszTrustParent: ?*anyopaque,
    pszObjectClass: ?*anyopaque,
    ulFlags: u32,
    fDownLevel: i32,
    pdChildList: ?*anyopaque,
    pdNextSibling: ?*anyopaque,
};
type
  DOMAINDESC {.bycopy.} = object
    pszName: pointer
    pszPath: pointer
    pszNCName: pointer
    pszTrustParent: pointer
    pszObjectClass: pointer
    ulFlags: uint32
    fDownLevel: int32
    pdChildList: pointer
    pdNextSibling: pointer
struct DOMAINDESC
{
    void* pszName;
    void* pszPath;
    void* pszNCName;
    void* pszTrustParent;
    void* pszObjectClass;
    uint ulFlags;
    int fDownLevel;
    void* pdChildList;
    void* pdNextSibling;
}

HSP用 定義

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

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

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