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

ADS_REPLICAPOINTER

構造体
サイズx64: 32 バイト / x86: 20 バイト

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

フィールド

フィールドサイズx64x86説明
ServerNameLPWSTR8/4+0+0レプリカを保持するサーバ名の文字列。
ReplicaTypeDWORD4+8+4レプリカの種類を示す値。
ReplicaNumberDWORD4+12+8レプリカの番号。
CountDWORD4+16+12ReplicaAddressHintsに含まれるアドレスヒントの数。
ReplicaAddressHintsADS_NETADDRESS*8/4+24+16レプリカのネットワークアドレスヒント配列へのポインタ。

各言語での定義

#include <windows.h>

// ADS_REPLICAPOINTER  (x64 32 / x86 20 バイト)
typedef struct ADS_REPLICAPOINTER {
    LPWSTR ServerName;
    DWORD ReplicaType;
    DWORD ReplicaNumber;
    DWORD Count;
    ADS_NETADDRESS* ReplicaAddressHints;
} ADS_REPLICAPOINTER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADS_REPLICAPOINTER
{
    public IntPtr ServerName;
    public uint ReplicaType;
    public uint ReplicaNumber;
    public uint Count;
    public IntPtr ReplicaAddressHints;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADS_REPLICAPOINTER
    Public ServerName As IntPtr
    Public ReplicaType As UInteger
    Public ReplicaNumber As UInteger
    Public Count As UInteger
    Public ReplicaAddressHints As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class ADS_REPLICAPOINTER(ctypes.Structure):
    _fields_ = [
        ("ServerName", ctypes.c_void_p),
        ("ReplicaType", wintypes.DWORD),
        ("ReplicaNumber", wintypes.DWORD),
        ("Count", wintypes.DWORD),
        ("ReplicaAddressHints", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct ADS_REPLICAPOINTER {
    pub ServerName: *mut core::ffi::c_void,
    pub ReplicaType: u32,
    pub ReplicaNumber: u32,
    pub Count: u32,
    pub ReplicaAddressHints: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type ADS_REPLICAPOINTER struct {
	ServerName uintptr
	ReplicaType uint32
	ReplicaNumber uint32
	Count uint32
	ReplicaAddressHints uintptr
}
type
  ADS_REPLICAPOINTER = record
    ServerName: Pointer;
    ReplicaType: DWORD;
    ReplicaNumber: DWORD;
    Count: DWORD;
    ReplicaAddressHints: Pointer;
  end;
const ADS_REPLICAPOINTER = extern struct {
    ServerName: ?*anyopaque,
    ReplicaType: u32,
    ReplicaNumber: u32,
    Count: u32,
    ReplicaAddressHints: ?*anyopaque,
};
type
  ADS_REPLICAPOINTER {.bycopy.} = object
    ServerName: pointer
    ReplicaType: uint32
    ReplicaNumber: uint32
    Count: uint32
    ReplicaAddressHints: pointer
struct ADS_REPLICAPOINTER
{
    void* ServerName;
    uint ReplicaType;
    uint ReplicaNumber;
    uint Count;
    void* ReplicaAddressHints;
}

HSP用 定義

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

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

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