Win32 API 日本語リファレンス
ホームSecurity.Authorization › AUTHZ_ACCESS_REQUEST

AUTHZ_ACCESS_REQUEST

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

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

フィールド

フィールドサイズx64x86説明
DesiredAccessDWORD4+0+0要求するアクセス権のビットマスク。MAXIMUM_ALLOWEDも指定可。
PrincipalSelfSidPSID8/4+8+4ACE内のPRINCIPAL_SELFに置き換えるSID。NULL可。
ObjectTypeListOBJECT_TYPE_LIST*8/4+16+8オブジェクト種別単位のアクセスチェックに使う配列。NULL可。
ObjectTypeListLengthDWORD4+24+12ObjectTypeList配列の要素数。
OptionalArgumentsvoid*8/4+32+16コールバックACE評価時に渡される任意引数へのポインタ。NULL可。

各言語での定義

#include <windows.h>

// AUTHZ_ACCESS_REQUEST  (x64 40 / x86 20 バイト)
typedef struct AUTHZ_ACCESS_REQUEST {
    DWORD DesiredAccess;
    PSID PrincipalSelfSid;
    OBJECT_TYPE_LIST* ObjectTypeList;
    DWORD ObjectTypeListLength;
    void* OptionalArguments;
} AUTHZ_ACCESS_REQUEST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AUTHZ_ACCESS_REQUEST
{
    public uint DesiredAccess;
    public IntPtr PrincipalSelfSid;
    public IntPtr ObjectTypeList;
    public uint ObjectTypeListLength;
    public IntPtr OptionalArguments;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AUTHZ_ACCESS_REQUEST
    Public DesiredAccess As UInteger
    Public PrincipalSelfSid As IntPtr
    Public ObjectTypeList As IntPtr
    Public ObjectTypeListLength As UInteger
    Public OptionalArguments As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class AUTHZ_ACCESS_REQUEST(ctypes.Structure):
    _fields_ = [
        ("DesiredAccess", wintypes.DWORD),
        ("PrincipalSelfSid", ctypes.c_void_p),
        ("ObjectTypeList", ctypes.c_void_p),
        ("ObjectTypeListLength", wintypes.DWORD),
        ("OptionalArguments", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct AUTHZ_ACCESS_REQUEST {
    pub DesiredAccess: u32,
    pub PrincipalSelfSid: *mut core::ffi::c_void,
    pub ObjectTypeList: *mut core::ffi::c_void,
    pub ObjectTypeListLength: u32,
    pub OptionalArguments: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type AUTHZ_ACCESS_REQUEST struct {
	DesiredAccess uint32
	PrincipalSelfSid uintptr
	ObjectTypeList uintptr
	ObjectTypeListLength uint32
	OptionalArguments uintptr
}
type
  AUTHZ_ACCESS_REQUEST = record
    DesiredAccess: DWORD;
    PrincipalSelfSid: Pointer;
    ObjectTypeList: Pointer;
    ObjectTypeListLength: DWORD;
    OptionalArguments: Pointer;
  end;
const AUTHZ_ACCESS_REQUEST = extern struct {
    DesiredAccess: u32,
    PrincipalSelfSid: ?*anyopaque,
    ObjectTypeList: ?*anyopaque,
    ObjectTypeListLength: u32,
    OptionalArguments: ?*anyopaque,
};
type
  AUTHZ_ACCESS_REQUEST {.bycopy.} = object
    DesiredAccess: uint32
    PrincipalSelfSid: pointer
    ObjectTypeList: pointer
    ObjectTypeListLength: uint32
    OptionalArguments: pointer
struct AUTHZ_ACCESS_REQUEST
{
    uint DesiredAccess;
    void* PrincipalSelfSid;
    void* ObjectTypeList;
    uint ObjectTypeListLength;
    void* OptionalArguments;
}

HSP用 定義

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

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

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