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