SECURITY_DESCRIPTOR_RELATIVE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Revision | BYTE | 1 | +0 | +0 | セキュリティ記述子のリビジョン番号。通常は1。 |
| Sbz1 | BYTE | 1 | +1 | +1 | リソースマネージャ制御用バイト。 |
| Control | SECURITY_DESCRIPTOR_CONTROL | 2 | +2 | +2 | セキュリティ記述子の制御フラグの組み合わせ。 |
| Owner | DWORD | 4 | +4 | +4 | 所有者SIDへの記述子先頭からのオフセット。0でなし。 |
| Group | DWORD | 4 | +8 | +8 | プライマリグループSIDへのオフセット。0でなし。 |
| Sacl | DWORD | 4 | +12 | +12 | システムACL(SACL)へのオフセット。0でなし。 |
| Dacl | DWORD | 4 | +16 | +16 | 随意ACL(DACL)へのオフセット。0でなし。 |
各言語での定義
#include <windows.h>
// SECURITY_DESCRIPTOR_RELATIVE (x64 20 / x86 20 バイト)
typedef struct SECURITY_DESCRIPTOR_RELATIVE {
BYTE Revision;
BYTE Sbz1;
SECURITY_DESCRIPTOR_CONTROL Control;
DWORD Owner;
DWORD Group;
DWORD Sacl;
DWORD Dacl;
} SECURITY_DESCRIPTOR_RELATIVE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURITY_DESCRIPTOR_RELATIVE
{
public byte Revision;
public byte Sbz1;
public ushort Control;
public uint Owner;
public uint Group;
public uint Sacl;
public uint Dacl;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECURITY_DESCRIPTOR_RELATIVE
Public Revision As Byte
Public Sbz1 As Byte
Public Control As UShort
Public Owner As UInteger
Public Group As UInteger
Public Sacl As UInteger
Public Dacl As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SECURITY_DESCRIPTOR_RELATIVE(ctypes.Structure):
_fields_ = [
("Revision", ctypes.c_ubyte),
("Sbz1", ctypes.c_ubyte),
("Control", ctypes.c_ushort),
("Owner", wintypes.DWORD),
("Group", wintypes.DWORD),
("Sacl", wintypes.DWORD),
("Dacl", wintypes.DWORD),
]#[repr(C)]
pub struct SECURITY_DESCRIPTOR_RELATIVE {
pub Revision: u8,
pub Sbz1: u8,
pub Control: u16,
pub Owner: u32,
pub Group: u32,
pub Sacl: u32,
pub Dacl: u32,
}import "golang.org/x/sys/windows"
type SECURITY_DESCRIPTOR_RELATIVE struct {
Revision byte
Sbz1 byte
Control uint16
Owner uint32
Group uint32
Sacl uint32
Dacl uint32
}type
SECURITY_DESCRIPTOR_RELATIVE = record
Revision: Byte;
Sbz1: Byte;
Control: Word;
Owner: DWORD;
Group: DWORD;
Sacl: DWORD;
Dacl: DWORD;
end;const SECURITY_DESCRIPTOR_RELATIVE = extern struct {
Revision: u8,
Sbz1: u8,
Control: u16,
Owner: u32,
Group: u32,
Sacl: u32,
Dacl: u32,
};type
SECURITY_DESCRIPTOR_RELATIVE {.bycopy.} = object
Revision: uint8
Sbz1: uint8
Control: uint16
Owner: uint32
Group: uint32
Sacl: uint32
Dacl: uint32struct SECURITY_DESCRIPTOR_RELATIVE
{
ubyte Revision;
ubyte Sbz1;
ushort Control;
uint Owner;
uint Group;
uint Sacl;
uint Dacl;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECURITY_DESCRIPTOR_RELATIVE サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Revision : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Sbz1 : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; Control : SECURITY_DESCRIPTOR_CONTROL (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; Owner : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Group : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Sacl : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Dacl : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SECURITY_DESCRIPTOR_RELATIVE
#field byte Revision
#field byte Sbz1
#field short Control
#field int Owner
#field int Group
#field int Sacl
#field int Dacl
#endstruct
stdim st, SECURITY_DESCRIPTOR_RELATIVE ; NSTRUCT 変数を確保
st->Revision = 100
mes "Revision=" + st->Revision