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

DS_REPL_NEIGHBORSW

構造体
サイズx64: 152 バイト / x86: 136 バイト

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

フィールド

フィールドサイズx64x86説明
cNumNeighborsDWORD4+0+0rgNeighbor配列に含まれる複製パートナー(近隣)の個数。
dwReservedDWORD4+4+4予約フィールド。0となる。
rgNeighborDS_REPL_NEIGHBORW144/128+8+8複製近隣情報を表すDS_REPL_NEIGHBORWの可変長配列。

各言語での定義

#include <windows.h>

// FILETIME  (x64 8 / x86 8 バイト)
typedef struct FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;

// DS_REPL_NEIGHBORW  (x64 144 / x86 128 バイト)
typedef struct DS_REPL_NEIGHBORW {
    LPWSTR pszNamingContext;
    LPWSTR pszSourceDsaDN;
    LPWSTR pszSourceDsaAddress;
    LPWSTR pszAsyncIntersiteTransportDN;
    DWORD dwReplicaFlags;
    DWORD dwReserved;
    GUID uuidNamingContextObjGuid;
    GUID uuidSourceDsaObjGuid;
    GUID uuidSourceDsaInvocationID;
    GUID uuidAsyncIntersiteTransportObjGuid;
    LONGLONG usnLastObjChangeSynced;
    LONGLONG usnAttributeFilter;
    FILETIME ftimeLastSyncSuccess;
    FILETIME ftimeLastSyncAttempt;
    DWORD dwLastSyncResult;
    DWORD cNumConsecutiveSyncFailures;
} DS_REPL_NEIGHBORW;

// DS_REPL_NEIGHBORSW  (x64 152 / x86 136 バイト)
typedef struct DS_REPL_NEIGHBORSW {
    DWORD cNumNeighbors;
    DWORD dwReserved;
    DS_REPL_NEIGHBORW rgNeighbor[1];
} DS_REPL_NEIGHBORSW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
    public uint dwLowDateTime;
    public uint dwHighDateTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DS_REPL_NEIGHBORW
{
    public IntPtr pszNamingContext;
    public IntPtr pszSourceDsaDN;
    public IntPtr pszSourceDsaAddress;
    public IntPtr pszAsyncIntersiteTransportDN;
    public uint dwReplicaFlags;
    public uint dwReserved;
    public Guid uuidNamingContextObjGuid;
    public Guid uuidSourceDsaObjGuid;
    public Guid uuidSourceDsaInvocationID;
    public Guid uuidAsyncIntersiteTransportObjGuid;
    public long usnLastObjChangeSynced;
    public long usnAttributeFilter;
    public FILETIME ftimeLastSyncSuccess;
    public FILETIME ftimeLastSyncAttempt;
    public uint dwLastSyncResult;
    public uint cNumConsecutiveSyncFailures;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DS_REPL_NEIGHBORSW
{
    public uint cNumNeighbors;
    public uint dwReserved;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DS_REPL_NEIGHBORW[] rgNeighbor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
    Public dwLowDateTime As UInteger
    Public dwHighDateTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DS_REPL_NEIGHBORW
    Public pszNamingContext As IntPtr
    Public pszSourceDsaDN As IntPtr
    Public pszSourceDsaAddress As IntPtr
    Public pszAsyncIntersiteTransportDN As IntPtr
    Public dwReplicaFlags As UInteger
    Public dwReserved As UInteger
    Public uuidNamingContextObjGuid As Guid
    Public uuidSourceDsaObjGuid As Guid
    Public uuidSourceDsaInvocationID As Guid
    Public uuidAsyncIntersiteTransportObjGuid As Guid
    Public usnLastObjChangeSynced As Long
    Public usnAttributeFilter As Long
    Public ftimeLastSyncSuccess As FILETIME
    Public ftimeLastSyncAttempt As FILETIME
    Public dwLastSyncResult As UInteger
    Public cNumConsecutiveSyncFailures As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DS_REPL_NEIGHBORSW
    Public cNumNeighbors As UInteger
    Public dwReserved As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public rgNeighbor() As DS_REPL_NEIGHBORW
End Structure
import ctypes
from ctypes import wintypes

class FILETIME(ctypes.Structure):
    _fields_ = [
        ("dwLowDateTime", wintypes.DWORD),
        ("dwHighDateTime", wintypes.DWORD),
    ]

class DS_REPL_NEIGHBORW(ctypes.Structure):
    _fields_ = [
        ("pszNamingContext", ctypes.c_void_p),
        ("pszSourceDsaDN", ctypes.c_void_p),
        ("pszSourceDsaAddress", ctypes.c_void_p),
        ("pszAsyncIntersiteTransportDN", ctypes.c_void_p),
        ("dwReplicaFlags", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD),
        ("uuidNamingContextObjGuid", GUID),
        ("uuidSourceDsaObjGuid", GUID),
        ("uuidSourceDsaInvocationID", GUID),
        ("uuidAsyncIntersiteTransportObjGuid", GUID),
        ("usnLastObjChangeSynced", ctypes.c_longlong),
        ("usnAttributeFilter", ctypes.c_longlong),
        ("ftimeLastSyncSuccess", FILETIME),
        ("ftimeLastSyncAttempt", FILETIME),
        ("dwLastSyncResult", wintypes.DWORD),
        ("cNumConsecutiveSyncFailures", wintypes.DWORD),
    ]

class DS_REPL_NEIGHBORSW(ctypes.Structure):
    _fields_ = [
        ("cNumNeighbors", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD),
        ("rgNeighbor", DS_REPL_NEIGHBORW * 1),
    ]
#[repr(C)]
pub struct FILETIME {
    pub dwLowDateTime: u32,
    pub dwHighDateTime: u32,
}

#[repr(C)]
pub struct DS_REPL_NEIGHBORW {
    pub pszNamingContext: *mut core::ffi::c_void,
    pub pszSourceDsaDN: *mut core::ffi::c_void,
    pub pszSourceDsaAddress: *mut core::ffi::c_void,
    pub pszAsyncIntersiteTransportDN: *mut core::ffi::c_void,
    pub dwReplicaFlags: u32,
    pub dwReserved: u32,
    pub uuidNamingContextObjGuid: GUID,
    pub uuidSourceDsaObjGuid: GUID,
    pub uuidSourceDsaInvocationID: GUID,
    pub uuidAsyncIntersiteTransportObjGuid: GUID,
    pub usnLastObjChangeSynced: i64,
    pub usnAttributeFilter: i64,
    pub ftimeLastSyncSuccess: FILETIME,
    pub ftimeLastSyncAttempt: FILETIME,
    pub dwLastSyncResult: u32,
    pub cNumConsecutiveSyncFailures: u32,
}

#[repr(C)]
pub struct DS_REPL_NEIGHBORSW {
    pub cNumNeighbors: u32,
    pub dwReserved: u32,
    pub rgNeighbor: [DS_REPL_NEIGHBORW; 1],
}
import "golang.org/x/sys/windows"

type FILETIME struct {
	dwLowDateTime uint32
	dwHighDateTime uint32
}

type DS_REPL_NEIGHBORW struct {
	pszNamingContext uintptr
	pszSourceDsaDN uintptr
	pszSourceDsaAddress uintptr
	pszAsyncIntersiteTransportDN uintptr
	dwReplicaFlags uint32
	dwReserved uint32
	uuidNamingContextObjGuid windows.GUID
	uuidSourceDsaObjGuid windows.GUID
	uuidSourceDsaInvocationID windows.GUID
	uuidAsyncIntersiteTransportObjGuid windows.GUID
	usnLastObjChangeSynced int64
	usnAttributeFilter int64
	ftimeLastSyncSuccess FILETIME
	ftimeLastSyncAttempt FILETIME
	dwLastSyncResult uint32
	cNumConsecutiveSyncFailures uint32
}

type DS_REPL_NEIGHBORSW struct {
	cNumNeighbors uint32
	dwReserved uint32
	rgNeighbor [1]DS_REPL_NEIGHBORW
}
type
  FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;

  DS_REPL_NEIGHBORW = record
    pszNamingContext: Pointer;
    pszSourceDsaDN: Pointer;
    pszSourceDsaAddress: Pointer;
    pszAsyncIntersiteTransportDN: Pointer;
    dwReplicaFlags: DWORD;
    dwReserved: DWORD;
    uuidNamingContextObjGuid: TGUID;
    uuidSourceDsaObjGuid: TGUID;
    uuidSourceDsaInvocationID: TGUID;
    uuidAsyncIntersiteTransportObjGuid: TGUID;
    usnLastObjChangeSynced: Int64;
    usnAttributeFilter: Int64;
    ftimeLastSyncSuccess: FILETIME;
    ftimeLastSyncAttempt: FILETIME;
    dwLastSyncResult: DWORD;
    cNumConsecutiveSyncFailures: DWORD;
  end;

  DS_REPL_NEIGHBORSW = record
    cNumNeighbors: DWORD;
    dwReserved: DWORD;
    rgNeighbor: array[0..0] of DS_REPL_NEIGHBORW;
  end;
const FILETIME = extern struct {
    dwLowDateTime: u32,
    dwHighDateTime: u32,
};

const DS_REPL_NEIGHBORW = extern struct {
    pszNamingContext: ?*anyopaque,
    pszSourceDsaDN: ?*anyopaque,
    pszSourceDsaAddress: ?*anyopaque,
    pszAsyncIntersiteTransportDN: ?*anyopaque,
    dwReplicaFlags: u32,
    dwReserved: u32,
    uuidNamingContextObjGuid: GUID,
    uuidSourceDsaObjGuid: GUID,
    uuidSourceDsaInvocationID: GUID,
    uuidAsyncIntersiteTransportObjGuid: GUID,
    usnLastObjChangeSynced: i64,
    usnAttributeFilter: i64,
    ftimeLastSyncSuccess: FILETIME,
    ftimeLastSyncAttempt: FILETIME,
    dwLastSyncResult: u32,
    cNumConsecutiveSyncFailures: u32,
};

const DS_REPL_NEIGHBORSW = extern struct {
    cNumNeighbors: u32,
    dwReserved: u32,
    rgNeighbor: [1]DS_REPL_NEIGHBORW,
};
type
  FILETIME {.bycopy.} = object
    dwLowDateTime: uint32
    dwHighDateTime: uint32

  DS_REPL_NEIGHBORW {.bycopy.} = object
    pszNamingContext: pointer
    pszSourceDsaDN: pointer
    pszSourceDsaAddress: pointer
    pszAsyncIntersiteTransportDN: pointer
    dwReplicaFlags: uint32
    dwReserved: uint32
    uuidNamingContextObjGuid: GUID
    uuidSourceDsaObjGuid: GUID
    uuidSourceDsaInvocationID: GUID
    uuidAsyncIntersiteTransportObjGuid: GUID
    usnLastObjChangeSynced: int64
    usnAttributeFilter: int64
    ftimeLastSyncSuccess: FILETIME
    ftimeLastSyncAttempt: FILETIME
    dwLastSyncResult: uint32
    cNumConsecutiveSyncFailures: uint32

  DS_REPL_NEIGHBORSW {.bycopy.} = object
    cNumNeighbors: uint32
    dwReserved: uint32
    rgNeighbor: array[1, DS_REPL_NEIGHBORW]
struct FILETIME
{
    uint dwLowDateTime;
    uint dwHighDateTime;
}

struct DS_REPL_NEIGHBORW
{
    void* pszNamingContext;
    void* pszSourceDsaDN;
    void* pszSourceDsaAddress;
    void* pszAsyncIntersiteTransportDN;
    uint dwReplicaFlags;
    uint dwReserved;
    GUID uuidNamingContextObjGuid;
    GUID uuidSourceDsaObjGuid;
    GUID uuidSourceDsaInvocationID;
    GUID uuidAsyncIntersiteTransportObjGuid;
    long usnLastObjChangeSynced;
    long usnAttributeFilter;
    FILETIME ftimeLastSyncSuccess;
    FILETIME ftimeLastSyncAttempt;
    uint dwLastSyncResult;
    uint cNumConsecutiveSyncFailures;
}

struct DS_REPL_NEIGHBORSW
{
    uint cNumNeighbors;
    uint dwReserved;
    DS_REPL_NEIGHBORW[1] rgNeighbor;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DS_REPL_NEIGHBORSW サイズ: 136 バイト(x86)
dim st, 34    ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; cNumNeighbors : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwReserved : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; rgNeighbor : DS_REPL_NEIGHBORW (+8, 128byte)  varptr(st)+8 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DS_REPL_NEIGHBORSW サイズ: 152 バイト(x64)
dim st, 38    ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; cNumNeighbors : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwReserved : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; rgNeighbor : DS_REPL_NEIGHBORW (+8, 144byte)  varptr(st)+8 を基点に操作(144byte:入れ子/配列)
; ※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 FILETIME
    #field int dwLowDateTime
    #field int dwHighDateTime
#endstruct

#defstruct global DS_REPL_NEIGHBORW
    #field intptr pszNamingContext
    #field intptr pszSourceDsaDN
    #field intptr pszSourceDsaAddress
    #field intptr pszAsyncIntersiteTransportDN
    #field int dwReplicaFlags
    #field int dwReserved
    #field GUID uuidNamingContextObjGuid
    #field GUID uuidSourceDsaObjGuid
    #field GUID uuidSourceDsaInvocationID
    #field GUID uuidAsyncIntersiteTransportObjGuid
    #field int64 usnLastObjChangeSynced
    #field int64 usnAttributeFilter
    #field FILETIME ftimeLastSyncSuccess
    #field FILETIME ftimeLastSyncAttempt
    #field int dwLastSyncResult
    #field int cNumConsecutiveSyncFailures
#endstruct

#defstruct global DS_REPL_NEIGHBORSW
    #field int cNumNeighbors
    #field int dwReserved
    #field DS_REPL_NEIGHBORW rgNeighbor 1
#endstruct

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