GetAclInformation
関数ACLの情報(サイズや改訂など)を取得する。
シグネチャ
// ADVAPI32.dll
#include <windows.h>
BOOL GetAclInformation(
ACL* pAcl,
void* pAclInformation,
DWORD nAclInformationLength,
ACL_INFORMATION_CLASS dwAclInformationClass
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pAcl | ACL* | in |
| pAclInformation | void* | out |
| nAclInformationLength | DWORD | in |
| dwAclInformationClass | ACL_INFORMATION_CLASS | in |
戻り値の型: BOOL
各言語での呼び出し定義
// ADVAPI32.dll
#include <windows.h>
BOOL GetAclInformation(
ACL* pAcl,
void* pAclInformation,
DWORD nAclInformationLength,
ACL_INFORMATION_CLASS dwAclInformationClass
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ADVAPI32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetAclInformation(
IntPtr pAcl, // ACL*
IntPtr pAclInformation, // void* out
uint nAclInformationLength, // DWORD
int dwAclInformationClass // ACL_INFORMATION_CLASS
);<DllImport("ADVAPI32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetAclInformation(
pAcl As IntPtr, ' ACL*
pAclInformation As IntPtr, ' void* out
nAclInformationLength As UInteger, ' DWORD
dwAclInformationClass As Integer ' ACL_INFORMATION_CLASS
) As Boolean
End Function' pAcl : ACL*
' pAclInformation : void* out
' nAclInformationLength : DWORD
' dwAclInformationClass : ACL_INFORMATION_CLASS
Declare PtrSafe Function GetAclInformation Lib "advapi32" ( _
ByVal pAcl As LongPtr, _
ByVal pAclInformation As LongPtr, _
ByVal nAclInformationLength As Long, _
ByVal dwAclInformationClass As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetAclInformation = ctypes.windll.advapi32.GetAclInformation
GetAclInformation.restype = wintypes.BOOL
GetAclInformation.argtypes = [
ctypes.c_void_p, # pAcl : ACL*
ctypes.POINTER(None), # pAclInformation : void* out
wintypes.DWORD, # nAclInformationLength : DWORD
ctypes.c_int, # dwAclInformationClass : ACL_INFORMATION_CLASS
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
GetAclInformation = Fiddle::Function.new(
lib['GetAclInformation'],
[
Fiddle::TYPE_VOIDP, # pAcl : ACL*
Fiddle::TYPE_VOIDP, # pAclInformation : void* out
-Fiddle::TYPE_INT, # nAclInformationLength : DWORD
Fiddle::TYPE_INT, # dwAclInformationClass : ACL_INFORMATION_CLASS
],
Fiddle::TYPE_INT)#[link(name = "advapi32")]
extern "system" {
fn GetAclInformation(
pAcl: *mut ACL, // ACL*
pAclInformation: *mut (), // void* out
nAclInformationLength: u32, // DWORD
dwAclInformationClass: i32 // ACL_INFORMATION_CLASS
) -> 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 GetAclInformation(IntPtr pAcl, IntPtr pAclInformation, uint nAclInformationLength, int dwAclInformationClass);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_GetAclInformation' -Namespace Win32 -PassThru
# $api::GetAclInformation(pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass)#uselib "ADVAPI32.dll"
#func global GetAclInformation "GetAclInformation" sptr, sptr, sptr, sptr
; GetAclInformation varptr(pAcl), pAclInformation, nAclInformationLength, dwAclInformationClass ; 戻り値は stat
; pAcl : ACL* -> "sptr"
; pAclInformation : void* out -> "sptr"
; nAclInformationLength : DWORD -> "sptr"
; dwAclInformationClass : ACL_INFORMATION_CLASS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ADVAPI32.dll" #cfunc global GetAclInformation "GetAclInformation" var, sptr, int, int ; res = GetAclInformation(pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass) ; pAcl : ACL* -> "var" ; pAclInformation : void* out -> "sptr" ; nAclInformationLength : DWORD -> "int" ; dwAclInformationClass : ACL_INFORMATION_CLASS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ADVAPI32.dll" #cfunc global GetAclInformation "GetAclInformation" sptr, sptr, int, int ; res = GetAclInformation(varptr(pAcl), pAclInformation, nAclInformationLength, dwAclInformationClass) ; pAcl : ACL* -> "sptr" ; pAclInformation : void* out -> "sptr" ; nAclInformationLength : DWORD -> "int" ; dwAclInformationClass : ACL_INFORMATION_CLASS -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetAclInformation(ACL* pAcl, void* pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass) #uselib "ADVAPI32.dll" #cfunc global GetAclInformation "GetAclInformation" var, intptr, int, int ; res = GetAclInformation(pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass) ; pAcl : ACL* -> "var" ; pAclInformation : void* out -> "intptr" ; nAclInformationLength : DWORD -> "int" ; dwAclInformationClass : ACL_INFORMATION_CLASS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetAclInformation(ACL* pAcl, void* pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass) #uselib "ADVAPI32.dll" #cfunc global GetAclInformation "GetAclInformation" intptr, intptr, int, int ; res = GetAclInformation(varptr(pAcl), pAclInformation, nAclInformationLength, dwAclInformationClass) ; pAcl : ACL* -> "intptr" ; pAclInformation : void* out -> "intptr" ; nAclInformationLength : DWORD -> "int" ; dwAclInformationClass : ACL_INFORMATION_CLASS -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procGetAclInformation = advapi32.NewProc("GetAclInformation")
)
// pAcl (ACL*), pAclInformation (void* out), nAclInformationLength (DWORD), dwAclInformationClass (ACL_INFORMATION_CLASS)
r1, _, err := procGetAclInformation.Call(
uintptr(pAcl),
uintptr(pAclInformation),
uintptr(nAclInformationLength),
uintptr(dwAclInformationClass),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetAclInformation(
pAcl: Pointer; // ACL*
pAclInformation: Pointer; // void* out
nAclInformationLength: DWORD; // DWORD
dwAclInformationClass: Integer // ACL_INFORMATION_CLASS
): BOOL; stdcall;
external 'ADVAPI32.dll' name 'GetAclInformation';result := DllCall("ADVAPI32\GetAclInformation"
, "Ptr", pAcl ; ACL*
, "Ptr", pAclInformation ; void* out
, "UInt", nAclInformationLength ; DWORD
, "Int", dwAclInformationClass ; ACL_INFORMATION_CLASS
, "Int") ; return: BOOL●GetAclInformation(pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass) = DLL("ADVAPI32.dll", "bool GetAclInformation(void*, void*, dword, int)")
# 呼び出し: GetAclInformation(pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass)
# pAcl : ACL* -> "void*"
# pAclInformation : void* out -> "void*"
# nAclInformationLength : DWORD -> "dword"
# dwAclInformationClass : ACL_INFORMATION_CLASS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。