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

DS_DOMAIN_CONTROLLER_INFO_1A

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

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

フィールド

フィールドサイズx64x86説明
NetbiosNameLPSTR8/4+0+0ドメインコントローラのNetBIOS名(ANSI)。
DnsHostNameLPSTR8/4+8+4ドメインコントローラのDNSホスト名(ANSI)。
SiteNameLPSTR8/4+16+8DCが属するサイトの名前(ANSI)。
ComputerObjectNameLPSTR8/4+24+12DCのコンピュータオブジェクトのDN(ANSI)。
ServerObjectNameLPSTR8/4+32+16DCのサーバオブジェクトのDN(ANSI)。
fIsPdcBOOL4+40+20TRUEならPDCエミュレータ役割を持つことを示す論理値。
fDsEnabledBOOL4+44+24TRUEならディレクトリサービスが有効であることを示す論理値。

各言語での定義

#include <windows.h>

// DS_DOMAIN_CONTROLLER_INFO_1A  (x64 48 / x86 28 バイト)
typedef struct DS_DOMAIN_CONTROLLER_INFO_1A {
    LPSTR NetbiosName;
    LPSTR DnsHostName;
    LPSTR SiteName;
    LPSTR ComputerObjectName;
    LPSTR ServerObjectName;
    BOOL fIsPdc;
    BOOL fDsEnabled;
} DS_DOMAIN_CONTROLLER_INFO_1A;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DS_DOMAIN_CONTROLLER_INFO_1A
{
    public IntPtr NetbiosName;
    public IntPtr DnsHostName;
    public IntPtr SiteName;
    public IntPtr ComputerObjectName;
    public IntPtr ServerObjectName;
    [MarshalAs(UnmanagedType.Bool)] public bool fIsPdc;
    [MarshalAs(UnmanagedType.Bool)] public bool fDsEnabled;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DS_DOMAIN_CONTROLLER_INFO_1A
    Public NetbiosName As IntPtr
    Public DnsHostName As IntPtr
    Public SiteName As IntPtr
    Public ComputerObjectName As IntPtr
    Public ServerObjectName As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public fIsPdc As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fDsEnabled As Boolean
End Structure
import ctypes
from ctypes import wintypes

class DS_DOMAIN_CONTROLLER_INFO_1A(ctypes.Structure):
    _fields_ = [
        ("NetbiosName", ctypes.c_void_p),
        ("DnsHostName", ctypes.c_void_p),
        ("SiteName", ctypes.c_void_p),
        ("ComputerObjectName", ctypes.c_void_p),
        ("ServerObjectName", ctypes.c_void_p),
        ("fIsPdc", wintypes.BOOL),
        ("fDsEnabled", wintypes.BOOL),
    ]
#[repr(C)]
pub struct DS_DOMAIN_CONTROLLER_INFO_1A {
    pub NetbiosName: *mut core::ffi::c_void,
    pub DnsHostName: *mut core::ffi::c_void,
    pub SiteName: *mut core::ffi::c_void,
    pub ComputerObjectName: *mut core::ffi::c_void,
    pub ServerObjectName: *mut core::ffi::c_void,
    pub fIsPdc: i32,
    pub fDsEnabled: i32,
}
import "golang.org/x/sys/windows"

type DS_DOMAIN_CONTROLLER_INFO_1A struct {
	NetbiosName uintptr
	DnsHostName uintptr
	SiteName uintptr
	ComputerObjectName uintptr
	ServerObjectName uintptr
	fIsPdc int32
	fDsEnabled int32
}
type
  DS_DOMAIN_CONTROLLER_INFO_1A = record
    NetbiosName: Pointer;
    DnsHostName: Pointer;
    SiteName: Pointer;
    ComputerObjectName: Pointer;
    ServerObjectName: Pointer;
    fIsPdc: BOOL;
    fDsEnabled: BOOL;
  end;
const DS_DOMAIN_CONTROLLER_INFO_1A = extern struct {
    NetbiosName: ?*anyopaque,
    DnsHostName: ?*anyopaque,
    SiteName: ?*anyopaque,
    ComputerObjectName: ?*anyopaque,
    ServerObjectName: ?*anyopaque,
    fIsPdc: i32,
    fDsEnabled: i32,
};
type
  DS_DOMAIN_CONTROLLER_INFO_1A {.bycopy.} = object
    NetbiosName: pointer
    DnsHostName: pointer
    SiteName: pointer
    ComputerObjectName: pointer
    ServerObjectName: pointer
    fIsPdc: int32
    fDsEnabled: int32
struct DS_DOMAIN_CONTROLLER_INFO_1A
{
    void* NetbiosName;
    void* DnsHostName;
    void* SiteName;
    void* ComputerObjectName;
    void* ServerObjectName;
    int fIsPdc;
    int fDsEnabled;
}

HSP用 定義

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

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

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