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

GetAppContainerAce

関数
ACL内のAppContainer SID ACEを取得する。
DLLKERNEL32.dll呼出規約winapi

シグネチャ

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

BOOL GetAppContainerAce(
    ACL* Acl,
    DWORD StartingAceIndex,
    void** AppContainerAce,
    DWORD* AppContainerAceIndex   // optional
);

パラメーター

名前方向
AclACL*in
StartingAceIndexDWORDin
AppContainerAcevoid**out
AppContainerAceIndexDWORD*outoptional

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL GetAppContainerAce(
    ACL* Acl,
    DWORD StartingAceIndex,
    void** AppContainerAce,
    DWORD* AppContainerAceIndex   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool GetAppContainerAce(
    IntPtr Acl,   // ACL*
    uint StartingAceIndex,   // DWORD
    IntPtr AppContainerAce,   // void** out
    IntPtr AppContainerAceIndex   // DWORD* optional, out
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GetAppContainerAce(
    Acl As IntPtr,   ' ACL*
    StartingAceIndex As UInteger,   ' DWORD
    AppContainerAce As IntPtr,   ' void** out
    AppContainerAceIndex As IntPtr   ' DWORD* optional, out
) As Boolean
End Function
' Acl : ACL*
' StartingAceIndex : DWORD
' AppContainerAce : void** out
' AppContainerAceIndex : DWORD* optional, out
Declare PtrSafe Function GetAppContainerAce Lib "kernel32" ( _
    ByVal Acl As LongPtr, _
    ByVal StartingAceIndex As Long, _
    ByVal AppContainerAce As LongPtr, _
    ByVal AppContainerAceIndex As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetAppContainerAce = ctypes.windll.kernel32.GetAppContainerAce
GetAppContainerAce.restype = wintypes.BOOL
GetAppContainerAce.argtypes = [
    ctypes.c_void_p,  # Acl : ACL*
    wintypes.DWORD,  # StartingAceIndex : DWORD
    ctypes.c_void_p,  # AppContainerAce : void** out
    ctypes.POINTER(wintypes.DWORD),  # AppContainerAceIndex : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procGetAppContainerAce = kernel32.NewProc("GetAppContainerAce")
)

// Acl (ACL*), StartingAceIndex (DWORD), AppContainerAce (void** out), AppContainerAceIndex (DWORD* optional, out)
r1, _, err := procGetAppContainerAce.Call(
	uintptr(Acl),
	uintptr(StartingAceIndex),
	uintptr(AppContainerAce),
	uintptr(AppContainerAceIndex),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetAppContainerAce(
  Acl: Pointer;   // ACL*
  StartingAceIndex: DWORD;   // DWORD
  AppContainerAce: Pointer;   // void** out
  AppContainerAceIndex: Pointer   // DWORD* optional, out
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'GetAppContainerAce';
result := DllCall("KERNEL32\GetAppContainerAce"
    , "Ptr", Acl   ; ACL*
    , "UInt", StartingAceIndex   ; DWORD
    , "Ptr", AppContainerAce   ; void** out
    , "Ptr", AppContainerAceIndex   ; DWORD* optional, out
    , "Int")   ; return: BOOL
●GetAppContainerAce(Acl, StartingAceIndex, AppContainerAce, AppContainerAceIndex) = DLL("KERNEL32.dll", "bool GetAppContainerAce(void*, dword, void*, void*)")
# 呼び出し: GetAppContainerAce(Acl, StartingAceIndex, AppContainerAce, AppContainerAceIndex)
# Acl : ACL* -> "void*"
# StartingAceIndex : DWORD -> "dword"
# AppContainerAce : void** out -> "void*"
# AppContainerAceIndex : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。