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

LSA_FOREST_TRUST_RECORD2

構造体
サイズx64: 56 バイト / x86: 40 バイト

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

フィールド

フィールドサイズx64x86説明
FlagsDWORD4+0+0フォレスト信頼レコードのフラグ(無効化状態等)。
ForestTrustTypeLSA_FOREST_TRUST_RECORD_TYPE4+4+4レコード種別(トップレベル名/ドメイン情報等)を示す列挙値。
TimeLONGLONG8+8+8レコードの作成/変更日時(100ナノ秒単位)。
ForestTrustData_ForestTrustData_e__Union40/20+16+16種別に応じた実データを格納する共用体(スキャナー情報を含む拡張版)。

共用体: _ForestTrustData_e__Union x64 40B / x86 20B

フィールドサイズx64x86
TopLevelNameLSA_UNICODE_STRING16/8+0+0
DomainInfoLSA_FOREST_TRUST_DOMAIN_INFO40/20+0+0
BinaryDataLSA_FOREST_TRUST_BINARY_DATA16/8+0+0
ScannerInfoLSA_FOREST_TRUST_SCANNER_INFO40/20+0+0

各言語での定義

#include <windows.h>

// LSA_FOREST_TRUST_RECORD2  (x64 56 / x86 40 バイト)
typedef struct LSA_FOREST_TRUST_RECORD2 {
    DWORD Flags;
    LSA_FOREST_TRUST_RECORD_TYPE ForestTrustType;
    LONGLONG Time;
    _ForestTrustData_e__Union ForestTrustData;
} LSA_FOREST_TRUST_RECORD2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LSA_FOREST_TRUST_RECORD2
{
    public uint Flags;
    public int ForestTrustType;
    public long Time;
    public _ForestTrustData_e__Union ForestTrustData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LSA_FOREST_TRUST_RECORD2
    Public Flags As UInteger
    Public ForestTrustType As Integer
    Public Time As Long
    Public ForestTrustData As _ForestTrustData_e__Union
End Structure
import ctypes
from ctypes import wintypes

class LSA_FOREST_TRUST_RECORD2(ctypes.Structure):
    _fields_ = [
        ("Flags", wintypes.DWORD),
        ("ForestTrustType", ctypes.c_int),
        ("Time", ctypes.c_longlong),
        ("ForestTrustData", _ForestTrustData_e__Union),
    ]
#[repr(C)]
pub struct LSA_FOREST_TRUST_RECORD2 {
    pub Flags: u32,
    pub ForestTrustType: i32,
    pub Time: i64,
    pub ForestTrustData: _ForestTrustData_e__Union,
}
import "golang.org/x/sys/windows"

type LSA_FOREST_TRUST_RECORD2 struct {
	Flags uint32
	ForestTrustType int32
	Time int64
	ForestTrustData _ForestTrustData_e__Union
}
type
  LSA_FOREST_TRUST_RECORD2 = record
    Flags: DWORD;
    ForestTrustType: Integer;
    Time: Int64;
    ForestTrustData: _ForestTrustData_e__Union;
  end;
const LSA_FOREST_TRUST_RECORD2 = extern struct {
    Flags: u32,
    ForestTrustType: i32,
    Time: i64,
    ForestTrustData: _ForestTrustData_e__Union,
};
type
  LSA_FOREST_TRUST_RECORD2 {.bycopy.} = object
    Flags: uint32
    ForestTrustType: int32
    Time: int64
    ForestTrustData: _ForestTrustData_e__Union
struct LSA_FOREST_TRUST_RECORD2
{
    uint Flags;
    int ForestTrustType;
    long Time;
    _ForestTrustData_e__Union ForestTrustData;
}

HSP用 定義

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

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

stdim st, LSA_FOREST_TRUST_RECORD2        ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。