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

TRUSTEE_W

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

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

フィールド

フィールドサイズx64x86説明
pMultipleTrusteeTRUSTEE_W*8/4+0+0複合トラスティを指すポインタ。通常はNULL。
MultipleTrusteeOperationMULTIPLE_TRUSTEE_OPERATION4+8+4複合トラスティの操作種別を示す列挙値。通常TRUSTEE_IS_INVALID。
TrusteeFormTRUSTEE_FORM4+12+8ptstrNameが名前かSIDか等の形式を示す列挙値。
TrusteeTypeTRUSTEE_TYPE4+16+12ユーザー/グループ/ドメイン等のトラスティ種別を示す列挙値。
ptstrNameLPWSTR8/4+24+16TrusteeFormに応じた名前文字列またはSID等へのポインタ(Unicode)。

各言語での定義

#include <windows.h>

// TRUSTEE_W  (x64 32 / x86 20 バイト)
typedef struct TRUSTEE_W {
    TRUSTEE_W* pMultipleTrustee;
    MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation;
    TRUSTEE_FORM TrusteeForm;
    TRUSTEE_TYPE TrusteeType;
    LPWSTR ptstrName;
} TRUSTEE_W;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TRUSTEE_W
{
    public IntPtr pMultipleTrustee;
    public int MultipleTrusteeOperation;
    public int TrusteeForm;
    public int TrusteeType;
    public IntPtr ptstrName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TRUSTEE_W
    Public pMultipleTrustee As IntPtr
    Public MultipleTrusteeOperation As Integer
    Public TrusteeForm As Integer
    Public TrusteeType As Integer
    Public ptstrName As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class TRUSTEE_W(ctypes.Structure):
    _fields_ = [
        ("pMultipleTrustee", ctypes.c_void_p),
        ("MultipleTrusteeOperation", ctypes.c_int),
        ("TrusteeForm", ctypes.c_int),
        ("TrusteeType", ctypes.c_int),
        ("ptstrName", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct TRUSTEE_W {
    pub pMultipleTrustee: *mut core::ffi::c_void,
    pub MultipleTrusteeOperation: i32,
    pub TrusteeForm: i32,
    pub TrusteeType: i32,
    pub ptstrName: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type TRUSTEE_W struct {
	pMultipleTrustee uintptr
	MultipleTrusteeOperation int32
	TrusteeForm int32
	TrusteeType int32
	ptstrName uintptr
}
type
  TRUSTEE_W = record
    pMultipleTrustee: Pointer;
    MultipleTrusteeOperation: Integer;
    TrusteeForm: Integer;
    TrusteeType: Integer;
    ptstrName: Pointer;
  end;
const TRUSTEE_W = extern struct {
    pMultipleTrustee: ?*anyopaque,
    MultipleTrusteeOperation: i32,
    TrusteeForm: i32,
    TrusteeType: i32,
    ptstrName: ?*anyopaque,
};
type
  TRUSTEE_W {.bycopy.} = object
    pMultipleTrustee: pointer
    MultipleTrusteeOperation: int32
    TrusteeForm: int32
    TrusteeType: int32
    ptstrName: pointer
struct TRUSTEE_W
{
    void* pMultipleTrustee;
    int MultipleTrusteeOperation;
    int TrusteeForm;
    int TrusteeType;
    void* ptstrName;
}

HSP用 定義

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

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

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