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