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

SE_ADT_ACCESS_REASON

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

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

フィールド

フィールドサイズx64x86説明
AccessMaskDWORD4+0+0要求または評価されたアクセスマスク。
AccessReasonsDWORD128+4+4各アクセスが許可/拒否された理由を示すコード。
ObjectTypeIndexDWORD4+132+132対象オブジェクト種別配列内のインデックス。
AccessGrantedDWORD4+136+136アクセスが許可されたか否かを示す値。
SecurityDescriptorPSECURITY_DESCRIPTOR8/4+144+140判定に用いられたセキュリティ記述子。

各言語での定義

#include <windows.h>

// SE_ADT_ACCESS_REASON  (x64 152 / x86 144 バイト)
typedef struct SE_ADT_ACCESS_REASON {
    DWORD AccessMask;
    DWORD AccessReasons[32];
    DWORD ObjectTypeIndex;
    DWORD AccessGranted;
    PSECURITY_DESCRIPTOR SecurityDescriptor;
} SE_ADT_ACCESS_REASON;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SE_ADT_ACCESS_REASON
{
    public uint AccessMask;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public uint[] AccessReasons;
    public uint ObjectTypeIndex;
    public uint AccessGranted;
    public IntPtr SecurityDescriptor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SE_ADT_ACCESS_REASON
    Public AccessMask As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public AccessReasons() As UInteger
    Public ObjectTypeIndex As UInteger
    Public AccessGranted As UInteger
    Public SecurityDescriptor As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SE_ADT_ACCESS_REASON(ctypes.Structure):
    _fields_ = [
        ("AccessMask", wintypes.DWORD),
        ("AccessReasons", wintypes.DWORD * 32),
        ("ObjectTypeIndex", wintypes.DWORD),
        ("AccessGranted", wintypes.DWORD),
        ("SecurityDescriptor", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SE_ADT_ACCESS_REASON {
    pub AccessMask: u32,
    pub AccessReasons: [u32; 32],
    pub ObjectTypeIndex: u32,
    pub AccessGranted: u32,
    pub SecurityDescriptor: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SE_ADT_ACCESS_REASON struct {
	AccessMask uint32
	AccessReasons [32]uint32
	ObjectTypeIndex uint32
	AccessGranted uint32
	SecurityDescriptor uintptr
}
type
  SE_ADT_ACCESS_REASON = record
    AccessMask: DWORD;
    AccessReasons: array[0..31] of DWORD;
    ObjectTypeIndex: DWORD;
    AccessGranted: DWORD;
    SecurityDescriptor: Pointer;
  end;
const SE_ADT_ACCESS_REASON = extern struct {
    AccessMask: u32,
    AccessReasons: [32]u32,
    ObjectTypeIndex: u32,
    AccessGranted: u32,
    SecurityDescriptor: ?*anyopaque,
};
type
  SE_ADT_ACCESS_REASON {.bycopy.} = object
    AccessMask: uint32
    AccessReasons: array[32, uint32]
    ObjectTypeIndex: uint32
    AccessGranted: uint32
    SecurityDescriptor: pointer
struct SE_ADT_ACCESS_REASON
{
    uint AccessMask;
    uint[32] AccessReasons;
    uint ObjectTypeIndex;
    uint AccessGranted;
    void* SecurityDescriptor;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SE_ADT_ACCESS_REASON サイズ: 144 バイト(x86)
dim st, 36    ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; AccessMask : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; AccessReasons : DWORD (+4, 128byte)  varptr(st)+4 を基点に操作(128byte:入れ子/配列)
; ObjectTypeIndex : DWORD (+132, 4byte)  st.33 = 値  /  値 = st.33   (lpoke/lpeek も可)
; AccessGranted : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; SecurityDescriptor : PSECURITY_DESCRIPTOR (+140, 4byte)  st.35 = 値  /  値 = st.35   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SE_ADT_ACCESS_REASON サイズ: 152 バイト(x64)
dim st, 38    ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; AccessMask : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; AccessReasons : DWORD (+4, 128byte)  varptr(st)+4 を基点に操作(128byte:入れ子/配列)
; ObjectTypeIndex : DWORD (+132, 4byte)  st.33 = 値  /  値 = st.33   (lpoke/lpeek も可)
; AccessGranted : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; SecurityDescriptor : PSECURITY_DESCRIPTOR (+144, 8byte)  qpoke st,144,値 / qpeek(st,144)  ※IronHSPのみ。3.7/3.8は lpoke st,144,下位 : lpoke st,148,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SE_ADT_ACCESS_REASON
    #field int AccessMask
    #field int AccessReasons 32
    #field int ObjectTypeIndex
    #field int AccessGranted
    #field intptr SecurityDescriptor
#endstruct

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