Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › TRUSTED_DOMAIN_FULL_INFORMATION

TRUSTED_DOMAIN_FULL_INFORMATION

構造体
サイズx64: 112 バイト / x86: 60 バイト

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

フィールド

フィールドサイズx64x86説明
InformationTRUSTED_DOMAIN_INFORMATION_EX56/32+0+0信頼ドメインの基本拡張情報(TRUSTED_DOMAIN_INFORMATION_EX)。
PosixOffsetTRUSTED_POSIX_OFFSET_INFO4+56+32信頼ドメインのPOSIXオフセット情報。
AuthInformationTRUSTED_DOMAIN_AUTH_INFORMATION48/24+64+36信頼ドメインの認証情報。

各言語での定義

#include <windows.h>

// LSA_UNICODE_STRING  (x64 16 / x86 8 バイト)
typedef struct LSA_UNICODE_STRING {
    WORD Length;
    WORD MaximumLength;
    LPWSTR Buffer;
} LSA_UNICODE_STRING;

// TRUSTED_DOMAIN_INFORMATION_EX  (x64 56 / x86 32 バイト)
typedef struct TRUSTED_DOMAIN_INFORMATION_EX {
    LSA_UNICODE_STRING Name;
    LSA_UNICODE_STRING FlatName;
    PSID Sid;
    TRUSTED_DOMAIN_TRUST_DIRECTION TrustDirection;
    TRUSTED_DOMAIN_TRUST_TYPE TrustType;
    TRUSTED_DOMAIN_TRUST_ATTRIBUTES TrustAttributes;
} TRUSTED_DOMAIN_INFORMATION_EX;

// TRUSTED_POSIX_OFFSET_INFO  (x64 4 / x86 4 バイト)
typedef struct TRUSTED_POSIX_OFFSET_INFO {
    DWORD Offset;
} TRUSTED_POSIX_OFFSET_INFO;

// TRUSTED_DOMAIN_AUTH_INFORMATION  (x64 48 / x86 24 バイト)
typedef struct TRUSTED_DOMAIN_AUTH_INFORMATION {
    DWORD IncomingAuthInfos;
    LSA_AUTH_INFORMATION* IncomingAuthenticationInformation;
    LSA_AUTH_INFORMATION* IncomingPreviousAuthenticationInformation;
    DWORD OutgoingAuthInfos;
    LSA_AUTH_INFORMATION* OutgoingAuthenticationInformation;
    LSA_AUTH_INFORMATION* OutgoingPreviousAuthenticationInformation;
} TRUSTED_DOMAIN_AUTH_INFORMATION;

// TRUSTED_DOMAIN_FULL_INFORMATION  (x64 112 / x86 60 バイト)
typedef struct TRUSTED_DOMAIN_FULL_INFORMATION {
    TRUSTED_DOMAIN_INFORMATION_EX Information;
    TRUSTED_POSIX_OFFSET_INFO PosixOffset;
    TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation;
} TRUSTED_DOMAIN_FULL_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LSA_UNICODE_STRING
{
    public ushort Length;
    public ushort MaximumLength;
    public IntPtr Buffer;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TRUSTED_DOMAIN_INFORMATION_EX
{
    public LSA_UNICODE_STRING Name;
    public LSA_UNICODE_STRING FlatName;
    public IntPtr Sid;
    public uint TrustDirection;
    public uint TrustType;
    public uint TrustAttributes;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TRUSTED_POSIX_OFFSET_INFO
{
    public uint Offset;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TRUSTED_DOMAIN_AUTH_INFORMATION
{
    public uint IncomingAuthInfos;
    public IntPtr IncomingAuthenticationInformation;
    public IntPtr IncomingPreviousAuthenticationInformation;
    public uint OutgoingAuthInfos;
    public IntPtr OutgoingAuthenticationInformation;
    public IntPtr OutgoingPreviousAuthenticationInformation;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TRUSTED_DOMAIN_FULL_INFORMATION
{
    public TRUSTED_DOMAIN_INFORMATION_EX Information;
    public TRUSTED_POSIX_OFFSET_INFO PosixOffset;
    public TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LSA_UNICODE_STRING
    Public Length As UShort
    Public MaximumLength As UShort
    Public Buffer As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TRUSTED_DOMAIN_INFORMATION_EX
    Public Name As LSA_UNICODE_STRING
    Public FlatName As LSA_UNICODE_STRING
    Public Sid As IntPtr
    Public TrustDirection As UInteger
    Public TrustType As UInteger
    Public TrustAttributes As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TRUSTED_POSIX_OFFSET_INFO
    Public Offset As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TRUSTED_DOMAIN_AUTH_INFORMATION
    Public IncomingAuthInfos As UInteger
    Public IncomingAuthenticationInformation As IntPtr
    Public IncomingPreviousAuthenticationInformation As IntPtr
    Public OutgoingAuthInfos As UInteger
    Public OutgoingAuthenticationInformation As IntPtr
    Public OutgoingPreviousAuthenticationInformation As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TRUSTED_DOMAIN_FULL_INFORMATION
    Public Information As TRUSTED_DOMAIN_INFORMATION_EX
    Public PosixOffset As TRUSTED_POSIX_OFFSET_INFO
    Public AuthInformation As TRUSTED_DOMAIN_AUTH_INFORMATION
End Structure
import ctypes
from ctypes import wintypes

class LSA_UNICODE_STRING(ctypes.Structure):
    _fields_ = [
        ("Length", ctypes.c_ushort),
        ("MaximumLength", ctypes.c_ushort),
        ("Buffer", ctypes.c_void_p),
    ]

class TRUSTED_DOMAIN_INFORMATION_EX(ctypes.Structure):
    _fields_ = [
        ("Name", LSA_UNICODE_STRING),
        ("FlatName", LSA_UNICODE_STRING),
        ("Sid", ctypes.c_void_p),
        ("TrustDirection", wintypes.DWORD),
        ("TrustType", wintypes.DWORD),
        ("TrustAttributes", wintypes.DWORD),
    ]

class TRUSTED_POSIX_OFFSET_INFO(ctypes.Structure):
    _fields_ = [
        ("Offset", wintypes.DWORD),
    ]

class TRUSTED_DOMAIN_AUTH_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("IncomingAuthInfos", wintypes.DWORD),
        ("IncomingAuthenticationInformation", ctypes.c_void_p),
        ("IncomingPreviousAuthenticationInformation", ctypes.c_void_p),
        ("OutgoingAuthInfos", wintypes.DWORD),
        ("OutgoingAuthenticationInformation", ctypes.c_void_p),
        ("OutgoingPreviousAuthenticationInformation", ctypes.c_void_p),
    ]

class TRUSTED_DOMAIN_FULL_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("Information", TRUSTED_DOMAIN_INFORMATION_EX),
        ("PosixOffset", TRUSTED_POSIX_OFFSET_INFO),
        ("AuthInformation", TRUSTED_DOMAIN_AUTH_INFORMATION),
    ]
#[repr(C)]
pub struct LSA_UNICODE_STRING {
    pub Length: u16,
    pub MaximumLength: u16,
    pub Buffer: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct TRUSTED_DOMAIN_INFORMATION_EX {
    pub Name: LSA_UNICODE_STRING,
    pub FlatName: LSA_UNICODE_STRING,
    pub Sid: *mut core::ffi::c_void,
    pub TrustDirection: u32,
    pub TrustType: u32,
    pub TrustAttributes: u32,
}

#[repr(C)]
pub struct TRUSTED_POSIX_OFFSET_INFO {
    pub Offset: u32,
}

#[repr(C)]
pub struct TRUSTED_DOMAIN_AUTH_INFORMATION {
    pub IncomingAuthInfos: u32,
    pub IncomingAuthenticationInformation: *mut core::ffi::c_void,
    pub IncomingPreviousAuthenticationInformation: *mut core::ffi::c_void,
    pub OutgoingAuthInfos: u32,
    pub OutgoingAuthenticationInformation: *mut core::ffi::c_void,
    pub OutgoingPreviousAuthenticationInformation: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct TRUSTED_DOMAIN_FULL_INFORMATION {
    pub Information: TRUSTED_DOMAIN_INFORMATION_EX,
    pub PosixOffset: TRUSTED_POSIX_OFFSET_INFO,
    pub AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION,
}
import "golang.org/x/sys/windows"

type LSA_UNICODE_STRING struct {
	Length uint16
	MaximumLength uint16
	Buffer uintptr
}

type TRUSTED_DOMAIN_INFORMATION_EX struct {
	Name LSA_UNICODE_STRING
	FlatName LSA_UNICODE_STRING
	Sid uintptr
	TrustDirection uint32
	TrustType uint32
	TrustAttributes uint32
}

type TRUSTED_POSIX_OFFSET_INFO struct {
	Offset uint32
}

type TRUSTED_DOMAIN_AUTH_INFORMATION struct {
	IncomingAuthInfos uint32
	IncomingAuthenticationInformation uintptr
	IncomingPreviousAuthenticationInformation uintptr
	OutgoingAuthInfos uint32
	OutgoingAuthenticationInformation uintptr
	OutgoingPreviousAuthenticationInformation uintptr
}

type TRUSTED_DOMAIN_FULL_INFORMATION struct {
	Information TRUSTED_DOMAIN_INFORMATION_EX
	PosixOffset TRUSTED_POSIX_OFFSET_INFO
	AuthInformation TRUSTED_DOMAIN_AUTH_INFORMATION
}
type
  LSA_UNICODE_STRING = record
    Length: Word;
    MaximumLength: Word;
    Buffer: Pointer;
  end;

  TRUSTED_DOMAIN_INFORMATION_EX = record
    Name: LSA_UNICODE_STRING;
    FlatName: LSA_UNICODE_STRING;
    Sid: Pointer;
    TrustDirection: DWORD;
    TrustType: DWORD;
    TrustAttributes: DWORD;
  end;

  TRUSTED_POSIX_OFFSET_INFO = record
    Offset: DWORD;
  end;

  TRUSTED_DOMAIN_AUTH_INFORMATION = record
    IncomingAuthInfos: DWORD;
    IncomingAuthenticationInformation: Pointer;
    IncomingPreviousAuthenticationInformation: Pointer;
    OutgoingAuthInfos: DWORD;
    OutgoingAuthenticationInformation: Pointer;
    OutgoingPreviousAuthenticationInformation: Pointer;
  end;

  TRUSTED_DOMAIN_FULL_INFORMATION = record
    Information: TRUSTED_DOMAIN_INFORMATION_EX;
    PosixOffset: TRUSTED_POSIX_OFFSET_INFO;
    AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION;
  end;
const LSA_UNICODE_STRING = extern struct {
    Length: u16,
    MaximumLength: u16,
    Buffer: ?*anyopaque,
};

const TRUSTED_DOMAIN_INFORMATION_EX = extern struct {
    Name: LSA_UNICODE_STRING,
    FlatName: LSA_UNICODE_STRING,
    Sid: ?*anyopaque,
    TrustDirection: u32,
    TrustType: u32,
    TrustAttributes: u32,
};

const TRUSTED_POSIX_OFFSET_INFO = extern struct {
    Offset: u32,
};

const TRUSTED_DOMAIN_AUTH_INFORMATION = extern struct {
    IncomingAuthInfos: u32,
    IncomingAuthenticationInformation: ?*anyopaque,
    IncomingPreviousAuthenticationInformation: ?*anyopaque,
    OutgoingAuthInfos: u32,
    OutgoingAuthenticationInformation: ?*anyopaque,
    OutgoingPreviousAuthenticationInformation: ?*anyopaque,
};

const TRUSTED_DOMAIN_FULL_INFORMATION = extern struct {
    Information: TRUSTED_DOMAIN_INFORMATION_EX,
    PosixOffset: TRUSTED_POSIX_OFFSET_INFO,
    AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION,
};
type
  LSA_UNICODE_STRING {.bycopy.} = object
    Length: uint16
    MaximumLength: uint16
    Buffer: pointer

  TRUSTED_DOMAIN_INFORMATION_EX {.bycopy.} = object
    Name: LSA_UNICODE_STRING
    FlatName: LSA_UNICODE_STRING
    Sid: pointer
    TrustDirection: uint32
    TrustType: uint32
    TrustAttributes: uint32

  TRUSTED_POSIX_OFFSET_INFO {.bycopy.} = object
    Offset: uint32

  TRUSTED_DOMAIN_AUTH_INFORMATION {.bycopy.} = object
    IncomingAuthInfos: uint32
    IncomingAuthenticationInformation: pointer
    IncomingPreviousAuthenticationInformation: pointer
    OutgoingAuthInfos: uint32
    OutgoingAuthenticationInformation: pointer
    OutgoingPreviousAuthenticationInformation: pointer

  TRUSTED_DOMAIN_FULL_INFORMATION {.bycopy.} = object
    Information: TRUSTED_DOMAIN_INFORMATION_EX
    PosixOffset: TRUSTED_POSIX_OFFSET_INFO
    AuthInformation: TRUSTED_DOMAIN_AUTH_INFORMATION
struct LSA_UNICODE_STRING
{
    ushort Length;
    ushort MaximumLength;
    void* Buffer;
}

struct TRUSTED_DOMAIN_INFORMATION_EX
{
    LSA_UNICODE_STRING Name;
    LSA_UNICODE_STRING FlatName;
    void* Sid;
    uint TrustDirection;
    uint TrustType;
    uint TrustAttributes;
}

struct TRUSTED_POSIX_OFFSET_INFO
{
    uint Offset;
}

struct TRUSTED_DOMAIN_AUTH_INFORMATION
{
    uint IncomingAuthInfos;
    void* IncomingAuthenticationInformation;
    void* IncomingPreviousAuthenticationInformation;
    uint OutgoingAuthInfos;
    void* OutgoingAuthenticationInformation;
    void* OutgoingPreviousAuthenticationInformation;
}

struct TRUSTED_DOMAIN_FULL_INFORMATION
{
    TRUSTED_DOMAIN_INFORMATION_EX Information;
    TRUSTED_POSIX_OFFSET_INFO PosixOffset;
    TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TRUSTED_DOMAIN_FULL_INFORMATION サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; Information : TRUSTED_DOMAIN_INFORMATION_EX (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; PosixOffset : TRUSTED_POSIX_OFFSET_INFO (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; AuthInformation : TRUSTED_DOMAIN_AUTH_INFORMATION (+36, 24byte)  varptr(st)+36 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TRUSTED_DOMAIN_FULL_INFORMATION サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; Information : TRUSTED_DOMAIN_INFORMATION_EX (+0, 56byte)  varptr(st)+0 を基点に操作(56byte:入れ子/配列)
; PosixOffset : TRUSTED_POSIX_OFFSET_INFO (+56, 4byte)  varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; AuthInformation : TRUSTED_DOMAIN_AUTH_INFORMATION (+64, 48byte)  varptr(st)+64 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LSA_UNICODE_STRING
    #field short Length
    #field short MaximumLength
    #field intptr Buffer
#endstruct

#defstruct global TRUSTED_DOMAIN_INFORMATION_EX
    #field LSA_UNICODE_STRING Name
    #field LSA_UNICODE_STRING FlatName
    #field intptr Sid
    #field int TrustDirection
    #field int TrustType
    #field int TrustAttributes
#endstruct

#defstruct global TRUSTED_POSIX_OFFSET_INFO
    #field int Offset
#endstruct

#defstruct global TRUSTED_DOMAIN_AUTH_INFORMATION
    #field int IncomingAuthInfos
    #field intptr IncomingAuthenticationInformation
    #field intptr IncomingPreviousAuthenticationInformation
    #field int OutgoingAuthInfos
    #field intptr OutgoingAuthenticationInformation
    #field intptr OutgoingPreviousAuthenticationInformation
#endstruct

#defstruct global TRUSTED_DOMAIN_FULL_INFORMATION
    #field TRUSTED_DOMAIN_INFORMATION_EX Information
    #field TRUSTED_POSIX_OFFSET_INFO PosixOffset
    #field TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation
#endstruct

stdim st, TRUSTED_DOMAIN_FULL_INFORMATION        ; NSTRUCT 変数を確保