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