Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › LSA_OBJECT_ATTRIBUTES

LSA_OBJECT_ATTRIBUTES

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

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

フィールド

フィールドサイズx64x86説明
LengthDWORD4+0+0LSA_OBJECT_ATTRIBUTES 構造体のサイズをバイト単位で指定します。
RootDirectoryHANDLE8/4+8+4NULL にしてください。
ObjectNameLSA_UNICODE_STRING*8/4+16+8NULL にしてください。
AttributesDWORD4+24+120 にしてください。
SecurityDescriptorvoid*8/4+32+16NULL にしてください。
SecurityQualityOfServicevoid*8/4+40+20NULL にしてください。

公式ドキュメント

LSA_OBJECT_ATTRIBUTES 構造体は、 LsaOpenPolicy 関数と共に使用して、Policy オブジェクトへの接続の属性を指定します。

LsaOpenPolicy を呼び出すときは、関数がその情報を使用しないため、この構造体のメンバーを NULL または 0 に初期化してください。

解説(Remarks)

LSA_OBJECT_ATTRIBUTES 構造体は、LsaLookup.h ヘッダーファイルで定義されています。

Windows Server 2008 with SP2 以前、Windows Vista with SP2 以前、Windows Server 2003、Windows XP/2000: LSA_OBJECT_ATTRIBUTES 構造体は、NTSecAPI.h ヘッダーファイルで定義されています。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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 Structure
import 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: pointer
struct 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