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

DOMAIN_CONTROLLER_INFOW

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

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

フィールド

フィールドサイズx64x86説明
DomainControllerNameLPWSTR8/4+0+0ドメインコントローラの名前(\\で始まるUNC形式)文字列(Unicode)。
DomainControllerAddressLPWSTR8/4+8+4DCのアドレス文字列(Unicode)。形式はAddressTypeで判別。
DomainControllerAddressTypeDWORD4+16+8DCアドレスの種別(IP/NetBIOS)を示す値。
DomainGuidGUID16+20+12ドメインのGUID。
DomainNameLPWSTR8/4+40+28ドメイン名文字列(Unicode)。
DnsForestNameLPWSTR8/4+48+32フォレストのDNS名文字列(Unicode)。
FlagsDWORD4+56+36DCの機能・役割を示すフラグ(DS_*)。
DcSiteNameLPWSTR8/4+64+40DCが属するサイト名文字列(Unicode)。
ClientSiteNameLPWSTR8/4+72+44クライアントが属するサイト名文字列(Unicode)。

各言語での定義

#include <windows.h>

// DOMAIN_CONTROLLER_INFOW  (x64 80 / x86 48 バイト)
typedef struct DOMAIN_CONTROLLER_INFOW {
    LPWSTR DomainControllerName;
    LPWSTR DomainControllerAddress;
    DWORD DomainControllerAddressType;
    GUID DomainGuid;
    LPWSTR DomainName;
    LPWSTR DnsForestName;
    DWORD Flags;
    LPWSTR DcSiteName;
    LPWSTR ClientSiteName;
} DOMAIN_CONTROLLER_INFOW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOMAIN_CONTROLLER_INFOW
{
    public IntPtr DomainControllerName;
    public IntPtr DomainControllerAddress;
    public uint DomainControllerAddressType;
    public Guid DomainGuid;
    public IntPtr DomainName;
    public IntPtr DnsForestName;
    public uint Flags;
    public IntPtr DcSiteName;
    public IntPtr ClientSiteName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOMAIN_CONTROLLER_INFOW
    Public DomainControllerName As IntPtr
    Public DomainControllerAddress As IntPtr
    Public DomainControllerAddressType As UInteger
    Public DomainGuid As Guid
    Public DomainName As IntPtr
    Public DnsForestName As IntPtr
    Public Flags As UInteger
    Public DcSiteName As IntPtr
    Public ClientSiteName As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DOMAIN_CONTROLLER_INFOW(ctypes.Structure):
    _fields_ = [
        ("DomainControllerName", ctypes.c_void_p),
        ("DomainControllerAddress", ctypes.c_void_p),
        ("DomainControllerAddressType", wintypes.DWORD),
        ("DomainGuid", GUID),
        ("DomainName", ctypes.c_void_p),
        ("DnsForestName", ctypes.c_void_p),
        ("Flags", wintypes.DWORD),
        ("DcSiteName", ctypes.c_void_p),
        ("ClientSiteName", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DOMAIN_CONTROLLER_INFOW {
    pub DomainControllerName: *mut core::ffi::c_void,
    pub DomainControllerAddress: *mut core::ffi::c_void,
    pub DomainControllerAddressType: u32,
    pub DomainGuid: GUID,
    pub DomainName: *mut core::ffi::c_void,
    pub DnsForestName: *mut core::ffi::c_void,
    pub Flags: u32,
    pub DcSiteName: *mut core::ffi::c_void,
    pub ClientSiteName: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DOMAIN_CONTROLLER_INFOW struct {
	DomainControllerName uintptr
	DomainControllerAddress uintptr
	DomainControllerAddressType uint32
	DomainGuid windows.GUID
	DomainName uintptr
	DnsForestName uintptr
	Flags uint32
	DcSiteName uintptr
	ClientSiteName uintptr
}
type
  DOMAIN_CONTROLLER_INFOW = record
    DomainControllerName: Pointer;
    DomainControllerAddress: Pointer;
    DomainControllerAddressType: DWORD;
    DomainGuid: TGUID;
    DomainName: Pointer;
    DnsForestName: Pointer;
    Flags: DWORD;
    DcSiteName: Pointer;
    ClientSiteName: Pointer;
  end;
const DOMAIN_CONTROLLER_INFOW = extern struct {
    DomainControllerName: ?*anyopaque,
    DomainControllerAddress: ?*anyopaque,
    DomainControllerAddressType: u32,
    DomainGuid: GUID,
    DomainName: ?*anyopaque,
    DnsForestName: ?*anyopaque,
    Flags: u32,
    DcSiteName: ?*anyopaque,
    ClientSiteName: ?*anyopaque,
};
type
  DOMAIN_CONTROLLER_INFOW {.bycopy.} = object
    DomainControllerName: pointer
    DomainControllerAddress: pointer
    DomainControllerAddressType: uint32
    DomainGuid: GUID
    DomainName: pointer
    DnsForestName: pointer
    Flags: uint32
    DcSiteName: pointer
    ClientSiteName: pointer
struct DOMAIN_CONTROLLER_INFOW
{
    void* DomainControllerName;
    void* DomainControllerAddress;
    uint DomainControllerAddressType;
    GUID DomainGuid;
    void* DomainName;
    void* DnsForestName;
    uint Flags;
    void* DcSiteName;
    void* ClientSiteName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DOMAIN_CONTROLLER_INFOW サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; DomainControllerName : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DomainControllerAddress : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; DomainControllerAddressType : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; DomainGuid : GUID (+12, 16byte)  varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; DomainName : LPWSTR (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; DnsForestName : LPWSTR (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Flags : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; DcSiteName : LPWSTR (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ClientSiteName : LPWSTR (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOMAIN_CONTROLLER_INFOW サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; DomainControllerName : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; DomainControllerAddress : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; DomainControllerAddressType : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; DomainGuid : GUID (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; DomainName : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; DnsForestName : LPWSTR (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Flags : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; DcSiteName : LPWSTR (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ClientSiteName : LPWSTR (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global DOMAIN_CONTROLLER_INFOW
    #field intptr DomainControllerName
    #field intptr DomainControllerAddress
    #field int DomainControllerAddressType
    #field GUID DomainGuid
    #field intptr DomainName
    #field intptr DnsForestName
    #field int Flags
    #field intptr DcSiteName
    #field intptr ClientSiteName
#endstruct

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