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

SID_AND_ATTRIBUTES_HASH

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

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

フィールド

フィールドサイズx64x86説明
SidCountDWORD4+0+0SidAttr配列の要素数。
SidAttrSID_AND_ATTRIBUTES*8/4+8+4SIDと属性の組の配列へのポインタ。
HashUINT_PTR256/128+16+8高速検索用のSIDハッシュ値配列。

各言語での定義

#include <windows.h>

// SID_AND_ATTRIBUTES_HASH  (x64 272 / x86 136 バイト)
typedef struct SID_AND_ATTRIBUTES_HASH {
    DWORD SidCount;
    SID_AND_ATTRIBUTES* SidAttr;
    UINT_PTR Hash[32];
} SID_AND_ATTRIBUTES_HASH;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SID_AND_ATTRIBUTES_HASH
{
    public uint SidCount;
    public IntPtr SidAttr;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public UIntPtr[] Hash;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SID_AND_ATTRIBUTES_HASH
    Public SidCount As UInteger
    Public SidAttr As IntPtr
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public Hash() As UIntPtr
End Structure
import ctypes
from ctypes import wintypes

class SID_AND_ATTRIBUTES_HASH(ctypes.Structure):
    _fields_ = [
        ("SidCount", wintypes.DWORD),
        ("SidAttr", ctypes.c_void_p),
        ("Hash", ctypes.c_size_t * 32),
    ]
#[repr(C)]
pub struct SID_AND_ATTRIBUTES_HASH {
    pub SidCount: u32,
    pub SidAttr: *mut core::ffi::c_void,
    pub Hash: [usize; 32],
}
import "golang.org/x/sys/windows"

type SID_AND_ATTRIBUTES_HASH struct {
	SidCount uint32
	SidAttr uintptr
	Hash [32]uintptr
}
type
  SID_AND_ATTRIBUTES_HASH = record
    SidCount: DWORD;
    SidAttr: Pointer;
    Hash: array[0..31] of NativeUInt;
  end;
const SID_AND_ATTRIBUTES_HASH = extern struct {
    SidCount: u32,
    SidAttr: ?*anyopaque,
    Hash: [32]usize,
};
type
  SID_AND_ATTRIBUTES_HASH {.bycopy.} = object
    SidCount: uint32
    SidAttr: pointer
    Hash: array[32, uint]
struct SID_AND_ATTRIBUTES_HASH
{
    uint SidCount;
    void* SidAttr;
    size_t[32] Hash;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SID_AND_ATTRIBUTES_HASH サイズ: 136 バイト(x86)
dim st, 34    ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; SidCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SidAttr : SID_AND_ATTRIBUTES* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; Hash : UINT_PTR (+8, 128byte)  varptr(st)+8 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SID_AND_ATTRIBUTES_HASH サイズ: 272 バイト(x64)
dim st, 68    ; 4byte整数×68(構造体サイズ 272 / 4 切り上げ)
; SidCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SidAttr : SID_AND_ATTRIBUTES* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; Hash : UINT_PTR (+16, 256byte)  varptr(st)+16 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SID_AND_ATTRIBUTES_HASH
    #field int SidCount
    #field intptr SidAttr
    #field intptr Hash 32
#endstruct

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