Win32 API 日本語リファレンス
ホームNetworkManagement.WindowsFilteringPlatform › IPsecKeyManagerGetSecurityInfoByKey0

IPsecKeyManagerGetSecurityInfoByKey0

関数
IPsecキーマネージャーのセキュリティ情報を取得する。
DLLfwpuclnt.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD IPsecKeyManagerGetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,
    const void* reserved,   // optional
    DWORD securityInfo,
    PSID* sidOwner,
    PSID* sidGroup,
    ACL** dacl,
    ACL** sacl,
    PSECURITY_DESCRIPTOR* securityDescriptor
);

パラメーター

名前方向説明
engineHandleFWPM_ENGINE_HANDLEinフィルタリングエンジンへのセッションハンドル。
reservedvoid*optional将来の使用のために予約。NULLを指定する。
securityInfoDWORDin取得するセキュリティ情報の種別を示すSECURITY_INFORMATIONビットフラグ。
sidOwnerPSID*out所有者SIDを受け取るポインタ。不要ならNULL可。
sidGroupPSID*outプライマリグループSIDを受け取るポインタ。不要ならNULL可。
daclACL**outDACLを受け取るポインタ。不要ならNULL可。
saclACL**outSACLを受け取るポインタ。不要ならNULL可。
securityDescriptorPSECURITY_DESCRIPTOR*outキーマネージャ用の自己相対セキュリティ記述子を受け取る出力。FwpmFreeMemory0で解放する。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD IPsecKeyManagerGetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,
    const void* reserved,   // optional
    DWORD securityInfo,
    PSID* sidOwner,
    PSID* sidGroup,
    ACL** dacl,
    ACL** sacl,
    PSECURITY_DESCRIPTOR* securityDescriptor
);
[DllImport("fwpuclnt.dll", ExactSpelling = true)]
static extern uint IPsecKeyManagerGetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,   // FWPM_ENGINE_HANDLE
    IntPtr reserved,   // void* optional
    uint securityInfo,   // DWORD
    IntPtr sidOwner,   // PSID* out
    IntPtr sidGroup,   // PSID* out
    IntPtr dacl,   // ACL** out
    IntPtr sacl,   // ACL** out
    IntPtr securityDescriptor   // PSECURITY_DESCRIPTOR* out
);
<DllImport("fwpuclnt.dll", ExactSpelling:=True)>
Public Shared Function IPsecKeyManagerGetSecurityInfoByKey0(
    engineHandle As FWPM_ENGINE_HANDLE,   ' FWPM_ENGINE_HANDLE
    reserved As IntPtr,   ' void* optional
    securityInfo As UInteger,   ' DWORD
    sidOwner As IntPtr,   ' PSID* out
    sidGroup As IntPtr,   ' PSID* out
    dacl As IntPtr,   ' ACL** out
    sacl As IntPtr,   ' ACL** out
    securityDescriptor As IntPtr   ' PSECURITY_DESCRIPTOR* out
) As UInteger
End Function
' engineHandle : FWPM_ENGINE_HANDLE
' reserved : void* optional
' securityInfo : DWORD
' sidOwner : PSID* out
' sidGroup : PSID* out
' dacl : ACL** out
' sacl : ACL** out
' securityDescriptor : PSECURITY_DESCRIPTOR* out
Declare PtrSafe Function IPsecKeyManagerGetSecurityInfoByKey0 Lib "fwpuclnt" ( _
    ByVal engineHandle As LongPtr, _
    ByVal reserved As LongPtr, _
    ByVal securityInfo As Long, _
    ByVal sidOwner As LongPtr, _
    ByVal sidGroup As LongPtr, _
    ByVal dacl As LongPtr, _
    ByVal sacl As LongPtr, _
    ByVal securityDescriptor As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IPsecKeyManagerGetSecurityInfoByKey0 = ctypes.windll.fwpuclnt.IPsecKeyManagerGetSecurityInfoByKey0
IPsecKeyManagerGetSecurityInfoByKey0.restype = wintypes.DWORD
IPsecKeyManagerGetSecurityInfoByKey0.argtypes = [
    FWPM_ENGINE_HANDLE,  # engineHandle : FWPM_ENGINE_HANDLE
    ctypes.POINTER(None),  # reserved : void* optional
    wintypes.DWORD,  # securityInfo : DWORD
    ctypes.c_void_p,  # sidOwner : PSID* out
    ctypes.c_void_p,  # sidGroup : PSID* out
    ctypes.c_void_p,  # dacl : ACL** out
    ctypes.c_void_p,  # sacl : ACL** out
    ctypes.c_void_p,  # securityDescriptor : PSECURITY_DESCRIPTOR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('fwpuclnt.dll')
IPsecKeyManagerGetSecurityInfoByKey0 = Fiddle::Function.new(
  lib['IPsecKeyManagerGetSecurityInfoByKey0'],
  [
    Fiddle::TYPE_VOIDP,  # engineHandle : FWPM_ENGINE_HANDLE
    Fiddle::TYPE_VOIDP,  # reserved : void* optional
    -Fiddle::TYPE_INT,  # securityInfo : DWORD
    Fiddle::TYPE_VOIDP,  # sidOwner : PSID* out
    Fiddle::TYPE_VOIDP,  # sidGroup : PSID* out
    Fiddle::TYPE_VOIDP,  # dacl : ACL** out
    Fiddle::TYPE_VOIDP,  # sacl : ACL** out
    Fiddle::TYPE_VOIDP,  # securityDescriptor : PSECURITY_DESCRIPTOR* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "fwpuclnt")]
extern "system" {
    fn IPsecKeyManagerGetSecurityInfoByKey0(
        engineHandle: FWPM_ENGINE_HANDLE,  // FWPM_ENGINE_HANDLE
        reserved: *const (),  // void* optional
        securityInfo: u32,  // DWORD
        sidOwner: *mut *mut core::ffi::c_void,  // PSID* out
        sidGroup: *mut *mut core::ffi::c_void,  // PSID* out
        dacl: *mut *mut ACL,  // ACL** out
        sacl: *mut *mut ACL,  // ACL** out
        securityDescriptor: *mut *mut core::ffi::c_void  // PSECURITY_DESCRIPTOR* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("fwpuclnt.dll")]
public static extern uint IPsecKeyManagerGetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, IntPtr reserved, uint securityInfo, IntPtr sidOwner, IntPtr sidGroup, IntPtr dacl, IntPtr sacl, IntPtr securityDescriptor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fwpuclnt_IPsecKeyManagerGetSecurityInfoByKey0' -Namespace Win32 -PassThru
# $api::IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
#uselib "fwpuclnt.dll"
#func global IPsecKeyManagerGetSecurityInfoByKey0 "IPsecKeyManagerGetSecurityInfoByKey0" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; IPsecKeyManagerGetSecurityInfoByKey0 engineHandle, reserved, securityInfo, sidOwner, sidGroup, varptr(dacl), varptr(sacl), securityDescriptor   ; 戻り値は stat
; engineHandle : FWPM_ENGINE_HANDLE -> "sptr"
; reserved : void* optional -> "sptr"
; securityInfo : DWORD -> "sptr"
; sidOwner : PSID* out -> "sptr"
; sidGroup : PSID* out -> "sptr"
; dacl : ACL** out -> "sptr"
; sacl : ACL** out -> "sptr"
; securityDescriptor : PSECURITY_DESCRIPTOR* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "fwpuclnt.dll"
#cfunc global IPsecKeyManagerGetSecurityInfoByKey0 "IPsecKeyManagerGetSecurityInfoByKey0" int, sptr, int, sptr, sptr, var, var, sptr
; res = IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
; engineHandle : FWPM_ENGINE_HANDLE -> "int"
; reserved : void* optional -> "sptr"
; securityInfo : DWORD -> "int"
; sidOwner : PSID* out -> "sptr"
; sidGroup : PSID* out -> "sptr"
; dacl : ACL** out -> "var"
; sacl : ACL** out -> "var"
; securityDescriptor : PSECURITY_DESCRIPTOR* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD IPsecKeyManagerGetSecurityInfoByKey0(FWPM_ENGINE_HANDLE engineHandle, void* reserved, DWORD securityInfo, PSID* sidOwner, PSID* sidGroup, ACL** dacl, ACL** sacl, PSECURITY_DESCRIPTOR* securityDescriptor)
#uselib "fwpuclnt.dll"
#cfunc global IPsecKeyManagerGetSecurityInfoByKey0 "IPsecKeyManagerGetSecurityInfoByKey0" int, intptr, int, intptr, intptr, var, var, intptr
; res = IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
; engineHandle : FWPM_ENGINE_HANDLE -> "int"
; reserved : void* optional -> "intptr"
; securityInfo : DWORD -> "int"
; sidOwner : PSID* out -> "intptr"
; sidGroup : PSID* out -> "intptr"
; dacl : ACL** out -> "var"
; sacl : ACL** out -> "var"
; securityDescriptor : PSECURITY_DESCRIPTOR* out -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	fwpuclnt = windows.NewLazySystemDLL("fwpuclnt.dll")
	procIPsecKeyManagerGetSecurityInfoByKey0 = fwpuclnt.NewProc("IPsecKeyManagerGetSecurityInfoByKey0")
)

// engineHandle (FWPM_ENGINE_HANDLE), reserved (void* optional), securityInfo (DWORD), sidOwner (PSID* out), sidGroup (PSID* out), dacl (ACL** out), sacl (ACL** out), securityDescriptor (PSECURITY_DESCRIPTOR* out)
r1, _, err := procIPsecKeyManagerGetSecurityInfoByKey0.Call(
	uintptr(engineHandle),
	uintptr(reserved),
	uintptr(securityInfo),
	uintptr(sidOwner),
	uintptr(sidGroup),
	uintptr(dacl),
	uintptr(sacl),
	uintptr(securityDescriptor),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function IPsecKeyManagerGetSecurityInfoByKey0(
  engineHandle: FWPM_ENGINE_HANDLE;   // FWPM_ENGINE_HANDLE
  reserved: Pointer;   // void* optional
  securityInfo: DWORD;   // DWORD
  sidOwner: Pointer;   // PSID* out
  sidGroup: Pointer;   // PSID* out
  dacl: Pointer;   // ACL** out
  sacl: Pointer;   // ACL** out
  securityDescriptor: Pointer   // PSECURITY_DESCRIPTOR* out
): DWORD; stdcall;
  external 'fwpuclnt.dll' name 'IPsecKeyManagerGetSecurityInfoByKey0';
result := DllCall("fwpuclnt\IPsecKeyManagerGetSecurityInfoByKey0"
    , "Ptr", engineHandle   ; FWPM_ENGINE_HANDLE
    , "Ptr", reserved   ; void* optional
    , "UInt", securityInfo   ; DWORD
    , "Ptr", sidOwner   ; PSID* out
    , "Ptr", sidGroup   ; PSID* out
    , "Ptr", dacl   ; ACL** out
    , "Ptr", sacl   ; ACL** out
    , "Ptr", securityDescriptor   ; PSECURITY_DESCRIPTOR* out
    , "UInt")   ; return: DWORD
●IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor) = DLL("fwpuclnt.dll", "dword IPsecKeyManagerGetSecurityInfoByKey0(void*, void*, dword, void*, void*, void*, void*, void*)")
# 呼び出し: IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
# engineHandle : FWPM_ENGINE_HANDLE -> "void*"
# reserved : void* optional -> "void*"
# securityInfo : DWORD -> "dword"
# sidOwner : PSID* out -> "void*"
# sidGroup : PSID* out -> "void*"
# dacl : ACL** out -> "void*"
# sacl : ACL** out -> "void*"
# securityDescriptor : PSECURITY_DESCRIPTOR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "fwpuclnt" fn IPsecKeyManagerGetSecurityInfoByKey0(
    engineHandle: FWPM_ENGINE_HANDLE, // FWPM_ENGINE_HANDLE
    reserved: ?*anyopaque, // void* optional
    securityInfo: u32, // DWORD
    sidOwner: ?*anyopaque, // PSID* out
    sidGroup: ?*anyopaque, // PSID* out
    dacl: [*c][*c]ACL, // ACL** out
    sacl: [*c][*c]ACL, // ACL** out
    securityDescriptor: ?*anyopaque // PSECURITY_DESCRIPTOR* out
) callconv(std.os.windows.WINAPI) u32;
proc IPsecKeyManagerGetSecurityInfoByKey0(
    engineHandle: FWPM_ENGINE_HANDLE,  # FWPM_ENGINE_HANDLE
    reserved: pointer,  # void* optional
    securityInfo: uint32,  # DWORD
    sidOwner: pointer,  # PSID* out
    sidGroup: pointer,  # PSID* out
    dacl: ptr ACL,  # ACL** out
    sacl: ptr ACL,  # ACL** out
    securityDescriptor: pointer  # PSECURITY_DESCRIPTOR* out
): uint32 {.importc: "IPsecKeyManagerGetSecurityInfoByKey0", stdcall, dynlib: "fwpuclnt.dll".}
pragma(lib, "fwpuclnt");
extern(Windows)
uint IPsecKeyManagerGetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,   // FWPM_ENGINE_HANDLE
    void* reserved,   // void* optional
    uint securityInfo,   // DWORD
    void* sidOwner,   // PSID* out
    void* sidGroup,   // PSID* out
    ACL** dacl,   // ACL** out
    ACL** sacl,   // ACL** out
    void* securityDescriptor   // PSECURITY_DESCRIPTOR* out
);
ccall((:IPsecKeyManagerGetSecurityInfoByKey0, "fwpuclnt.dll"), stdcall, UInt32,
      (FWPM_ENGINE_HANDLE, Ptr{Cvoid}, UInt32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{ACL}, Ptr{ACL}, Ptr{Cvoid}),
      engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
# engineHandle : FWPM_ENGINE_HANDLE -> FWPM_ENGINE_HANDLE
# reserved : void* optional -> Ptr{Cvoid}
# securityInfo : DWORD -> UInt32
# sidOwner : PSID* out -> Ptr{Cvoid}
# sidGroup : PSID* out -> Ptr{Cvoid}
# dacl : ACL** out -> Ptr{ACL}
# sacl : ACL** out -> Ptr{ACL}
# securityDescriptor : PSECURITY_DESCRIPTOR* out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t IPsecKeyManagerGetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,
    void* reserved,
    uint32_t securityInfo,
    void* sidOwner,
    void* sidGroup,
    void* dacl,
    void* sacl,
    void* securityDescriptor);
]]
local fwpuclnt = ffi.load("fwpuclnt")
-- fwpuclnt.IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
-- engineHandle : FWPM_ENGINE_HANDLE
-- reserved : void* optional
-- securityInfo : DWORD
-- sidOwner : PSID* out
-- sidGroup : PSID* out
-- dacl : ACL** out
-- sacl : ACL** out
-- securityDescriptor : PSECURITY_DESCRIPTOR* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('fwpuclnt.dll');
const IPsecKeyManagerGetSecurityInfoByKey0 = lib.func('__stdcall', 'IPsecKeyManagerGetSecurityInfoByKey0', 'uint32_t', ['FWPM_ENGINE_HANDLE', 'void *', 'uint32_t', 'void *', 'void *', 'void *', 'void *', 'void *']);
// IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
// engineHandle : FWPM_ENGINE_HANDLE -> 'FWPM_ENGINE_HANDLE'
// reserved : void* optional -> 'void *'
// securityInfo : DWORD -> 'uint32_t'
// sidOwner : PSID* out -> 'void *'
// sidGroup : PSID* out -> 'void *'
// dacl : ACL** out -> 'void *'
// sacl : ACL** out -> 'void *'
// securityDescriptor : PSECURITY_DESCRIPTOR* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("fwpuclnt.dll", {
  IPsecKeyManagerGetSecurityInfoByKey0: { parameters: ["buffer", "pointer", "u32", "pointer", "pointer", "pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor)
// engineHandle : FWPM_ENGINE_HANDLE -> "buffer"
// reserved : void* optional -> "pointer"
// securityInfo : DWORD -> "u32"
// sidOwner : PSID* out -> "pointer"
// sidGroup : PSID* out -> "pointer"
// dacl : ACL** out -> "pointer"
// sacl : ACL** out -> "pointer"
// securityDescriptor : PSECURITY_DESCRIPTOR* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t IPsecKeyManagerGetSecurityInfoByKey0(
    FWPM_ENGINE_HANDLE engineHandle,
    void* reserved,
    uint32_t securityInfo,
    void* sidOwner,
    void* sidGroup,
    void* dacl,
    void* sacl,
    void* securityDescriptor);
C, "fwpuclnt.dll");
// $ffi->IPsecKeyManagerGetSecurityInfoByKey0(engineHandle, reserved, securityInfo, sidOwner, sidGroup, dacl, sacl, securityDescriptor);
// engineHandle : FWPM_ENGINE_HANDLE
// reserved : void* optional
// securityInfo : DWORD
// sidOwner : PSID* out
// sidGroup : PSID* out
// dacl : ACL** out
// sacl : ACL** out
// securityDescriptor : PSECURITY_DESCRIPTOR* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Fwpuclnt extends StdCallLibrary {
    Fwpuclnt INSTANCE = Native.load("fwpuclnt", Fwpuclnt.class);
    int IPsecKeyManagerGetSecurityInfoByKey0(
        FWPM_ENGINE_HANDLE /* extends Structure (by value) */ engineHandle,   // FWPM_ENGINE_HANDLE
        Pointer reserved,   // void* optional
        int securityInfo,   // DWORD
        Pointer sidOwner,   // PSID* out
        Pointer sidGroup,   // PSID* out
        Pointer dacl,   // ACL** out
        Pointer sacl,   // ACL** out
        Pointer securityDescriptor   // PSECURITY_DESCRIPTOR* out
    );
}
@[Link("fwpuclnt")]
lib Libfwpuclnt
  fun IPsecKeyManagerGetSecurityInfoByKey0 = IPsecKeyManagerGetSecurityInfoByKey0(
    engineHandle : FWPM_ENGINE_HANDLE,   # FWPM_ENGINE_HANDLE
    reserved : Void*,   # void* optional
    securityInfo : UInt32,   # DWORD
    sidOwner : Void*,   # PSID* out
    sidGroup : Void*,   # PSID* out
    dacl : ACL**,   # ACL** out
    sacl : ACL**,   # ACL** out
    securityDescriptor : Void*   # PSECURITY_DESCRIPTOR* out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef IPsecKeyManagerGetSecurityInfoByKey0Native = Uint32 Function(FWPM_ENGINE_HANDLE, Pointer<Void>, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef IPsecKeyManagerGetSecurityInfoByKey0Dart = int Function(int, Pointer<Void>, int, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final IPsecKeyManagerGetSecurityInfoByKey0 = DynamicLibrary.open('fwpuclnt.dll')
    .lookupFunction<IPsecKeyManagerGetSecurityInfoByKey0Native, IPsecKeyManagerGetSecurityInfoByKey0Dart>('IPsecKeyManagerGetSecurityInfoByKey0');
// engineHandle : FWPM_ENGINE_HANDLE -> FWPM_ENGINE_HANDLE
// reserved : void* optional -> Pointer<Void>
// securityInfo : DWORD -> Uint32
// sidOwner : PSID* out -> Pointer<Void>
// sidGroup : PSID* out -> Pointer<Void>
// dacl : ACL** out -> Pointer<Void>
// sacl : ACL** out -> Pointer<Void>
// securityDescriptor : PSECURITY_DESCRIPTOR* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function IPsecKeyManagerGetSecurityInfoByKey0(
  engineHandle: FWPM_ENGINE_HANDLE;   // FWPM_ENGINE_HANDLE
  reserved: Pointer;   // void* optional
  securityInfo: DWORD;   // DWORD
  sidOwner: Pointer;   // PSID* out
  sidGroup: Pointer;   // PSID* out
  dacl: Pointer;   // ACL** out
  sacl: Pointer;   // ACL** out
  securityDescriptor: Pointer   // PSECURITY_DESCRIPTOR* out
): DWORD; stdcall;
  external 'fwpuclnt.dll' name 'IPsecKeyManagerGetSecurityInfoByKey0';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "IPsecKeyManagerGetSecurityInfoByKey0"
  c_IPsecKeyManagerGetSecurityInfoByKey0 :: FWPM_ENGINE_HANDLE -> Ptr () -> Word32 -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> IO Word32
-- engineHandle : FWPM_ENGINE_HANDLE -> FWPM_ENGINE_HANDLE
-- reserved : void* optional -> Ptr ()
-- securityInfo : DWORD -> Word32
-- sidOwner : PSID* out -> Ptr ()
-- sidGroup : PSID* out -> Ptr ()
-- dacl : ACL** out -> Ptr ()
-- sacl : ACL** out -> Ptr ()
-- securityDescriptor : PSECURITY_DESCRIPTOR* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。
open Ctypes
open Foreign

let ipseckeymanagergetsecurityinfobykey0 =
  foreign "IPsecKeyManagerGetSecurityInfoByKey0"
    (FWPM_ENGINE_HANDLE @-> (ptr void) @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* engineHandle : FWPM_ENGINE_HANDLE -> FWPM_ENGINE_HANDLE *)
(* reserved : void* optional -> (ptr void) *)
(* securityInfo : DWORD -> uint32_t *)
(* sidOwner : PSID* out -> (ptr void) *)
(* sidGroup : PSID* out -> (ptr void) *)
(* dacl : ACL** out -> (ptr void) *)
(* sacl : ACL** out -> (ptr void) *)
(* securityDescriptor : PSECURITY_DESCRIPTOR* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library fwpuclnt (t "fwpuclnt.dll"))
(cffi:use-foreign-library fwpuclnt)

(cffi:defcfun ("IPsecKeyManagerGetSecurityInfoByKey0" ipsec-key-manager-get-security-info-by-key0 :convention :stdcall) :uint32
  (engine-handle (:struct fwpm-engine-handle))   ; FWPM_ENGINE_HANDLE
  (reserved :pointer)   ; void* optional
  (security-info :uint32)   ; DWORD
  (sid-owner :pointer)   ; PSID* out
  (sid-group :pointer)   ; PSID* out
  (dacl :pointer)   ; ACL** out
  (sacl :pointer)   ; ACL** out
  (security-descriptor :pointer))   ; PSECURITY_DESCRIPTOR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $IPsecKeyManagerGetSecurityInfoByKey0 = Win32::API::More->new('fwpuclnt',
    'DWORD IPsecKeyManagerGetSecurityInfoByKey0(LPVOID engineHandle, LPVOID reserved, DWORD securityInfo, HANDLE sidOwner, HANDLE sidGroup, LPVOID dacl, LPVOID sacl, HANDLE securityDescriptor)');
# my $ret = $IPsecKeyManagerGetSecurityInfoByKey0->Call($engineHandle, $reserved, $securityInfo, $sidOwner, $sidGroup, $dacl, $sacl, $securityDescriptor);
# engineHandle : FWPM_ENGINE_HANDLE -> LPVOID
# reserved : void* optional -> LPVOID
# securityInfo : DWORD -> DWORD
# sidOwner : PSID* out -> HANDLE
# sidGroup : PSID* out -> HANDLE
# dacl : ACL** out -> LPVOID
# sacl : ACL** out -> LPVOID
# securityDescriptor : PSECURITY_DESCRIPTOR* out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型