ホーム › Security.Authentication.Identity › LSA_OBJECT_ATTRIBUTES
LSA_OBJECT_ATTRIBUTES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| RootDirectory | HANDLE | 8/4 | +8 | +4 | 予約。LSAでは使用されずNULLとする。 |
| ObjectName | LSA_UNICODE_STRING* | 8/4 | +16 | +8 | オブジェクト名を指すLSA_UNICODE_STRINGへのポインタ。予約でNULL可。 |
| Attributes | DWORD | 4 | +24 | +12 | オブジェクト属性フラグ。予約として0を指定する。 |
| SecurityDescriptor | void* | 8/4 | +32 | +16 | オブジェクトのセキュリティ記述子へのポインタ。NULL可。 |
| SecurityQualityOfService | void* | 8/4 | +40 | +20 | セキュリティ品質情報へのポインタ。NULL可。 |
各言語での定義
#include <windows.h>
// LSA_OBJECT_ATTRIBUTES (x64 48 / x86 24 バイト)
typedef struct LSA_OBJECT_ATTRIBUTES {
DWORD Length;
HANDLE RootDirectory;
LSA_UNICODE_STRING* ObjectName;
DWORD Attributes;
void* SecurityDescriptor;
void* SecurityQualityOfService;
} LSA_OBJECT_ATTRIBUTES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LSA_OBJECT_ATTRIBUTES
{
public uint Length;
public IntPtr RootDirectory;
public IntPtr ObjectName;
public uint Attributes;
public IntPtr SecurityDescriptor;
public IntPtr SecurityQualityOfService;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LSA_OBJECT_ATTRIBUTES
Public Length As UInteger
Public RootDirectory As IntPtr
Public ObjectName As IntPtr
Public Attributes As UInteger
Public SecurityDescriptor As IntPtr
Public SecurityQualityOfService As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class LSA_OBJECT_ATTRIBUTES(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("RootDirectory", ctypes.c_void_p),
("ObjectName", ctypes.c_void_p),
("Attributes", wintypes.DWORD),
("SecurityDescriptor", ctypes.c_void_p),
("SecurityQualityOfService", ctypes.c_void_p),
]#[repr(C)]
pub struct LSA_OBJECT_ATTRIBUTES {
pub Length: u32,
pub RootDirectory: *mut core::ffi::c_void,
pub ObjectName: *mut core::ffi::c_void,
pub Attributes: u32,
pub SecurityDescriptor: *mut core::ffi::c_void,
pub SecurityQualityOfService: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type LSA_OBJECT_ATTRIBUTES struct {
Length uint32
RootDirectory uintptr
ObjectName uintptr
Attributes uint32
SecurityDescriptor uintptr
SecurityQualityOfService uintptr
}type
LSA_OBJECT_ATTRIBUTES = record
Length: DWORD;
RootDirectory: Pointer;
ObjectName: Pointer;
Attributes: DWORD;
SecurityDescriptor: Pointer;
SecurityQualityOfService: Pointer;
end;const LSA_OBJECT_ATTRIBUTES = extern struct {
Length: u32,
RootDirectory: ?*anyopaque,
ObjectName: ?*anyopaque,
Attributes: u32,
SecurityDescriptor: ?*anyopaque,
SecurityQualityOfService: ?*anyopaque,
};type
LSA_OBJECT_ATTRIBUTES {.bycopy.} = object
Length: uint32
RootDirectory: pointer
ObjectName: pointer
Attributes: uint32
SecurityDescriptor: pointer
SecurityQualityOfService: pointerstruct LSA_OBJECT_ATTRIBUTES
{
uint Length;
void* RootDirectory;
void* ObjectName;
uint Attributes;
void* SecurityDescriptor;
void* SecurityQualityOfService;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; LSA_OBJECT_ATTRIBUTES サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; RootDirectory : HANDLE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ObjectName : LSA_UNICODE_STRING* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; Attributes : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; SecurityDescriptor : void* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; SecurityQualityOfService : void* (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LSA_OBJECT_ATTRIBUTES サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; RootDirectory : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ObjectName : LSA_UNICODE_STRING* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; Attributes : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; SecurityDescriptor : void* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; SecurityQualityOfService : void* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LSA_OBJECT_ATTRIBUTES
#field int Length
#field intptr RootDirectory
#field intptr ObjectName
#field int Attributes
#field intptr SecurityDescriptor
#field intptr SecurityQualityOfService
#endstruct
stdim st, LSA_OBJECT_ATTRIBUTES ; NSTRUCT 変数を確保
st->Length = 100
mes "Length=" + st->Length