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

PeerGraphValidateDeferredRecords

関数
保留中のピアグラフレコードを検証する。
DLLP2PGRAPH.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGraphValidateDeferredRecords(
    void* hGraph,
    DWORD cRecordIds,
    const GUID* pRecordIds
);

パラメーター

名前方向説明
hGraphvoid*in保留中レコードを検証する対象のグラフを表すハンドル。
cRecordIdsDWORDinpRecordIds配列に含まれるレコードID数。
pRecordIdsGUID*in検証する保留レコードのIDを格納したGUID配列へのポインター。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerGraphValidateDeferredRecords(
    void* hGraph,
    DWORD cRecordIds,
    const GUID* pRecordIds
);
[DllImport("P2PGRAPH.dll", ExactSpelling = true)]
static extern int PeerGraphValidateDeferredRecords(
    IntPtr hGraph,   // void*
    uint cRecordIds,   // DWORD
    ref Guid pRecordIds   // GUID*
);
<DllImport("P2PGRAPH.dll", ExactSpelling:=True)>
Public Shared Function PeerGraphValidateDeferredRecords(
    hGraph As IntPtr,   ' void*
    cRecordIds As UInteger,   ' DWORD
    ByRef pRecordIds As Guid   ' GUID*
) As Integer
End Function
' hGraph : void*
' cRecordIds : DWORD
' pRecordIds : GUID*
Declare PtrSafe Function PeerGraphValidateDeferredRecords Lib "p2pgraph" ( _
    ByVal hGraph As LongPtr, _
    ByVal cRecordIds As Long, _
    ByVal pRecordIds As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerGraphValidateDeferredRecords = ctypes.windll.p2pgraph.PeerGraphValidateDeferredRecords
PeerGraphValidateDeferredRecords.restype = ctypes.c_int
PeerGraphValidateDeferredRecords.argtypes = [
    ctypes.POINTER(None),  # hGraph : void*
    wintypes.DWORD,  # cRecordIds : DWORD
    ctypes.c_void_p,  # pRecordIds : GUID*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('P2PGRAPH.dll')
PeerGraphValidateDeferredRecords = Fiddle::Function.new(
  lib['PeerGraphValidateDeferredRecords'],
  [
    Fiddle::TYPE_VOIDP,  # hGraph : void*
    -Fiddle::TYPE_INT,  # cRecordIds : DWORD
    Fiddle::TYPE_VOIDP,  # pRecordIds : GUID*
  ],
  Fiddle::TYPE_INT)
#[link(name = "p2pgraph")]
extern "system" {
    fn PeerGraphValidateDeferredRecords(
        hGraph: *mut (),  // void*
        cRecordIds: u32,  // DWORD
        pRecordIds: *const GUID  // GUID*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("P2PGRAPH.dll")]
public static extern int PeerGraphValidateDeferredRecords(IntPtr hGraph, uint cRecordIds, ref Guid pRecordIds);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2PGRAPH_PeerGraphValidateDeferredRecords' -Namespace Win32 -PassThru
# $api::PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
#uselib "P2PGRAPH.dll"
#func global PeerGraphValidateDeferredRecords "PeerGraphValidateDeferredRecords" sptr, sptr, sptr
; PeerGraphValidateDeferredRecords hGraph, cRecordIds, varptr(pRecordIds)   ; 戻り値は stat
; hGraph : void* -> "sptr"
; cRecordIds : DWORD -> "sptr"
; pRecordIds : GUID* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphValidateDeferredRecords "PeerGraphValidateDeferredRecords" sptr, int, var
; res = PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
; hGraph : void* -> "sptr"
; cRecordIds : DWORD -> "int"
; pRecordIds : GUID* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT PeerGraphValidateDeferredRecords(void* hGraph, DWORD cRecordIds, GUID* pRecordIds)
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphValidateDeferredRecords "PeerGraphValidateDeferredRecords" intptr, int, var
; res = PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
; hGraph : void* -> "intptr"
; cRecordIds : DWORD -> "int"
; pRecordIds : GUID* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphValidateDeferredRecords = p2pgraph.NewProc("PeerGraphValidateDeferredRecords")
)

// hGraph (void*), cRecordIds (DWORD), pRecordIds (GUID*)
r1, _, err := procPeerGraphValidateDeferredRecords.Call(
	uintptr(hGraph),
	uintptr(cRecordIds),
	uintptr(pRecordIds),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PeerGraphValidateDeferredRecords(
  hGraph: Pointer;   // void*
  cRecordIds: DWORD;   // DWORD
  pRecordIds: PGUID   // GUID*
): Integer; stdcall;
  external 'P2PGRAPH.dll' name 'PeerGraphValidateDeferredRecords';
result := DllCall("P2PGRAPH\PeerGraphValidateDeferredRecords"
    , "Ptr", hGraph   ; void*
    , "UInt", cRecordIds   ; DWORD
    , "Ptr", pRecordIds   ; GUID*
    , "Int")   ; return: HRESULT
●PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds) = DLL("P2PGRAPH.dll", "int PeerGraphValidateDeferredRecords(void*, dword, void*)")
# 呼び出し: PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
# hGraph : void* -> "void*"
# cRecordIds : DWORD -> "dword"
# pRecordIds : GUID* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "p2pgraph" fn PeerGraphValidateDeferredRecords(
    hGraph: ?*anyopaque, // void*
    cRecordIds: u32, // DWORD
    pRecordIds: [*c]GUID // GUID*
) callconv(std.os.windows.WINAPI) i32;
proc PeerGraphValidateDeferredRecords(
    hGraph: pointer,  # void*
    cRecordIds: uint32,  # DWORD
    pRecordIds: ptr GUID  # GUID*
): int32 {.importc: "PeerGraphValidateDeferredRecords", stdcall, dynlib: "P2PGRAPH.dll".}
pragma(lib, "p2pgraph");
extern(Windows)
int PeerGraphValidateDeferredRecords(
    void* hGraph,   // void*
    uint cRecordIds,   // DWORD
    GUID* pRecordIds   // GUID*
);
ccall((:PeerGraphValidateDeferredRecords, "P2PGRAPH.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Ptr{GUID}),
      hGraph, cRecordIds, pRecordIds)
# hGraph : void* -> Ptr{Cvoid}
# cRecordIds : DWORD -> UInt32
# pRecordIds : GUID* -> Ptr{GUID}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t PeerGraphValidateDeferredRecords(
    void* hGraph,
    uint32_t cRecordIds,
    void* pRecordIds);
]]
local p2pgraph = ffi.load("p2pgraph")
-- p2pgraph.PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
-- hGraph : void*
-- cRecordIds : DWORD
-- pRecordIds : GUID*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('P2PGRAPH.dll');
const PeerGraphValidateDeferredRecords = lib.func('__stdcall', 'PeerGraphValidateDeferredRecords', 'int32_t', ['void *', 'uint32_t', 'void *']);
// PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
// hGraph : void* -> 'void *'
// cRecordIds : DWORD -> 'uint32_t'
// pRecordIds : GUID* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("P2PGRAPH.dll", {
  PeerGraphValidateDeferredRecords: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds)
// hGraph : void* -> "pointer"
// cRecordIds : DWORD -> "u32"
// pRecordIds : GUID* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t PeerGraphValidateDeferredRecords(
    void* hGraph,
    uint32_t cRecordIds,
    void* pRecordIds);
C, "P2PGRAPH.dll");
// $ffi->PeerGraphValidateDeferredRecords(hGraph, cRecordIds, pRecordIds);
// hGraph : void*
// cRecordIds : DWORD
// pRecordIds : GUID*
// 構造体/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 P2pgraph extends StdCallLibrary {
    P2pgraph INSTANCE = Native.load("p2pgraph", P2pgraph.class);
    int PeerGraphValidateDeferredRecords(
        Pointer hGraph,   // void*
        int cRecordIds,   // DWORD
        Pointer pRecordIds   // GUID*
    );
}
@[Link("p2pgraph")]
lib LibP2PGRAPH
  fun PeerGraphValidateDeferredRecords = PeerGraphValidateDeferredRecords(
    hGraph : Void*,   # void*
    cRecordIds : UInt32,   # DWORD
    pRecordIds : GUID*   # GUID*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef PeerGraphValidateDeferredRecordsNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef PeerGraphValidateDeferredRecordsDart = int Function(Pointer<Void>, int, Pointer<Void>);
final PeerGraphValidateDeferredRecords = DynamicLibrary.open('P2PGRAPH.dll')
    .lookupFunction<PeerGraphValidateDeferredRecordsNative, PeerGraphValidateDeferredRecordsDart>('PeerGraphValidateDeferredRecords');
// hGraph : void* -> Pointer<Void>
// cRecordIds : DWORD -> Uint32
// pRecordIds : GUID* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PeerGraphValidateDeferredRecords(
  hGraph: Pointer;   // void*
  cRecordIds: DWORD;   // DWORD
  pRecordIds: PGUID   // GUID*
): Integer; stdcall;
  external 'P2PGRAPH.dll' name 'PeerGraphValidateDeferredRecords';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PeerGraphValidateDeferredRecords"
  c_PeerGraphValidateDeferredRecords :: Ptr () -> Word32 -> Ptr () -> IO Int32
-- hGraph : void* -> Ptr ()
-- cRecordIds : DWORD -> Word32
-- pRecordIds : GUID* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let peergraphvalidatedeferredrecords =
  foreign "PeerGraphValidateDeferredRecords"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hGraph : void* -> (ptr void) *)
(* cRecordIds : DWORD -> uint32_t *)
(* pRecordIds : GUID* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library p2pgraph (t "P2PGRAPH.dll"))
(cffi:use-foreign-library p2pgraph)

(cffi:defcfun ("PeerGraphValidateDeferredRecords" peer-graph-validate-deferred-records :convention :stdcall) :int32
  (h-graph :pointer)   ; void*
  (c-record-ids :uint32)   ; DWORD
  (p-record-ids :pointer))   ; GUID*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PeerGraphValidateDeferredRecords = Win32::API::More->new('P2PGRAPH',
    'int PeerGraphValidateDeferredRecords(LPVOID hGraph, DWORD cRecordIds, LPVOID pRecordIds)');
# my $ret = $PeerGraphValidateDeferredRecords->Call($hGraph, $cRecordIds, $pRecordIds);
# hGraph : void* -> LPVOID
# cRecordIds : DWORD -> DWORD
# pRecordIds : GUID* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。