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

GetPrivateObjectSecurity

関数
プライベートオブジェクトのセキュリティ情報を取得する。
DLLADVAPI32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// ADVAPI32.dll
#include <windows.h>

BOOL GetPrivateObjectSecurity(
    PSECURITY_DESCRIPTOR ObjectDescriptor,
    OBJECT_SECURITY_INFORMATION SecurityInformation,
    PSECURITY_DESCRIPTOR ResultantDescriptor,   // optional
    DWORD DescriptorLength,
    DWORD* ReturnLength
);

パラメーター

名前方向説明
ObjectDescriptorPSECURITY_DESCRIPTORinSECURITY_DESCRIPTOR 構造体へのポインターです。これが照会対象のセキュリティ記述子です。
SecurityInformationOBJECT_SECURITY_INFORMATIONin取得するセキュリティ記述子の部分を示すビットフラグの集合です。このパラメーターには、 SECURITY_INFORMATION ビットフラグの組み合わせを指定できます。
ResultantDescriptorPSECURITY_DESCRIPTORoutoptional指定したセキュリティ記述子から要求された情報のコピーを受け取るバッファーへのポインターです。 SECURITY_DESCRIPTOR 構造体は self-relative 形式で返されます。
DescriptorLengthDWORDinResultantDescriptor パラメーターが指すバッファーのサイズ(バイト単位)を指定します。
ReturnLengthDWORD*out記述子のコピーが成功した場合に、関数がゼロを設定する変数へのポインターです。バッファーがセキュリティ記述子に対して小さすぎる場合、この変数は必要なバイト数を受け取ります。関数が戻ったときにこの変数の値が DescriptorLength パラメーターの値より大きい場合、関数は FALSE を返し、セキュリティ記述子はバッファーにまったくコピーされません。

戻り値の型: BOOL

公式ドキュメント

プライベートオブジェクトのセキュリティ記述子から情報を取得します。

戻り値

関数が成功した場合、戻り値は 0 以外の値になります。

関数が失敗した場合、戻り値は 0 になります。拡張エラー情報を取得するには、 GetLastError を呼び出します。

解説(Remarks)

この関数はリソースマネージャーによる使用のみを想定しています。セキュリティ記述子を更新する際の標準的なアクセス制御セマンティクスを実装するには、リソースマネージャーは GetPrivateObjectSecurity を呼び出す前に、次の条件が満たされていることを確認する必要があります。

上記の条件が満たされていない場合でも、この関数の呼び出しは失敗しませんが、標準のアクセスポリシーは適用されません。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// ADVAPI32.dll
#include <windows.h>

BOOL GetPrivateObjectSecurity(
    PSECURITY_DESCRIPTOR ObjectDescriptor,
    OBJECT_SECURITY_INFORMATION SecurityInformation,
    PSECURITY_DESCRIPTOR ResultantDescriptor,   // optional
    DWORD DescriptorLength,
    DWORD* ReturnLength
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetPrivateObjectSecurity(
    IntPtr ObjectDescriptor,   // PSECURITY_DESCRIPTOR
    uint SecurityInformation,   // OBJECT_SECURITY_INFORMATION
    IntPtr ResultantDescriptor,   // PSECURITY_DESCRIPTOR optional, out
    uint DescriptorLength,   // DWORD
    out uint ReturnLength   // DWORD* out
);
<DllImport("ADVAPI32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetPrivateObjectSecurity(
    ObjectDescriptor As IntPtr,   ' PSECURITY_DESCRIPTOR
    SecurityInformation As UInteger,   ' OBJECT_SECURITY_INFORMATION
    ResultantDescriptor As IntPtr,   ' PSECURITY_DESCRIPTOR optional, out
    DescriptorLength As UInteger,   ' DWORD
    <Out> ByRef ReturnLength As UInteger   ' DWORD* out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' ObjectDescriptor : PSECURITY_DESCRIPTOR
' SecurityInformation : OBJECT_SECURITY_INFORMATION
' ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out
' DescriptorLength : DWORD
' ReturnLength : DWORD* out
Declare PtrSafe Function GetPrivateObjectSecurity Lib "advapi32" ( _
    ByVal ObjectDescriptor As LongPtr, _
    ByVal SecurityInformation As Long, _
    ByVal ResultantDescriptor As LongPtr, _
    ByVal DescriptorLength As Long, _
    ByRef ReturnLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetPrivateObjectSecurity = ctypes.windll.advapi32.GetPrivateObjectSecurity
GetPrivateObjectSecurity.restype = wintypes.BOOL
GetPrivateObjectSecurity.argtypes = [
    wintypes.HANDLE,  # ObjectDescriptor : PSECURITY_DESCRIPTOR
    wintypes.DWORD,  # SecurityInformation : OBJECT_SECURITY_INFORMATION
    wintypes.HANDLE,  # ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out
    wintypes.DWORD,  # DescriptorLength : DWORD
    ctypes.POINTER(wintypes.DWORD),  # ReturnLength : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
GetPrivateObjectSecurity = Fiddle::Function.new(
  lib['GetPrivateObjectSecurity'],
  [
    Fiddle::TYPE_VOIDP,  # ObjectDescriptor : PSECURITY_DESCRIPTOR
    -Fiddle::TYPE_INT,  # SecurityInformation : OBJECT_SECURITY_INFORMATION
    Fiddle::TYPE_VOIDP,  # ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out
    -Fiddle::TYPE_INT,  # DescriptorLength : DWORD
    Fiddle::TYPE_VOIDP,  # ReturnLength : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "advapi32")]
extern "system" {
    fn GetPrivateObjectSecurity(
        ObjectDescriptor: *mut core::ffi::c_void,  // PSECURITY_DESCRIPTOR
        SecurityInformation: u32,  // OBJECT_SECURITY_INFORMATION
        ResultantDescriptor: *mut core::ffi::c_void,  // PSECURITY_DESCRIPTOR optional, out
        DescriptorLength: u32,  // DWORD
        ReturnLength: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", SetLastError = true)]
public static extern bool GetPrivateObjectSecurity(IntPtr ObjectDescriptor, uint SecurityInformation, IntPtr ResultantDescriptor, uint DescriptorLength, out uint ReturnLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_GetPrivateObjectSecurity' -Namespace Win32 -PassThru
# $api::GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
#uselib "ADVAPI32.dll"
#func global GetPrivateObjectSecurity "GetPrivateObjectSecurity" sptr, sptr, sptr, sptr, sptr
; GetPrivateObjectSecurity ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, varptr(ReturnLength)   ; 戻り値は stat
; ObjectDescriptor : PSECURITY_DESCRIPTOR -> "sptr"
; SecurityInformation : OBJECT_SECURITY_INFORMATION -> "sptr"
; ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> "sptr"
; DescriptorLength : DWORD -> "sptr"
; ReturnLength : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ADVAPI32.dll"
#cfunc global GetPrivateObjectSecurity "GetPrivateObjectSecurity" sptr, int, sptr, int, var
; res = GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
; ObjectDescriptor : PSECURITY_DESCRIPTOR -> "sptr"
; SecurityInformation : OBJECT_SECURITY_INFORMATION -> "int"
; ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> "sptr"
; DescriptorLength : DWORD -> "int"
; ReturnLength : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor, OBJECT_SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ResultantDescriptor, DWORD DescriptorLength, DWORD* ReturnLength)
#uselib "ADVAPI32.dll"
#cfunc global GetPrivateObjectSecurity "GetPrivateObjectSecurity" intptr, int, intptr, int, var
; res = GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
; ObjectDescriptor : PSECURITY_DESCRIPTOR -> "intptr"
; SecurityInformation : OBJECT_SECURITY_INFORMATION -> "int"
; ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> "intptr"
; DescriptorLength : DWORD -> "int"
; ReturnLength : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procGetPrivateObjectSecurity = advapi32.NewProc("GetPrivateObjectSecurity")
)

// ObjectDescriptor (PSECURITY_DESCRIPTOR), SecurityInformation (OBJECT_SECURITY_INFORMATION), ResultantDescriptor (PSECURITY_DESCRIPTOR optional, out), DescriptorLength (DWORD), ReturnLength (DWORD* out)
r1, _, err := procGetPrivateObjectSecurity.Call(
	uintptr(ObjectDescriptor),
	uintptr(SecurityInformation),
	uintptr(ResultantDescriptor),
	uintptr(DescriptorLength),
	uintptr(ReturnLength),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetPrivateObjectSecurity(
  ObjectDescriptor: THandle;   // PSECURITY_DESCRIPTOR
  SecurityInformation: DWORD;   // OBJECT_SECURITY_INFORMATION
  ResultantDescriptor: THandle;   // PSECURITY_DESCRIPTOR optional, out
  DescriptorLength: DWORD;   // DWORD
  ReturnLength: Pointer   // DWORD* out
): BOOL; stdcall;
  external 'ADVAPI32.dll' name 'GetPrivateObjectSecurity';
result := DllCall("ADVAPI32\GetPrivateObjectSecurity"
    , "Ptr", ObjectDescriptor   ; PSECURITY_DESCRIPTOR
    , "UInt", SecurityInformation   ; OBJECT_SECURITY_INFORMATION
    , "Ptr", ResultantDescriptor   ; PSECURITY_DESCRIPTOR optional, out
    , "UInt", DescriptorLength   ; DWORD
    , "Ptr", ReturnLength   ; DWORD* out
    , "Int")   ; return: BOOL
●GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength) = DLL("ADVAPI32.dll", "bool GetPrivateObjectSecurity(void*, dword, void*, dword, void*)")
# 呼び出し: GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
# ObjectDescriptor : PSECURITY_DESCRIPTOR -> "void*"
# SecurityInformation : OBJECT_SECURITY_INFORMATION -> "dword"
# ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> "void*"
# DescriptorLength : DWORD -> "dword"
# ReturnLength : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "advapi32" fn GetPrivateObjectSecurity(
    ObjectDescriptor: ?*anyopaque, // PSECURITY_DESCRIPTOR
    SecurityInformation: u32, // OBJECT_SECURITY_INFORMATION
    ResultantDescriptor: ?*anyopaque, // PSECURITY_DESCRIPTOR optional, out
    DescriptorLength: u32, // DWORD
    ReturnLength: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) i32;
proc GetPrivateObjectSecurity(
    ObjectDescriptor: pointer,  # PSECURITY_DESCRIPTOR
    SecurityInformation: uint32,  # OBJECT_SECURITY_INFORMATION
    ResultantDescriptor: pointer,  # PSECURITY_DESCRIPTOR optional, out
    DescriptorLength: uint32,  # DWORD
    ReturnLength: ptr uint32  # DWORD* out
): int32 {.importc: "GetPrivateObjectSecurity", stdcall, dynlib: "ADVAPI32.dll".}
pragma(lib, "advapi32");
extern(Windows)
int GetPrivateObjectSecurity(
    void* ObjectDescriptor,   // PSECURITY_DESCRIPTOR
    uint SecurityInformation,   // OBJECT_SECURITY_INFORMATION
    void* ResultantDescriptor,   // PSECURITY_DESCRIPTOR optional, out
    uint DescriptorLength,   // DWORD
    uint* ReturnLength   // DWORD* out
);
ccall((:GetPrivateObjectSecurity, "ADVAPI32.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{UInt32}),
      ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
# ObjectDescriptor : PSECURITY_DESCRIPTOR -> Ptr{Cvoid}
# SecurityInformation : OBJECT_SECURITY_INFORMATION -> UInt32
# ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> Ptr{Cvoid}
# DescriptorLength : DWORD -> UInt32
# ReturnLength : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GetPrivateObjectSecurity(
    void* ObjectDescriptor,
    uint32_t SecurityInformation,
    void* ResultantDescriptor,
    uint32_t DescriptorLength,
    uint32_t* ReturnLength);
]]
local advapi32 = ffi.load("advapi32")
-- advapi32.GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
-- ObjectDescriptor : PSECURITY_DESCRIPTOR
-- SecurityInformation : OBJECT_SECURITY_INFORMATION
-- ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out
-- DescriptorLength : DWORD
-- ReturnLength : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ADVAPI32.dll');
const GetPrivateObjectSecurity = lib.func('__stdcall', 'GetPrivateObjectSecurity', 'int32_t', ['void *', 'uint32_t', 'void *', 'uint32_t', 'uint32_t *']);
// GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
// ObjectDescriptor : PSECURITY_DESCRIPTOR -> 'void *'
// SecurityInformation : OBJECT_SECURITY_INFORMATION -> 'uint32_t'
// ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> 'void *'
// DescriptorLength : DWORD -> 'uint32_t'
// ReturnLength : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ADVAPI32.dll", {
  GetPrivateObjectSecurity: { parameters: ["pointer", "u32", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength)
// ObjectDescriptor : PSECURITY_DESCRIPTOR -> "pointer"
// SecurityInformation : OBJECT_SECURITY_INFORMATION -> "u32"
// ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> "pointer"
// DescriptorLength : DWORD -> "u32"
// ReturnLength : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GetPrivateObjectSecurity(
    void* ObjectDescriptor,
    uint32_t SecurityInformation,
    void* ResultantDescriptor,
    uint32_t DescriptorLength,
    uint32_t* ReturnLength);
C, "ADVAPI32.dll");
// $ffi->GetPrivateObjectSecurity(ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength);
// ObjectDescriptor : PSECURITY_DESCRIPTOR
// SecurityInformation : OBJECT_SECURITY_INFORMATION
// ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out
// DescriptorLength : DWORD
// ReturnLength : DWORD* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Advapi32 extends StdCallLibrary {
    Advapi32 INSTANCE = Native.load("advapi32", Advapi32.class);
    boolean GetPrivateObjectSecurity(
        Pointer ObjectDescriptor,   // PSECURITY_DESCRIPTOR
        int SecurityInformation,   // OBJECT_SECURITY_INFORMATION
        Pointer ResultantDescriptor,   // PSECURITY_DESCRIPTOR optional, out
        int DescriptorLength,   // DWORD
        IntByReference ReturnLength   // DWORD* out
    );
}
@[Link("advapi32")]
lib LibADVAPI32
  fun GetPrivateObjectSecurity = GetPrivateObjectSecurity(
    ObjectDescriptor : Void*,   # PSECURITY_DESCRIPTOR
    SecurityInformation : UInt32,   # OBJECT_SECURITY_INFORMATION
    ResultantDescriptor : Void*,   # PSECURITY_DESCRIPTOR optional, out
    DescriptorLength : UInt32,   # DWORD
    ReturnLength : UInt32*   # DWORD* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GetPrivateObjectSecurityNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef GetPrivateObjectSecurityDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Uint32>);
final GetPrivateObjectSecurity = DynamicLibrary.open('ADVAPI32.dll')
    .lookupFunction<GetPrivateObjectSecurityNative, GetPrivateObjectSecurityDart>('GetPrivateObjectSecurity');
// ObjectDescriptor : PSECURITY_DESCRIPTOR -> Pointer<Void>
// SecurityInformation : OBJECT_SECURITY_INFORMATION -> Uint32
// ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> Pointer<Void>
// DescriptorLength : DWORD -> Uint32
// ReturnLength : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GetPrivateObjectSecurity(
  ObjectDescriptor: THandle;   // PSECURITY_DESCRIPTOR
  SecurityInformation: DWORD;   // OBJECT_SECURITY_INFORMATION
  ResultantDescriptor: THandle;   // PSECURITY_DESCRIPTOR optional, out
  DescriptorLength: DWORD;   // DWORD
  ReturnLength: Pointer   // DWORD* out
): BOOL; stdcall;
  external 'ADVAPI32.dll' name 'GetPrivateObjectSecurity';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetPrivateObjectSecurity"
  c_GetPrivateObjectSecurity :: Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr Word32 -> IO CInt
-- ObjectDescriptor : PSECURITY_DESCRIPTOR -> Ptr ()
-- SecurityInformation : OBJECT_SECURITY_INFORMATION -> Word32
-- ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> Ptr ()
-- DescriptorLength : DWORD -> Word32
-- ReturnLength : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getprivateobjectsecurity =
  foreign "GetPrivateObjectSecurity"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* ObjectDescriptor : PSECURITY_DESCRIPTOR -> (ptr void) *)
(* SecurityInformation : OBJECT_SECURITY_INFORMATION -> uint32_t *)
(* ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> (ptr void) *)
(* DescriptorLength : DWORD -> uint32_t *)
(* ReturnLength : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library advapi32 (t "ADVAPI32.dll"))
(cffi:use-foreign-library advapi32)

(cffi:defcfun ("GetPrivateObjectSecurity" get-private-object-security :convention :stdcall) :int32
  (object-descriptor :pointer)   ; PSECURITY_DESCRIPTOR
  (security-information :uint32)   ; OBJECT_SECURITY_INFORMATION
  (resultant-descriptor :pointer)   ; PSECURITY_DESCRIPTOR optional, out
  (descriptor-length :uint32)   ; DWORD
  (return-length :pointer))   ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetPrivateObjectSecurity = Win32::API::More->new('ADVAPI32',
    'BOOL GetPrivateObjectSecurity(HANDLE ObjectDescriptor, DWORD SecurityInformation, HANDLE ResultantDescriptor, DWORD DescriptorLength, LPVOID ReturnLength)');
# my $ret = $GetPrivateObjectSecurity->Call($ObjectDescriptor, $SecurityInformation, $ResultantDescriptor, $DescriptorLength, $ReturnLength);
# ObjectDescriptor : PSECURITY_DESCRIPTOR -> HANDLE
# SecurityInformation : OBJECT_SECURITY_INFORMATION -> DWORD
# ResultantDescriptor : PSECURITY_DESCRIPTOR optional, out -> HANDLE
# DescriptorLength : DWORD -> DWORD
# ReturnLength : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型