Win32 API 日本語リファレンス
ホームSystem.Ioctl › SD_ENUM_SDS_ENTRY

SD_ENUM_SDS_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
HashDWORD4+0+0セキュリティ記述子のハッシュ値。
SecurityIdDWORD4+4+4セキュリティ記述子に割り当てられたセキュリティID。
OffsetULONGLONG8+8+8$SDSストリーム内でのこの記述子のオフセット(バイト)。
LengthDWORD4+16+16セキュリティ記述子の長さ(バイト)。
DescriptorBYTE1+20+20自己相対形式のセキュリティ記述子データの先頭バイト。

各言語での定義

#include <windows.h>

// SD_ENUM_SDS_ENTRY  (x64 24 / x86 24 バイト)
typedef struct SD_ENUM_SDS_ENTRY {
    DWORD Hash;
    DWORD SecurityId;
    ULONGLONG Offset;
    DWORD Length;
    BYTE Descriptor[1];
} SD_ENUM_SDS_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SD_ENUM_SDS_ENTRY
{
    public uint Hash;
    public uint SecurityId;
    public ulong Offset;
    public uint Length;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] Descriptor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SD_ENUM_SDS_ENTRY
    Public Hash As UInteger
    Public SecurityId As UInteger
    Public Offset As ULong
    Public Length As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Descriptor() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SD_ENUM_SDS_ENTRY(ctypes.Structure):
    _fields_ = [
        ("Hash", wintypes.DWORD),
        ("SecurityId", wintypes.DWORD),
        ("Offset", ctypes.c_ulonglong),
        ("Length", wintypes.DWORD),
        ("Descriptor", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct SD_ENUM_SDS_ENTRY {
    pub Hash: u32,
    pub SecurityId: u32,
    pub Offset: u64,
    pub Length: u32,
    pub Descriptor: [u8; 1],
}
import "golang.org/x/sys/windows"

type SD_ENUM_SDS_ENTRY struct {
	Hash uint32
	SecurityId uint32
	Offset uint64
	Length uint32
	Descriptor [1]byte
}
type
  SD_ENUM_SDS_ENTRY = record
    Hash: DWORD;
    SecurityId: DWORD;
    Offset: UInt64;
    Length: DWORD;
    Descriptor: array[0..0] of Byte;
  end;
const SD_ENUM_SDS_ENTRY = extern struct {
    Hash: u32,
    SecurityId: u32,
    Offset: u64,
    Length: u32,
    Descriptor: [1]u8,
};
type
  SD_ENUM_SDS_ENTRY {.bycopy.} = object
    Hash: uint32
    SecurityId: uint32
    Offset: uint64
    Length: uint32
    Descriptor: array[1, uint8]
struct SD_ENUM_SDS_ENTRY
{
    uint Hash;
    uint SecurityId;
    ulong Offset;
    uint Length;
    ubyte[1] Descriptor;
}

HSP用 定義

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

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

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