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

SEC_OBJECT_ELEMENT

構造体
サイズx64: 48 バイト / x86: 40 バイトパッキング2

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

フィールド

フィールドサイズx64x86説明
guidObjectTypeGUID16+0+0セキュリティ対象オブジェクトの種類を示すGUID。
ObjectIDDBID32/24+16+16対象オブジェクトの識別子(DBID)。

各言語での定義

#include <windows.h>

// DBID  (x64 32 / x86 24 バイト)
typedef struct DBID {
    _uGuid_e__Union uGuid;
    DWORD eKind;
    _uName_e__Union uName;
} DBID;

// SEC_OBJECT_ELEMENT  (x64 48 / x86 40 バイト)
#pragma pack(push, 2)
typedef struct SEC_OBJECT_ELEMENT {
    GUID guidObjectType;
    DBID ObjectID;
} SEC_OBJECT_ELEMENT;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DBID
{
    public _uGuid_e__Union uGuid;
    public uint eKind;
    public _uName_e__Union uName;
}

[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct SEC_OBJECT_ELEMENT
{
    public Guid guidObjectType;
    public DBID ObjectID;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DBID
    Public uGuid As _uGuid_e__Union
    Public eKind As UInteger
    Public uName As _uName_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure SEC_OBJECT_ELEMENT
    Public guidObjectType As Guid
    Public ObjectID As DBID
End Structure
import ctypes
from ctypes import wintypes

class DBID(ctypes.Structure):
    _fields_ = [
        ("uGuid", _uGuid_e__Union),
        ("eKind", wintypes.DWORD),
        ("uName", _uName_e__Union),
    ]

class SEC_OBJECT_ELEMENT(ctypes.Structure):
    _pack_ = 2
    _fields_ = [
        ("guidObjectType", GUID),
        ("ObjectID", DBID),
    ]
#[repr(C)]
pub struct DBID {
    pub uGuid: _uGuid_e__Union,
    pub eKind: u32,
    pub uName: _uName_e__Union,
}

#[repr(C, packed(2))]
pub struct SEC_OBJECT_ELEMENT {
    pub guidObjectType: GUID,
    pub ObjectID: DBID,
}
import "golang.org/x/sys/windows"

type DBID struct {
	uGuid _uGuid_e__Union
	eKind uint32
	uName _uName_e__Union
}

type SEC_OBJECT_ELEMENT struct {
	guidObjectType windows.GUID
	ObjectID DBID
}
type
  DBID = record
    uGuid: _uGuid_e__Union;
    eKind: DWORD;
    uName: _uName_e__Union;
  end;

  SEC_OBJECT_ELEMENT = packed record
    guidObjectType: TGUID;
    ObjectID: DBID;
  end;
const DBID = extern struct {
    uGuid: _uGuid_e__Union,
    eKind: u32,
    uName: _uName_e__Union,
};

const SEC_OBJECT_ELEMENT = extern struct {
    guidObjectType: GUID,
    ObjectID: DBID,
};
type
  DBID {.bycopy.} = object
    uGuid: _uGuid_e__Union
    eKind: uint32
    uName: _uName_e__Union

  SEC_OBJECT_ELEMENT {.packed.} = object
    guidObjectType: GUID
    ObjectID: DBID
struct DBID
{
    _uGuid_e__Union uGuid;
    uint eKind;
    _uName_e__Union uName;
}

align(2)
struct SEC_OBJECT_ELEMENT
{
    GUID guidObjectType;
    DBID ObjectID;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SEC_OBJECT_ELEMENT サイズ: 40 バイト(x86)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; guidObjectType : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; ObjectID : DBID (+16, 24byte)  varptr(st)+16 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SEC_OBJECT_ELEMENT サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; guidObjectType : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; ObjectID : DBID (+16, 32byte)  varptr(st)+16 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global DBID
    #field byte uGuid 16
    #field int eKind
    #field byte uName 8
#endstruct

#defstruct global SEC_OBJECT_ELEMENT, pack=2
    #field GUID guidObjectType
    #field DBID ObjectID
#endstruct

stdim st, SEC_OBJECT_ELEMENT        ; NSTRUCT 変数を確保