ホーム › Networking.ActiveDirectory › DOMAIN_TREE
DOMAIN_TREE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dsSize | DWORD | 4 | +0 | +0 | 本構造体全体のバイトサイズを示す。 |
| dwCount | DWORD | 4 | +4 | +4 | aDomains配列に含まれるDOMAINDESC要素の個数。 |
| aDomains | DOMAINDESC | 64/36 | +8 | +8 | ドメインツリーを構成するDOMAINDESCの可変長配列。 |
各言語での定義
#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;
// DOMAIN_TREE (x64 72 / x86 44 バイト)
typedef struct DOMAIN_TREE {
DWORD dsSize;
DWORD dwCount;
DOMAINDESC aDomains[1];
} DOMAIN_TREE;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOMAIN_TREE
{
public uint dsSize;
public uint dwCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOMAINDESC[] aDomains;
}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
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOMAIN_TREE
Public dsSize As UInteger
Public dwCount As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aDomains() As DOMAINDESC
End Structureimport 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),
]
class DOMAIN_TREE(ctypes.Structure):
_fields_ = [
("dsSize", wintypes.DWORD),
("dwCount", wintypes.DWORD),
("aDomains", DOMAINDESC * 1),
]#[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,
}
#[repr(C)]
pub struct DOMAIN_TREE {
pub dsSize: u32,
pub dwCount: u32,
pub aDomains: [DOMAINDESC; 1],
}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 DOMAIN_TREE struct {
dsSize uint32
dwCount uint32
aDomains [1]DOMAINDESC
}type
DOMAINDESC = record
pszName: Pointer;
pszPath: Pointer;
pszNCName: Pointer;
pszTrustParent: Pointer;
pszObjectClass: Pointer;
ulFlags: DWORD;
fDownLevel: BOOL;
pdChildList: Pointer;
pdNextSibling: Pointer;
end;
DOMAIN_TREE = record
dsSize: DWORD;
dwCount: DWORD;
aDomains: array[0..0] of DOMAINDESC;
end;const DOMAINDESC = extern struct {
pszName: ?*anyopaque,
pszPath: ?*anyopaque,
pszNCName: ?*anyopaque,
pszTrustParent: ?*anyopaque,
pszObjectClass: ?*anyopaque,
ulFlags: u32,
fDownLevel: i32,
pdChildList: ?*anyopaque,
pdNextSibling: ?*anyopaque,
};
const DOMAIN_TREE = extern struct {
dsSize: u32,
dwCount: u32,
aDomains: [1]DOMAINDESC,
};type
DOMAINDESC {.bycopy.} = object
pszName: pointer
pszPath: pointer
pszNCName: pointer
pszTrustParent: pointer
pszObjectClass: pointer
ulFlags: uint32
fDownLevel: int32
pdChildList: pointer
pdNextSibling: pointer
DOMAIN_TREE {.bycopy.} = object
dsSize: uint32
dwCount: uint32
aDomains: array[1, DOMAINDESC]struct DOMAINDESC
{
void* pszName;
void* pszPath;
void* pszNCName;
void* pszTrustParent;
void* pszObjectClass;
uint ulFlags;
int fDownLevel;
void* pdChildList;
void* pdNextSibling;
}
struct DOMAIN_TREE
{
uint dsSize;
uint dwCount;
DOMAINDESC[1] aDomains;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DOMAIN_TREE サイズ: 44 バイト(x86)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; dsSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; aDomains : DOMAINDESC (+8, 36byte) varptr(st)+8 を基点に操作(36byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOMAIN_TREE サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dsSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; aDomains : DOMAINDESC (+8, 64byte) varptr(st)+8 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global DOMAIN_TREE
#field int dsSize
#field int dwCount
#field DOMAINDESC aDomains 1
#endstruct
stdim st, DOMAIN_TREE ; NSTRUCT 変数を確保
st->dsSize = 100
mes "dsSize=" + st->dsSize