ホーム › NetworkManagement.Rras › MprAdminInterfaceQueryUpdateResult
MprAdminInterfaceQueryUpdateResult
関数インターフェイスのルート更新要求の結果を問い合わせる。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminInterfaceQueryUpdateResult(
INT_PTR hMprServer,
HANDLE hInterface,
DWORD dwProtocolId,
DWORD* lpdwUpdateResult
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hMprServer | INT_PTR | in | MprAdminServerConnectで取得したRRASサーバー接続ハンドル。ローカルはNULL可。 |
| hInterface | HANDLE | in | 更新結果を問い合わせる対象インターフェイスのハンドル。 |
| dwProtocolId | DWORD | in | 更新を要求したルーティングプロトコルの識別子。 |
| lpdwUpdateResult | DWORD* | out | 直近のルート更新処理の結果コード(Win32エラー)を受け取るポインタ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// MPRAPI.dll
#include <windows.h>
DWORD MprAdminInterfaceQueryUpdateResult(
INT_PTR hMprServer,
HANDLE hInterface,
DWORD dwProtocolId,
DWORD* lpdwUpdateResult
);[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminInterfaceQueryUpdateResult(
IntPtr hMprServer, // INT_PTR
IntPtr hInterface, // HANDLE
uint dwProtocolId, // DWORD
out uint lpdwUpdateResult // DWORD* out
);<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminInterfaceQueryUpdateResult(
hMprServer As IntPtr, ' INT_PTR
hInterface As IntPtr, ' HANDLE
dwProtocolId As UInteger, ' DWORD
<Out> ByRef lpdwUpdateResult As UInteger ' DWORD* out
) As UInteger
End Function' hMprServer : INT_PTR
' hInterface : HANDLE
' dwProtocolId : DWORD
' lpdwUpdateResult : DWORD* out
Declare PtrSafe Function MprAdminInterfaceQueryUpdateResult Lib "mprapi" ( _
ByVal hMprServer As LongPtr, _
ByVal hInterface As LongPtr, _
ByVal dwProtocolId As Long, _
ByRef lpdwUpdateResult As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MprAdminInterfaceQueryUpdateResult = ctypes.windll.mprapi.MprAdminInterfaceQueryUpdateResult
MprAdminInterfaceQueryUpdateResult.restype = wintypes.DWORD
MprAdminInterfaceQueryUpdateResult.argtypes = [
ctypes.c_ssize_t, # hMprServer : INT_PTR
wintypes.HANDLE, # hInterface : HANDLE
wintypes.DWORD, # dwProtocolId : DWORD
ctypes.POINTER(wintypes.DWORD), # lpdwUpdateResult : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPRAPI.dll')
MprAdminInterfaceQueryUpdateResult = Fiddle::Function.new(
lib['MprAdminInterfaceQueryUpdateResult'],
[
Fiddle::TYPE_INTPTR_T, # hMprServer : INT_PTR
Fiddle::TYPE_VOIDP, # hInterface : HANDLE
-Fiddle::TYPE_INT, # dwProtocolId : DWORD
Fiddle::TYPE_VOIDP, # lpdwUpdateResult : DWORD* out
],
-Fiddle::TYPE_INT)#[link(name = "mprapi")]
extern "system" {
fn MprAdminInterfaceQueryUpdateResult(
hMprServer: isize, // INT_PTR
hInterface: *mut core::ffi::c_void, // HANDLE
dwProtocolId: u32, // DWORD
lpdwUpdateResult: *mut u32 // DWORD* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprAdminInterfaceQueryUpdateResult(IntPtr hMprServer, IntPtr hInterface, uint dwProtocolId, out uint lpdwUpdateResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprAdminInterfaceQueryUpdateResult' -Namespace Win32 -PassThru
# $api::MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult)#uselib "MPRAPI.dll"
#func global MprAdminInterfaceQueryUpdateResult "MprAdminInterfaceQueryUpdateResult" sptr, sptr, sptr, sptr
; MprAdminInterfaceQueryUpdateResult hMprServer, hInterface, dwProtocolId, varptr(lpdwUpdateResult) ; 戻り値は stat
; hMprServer : INT_PTR -> "sptr"
; hInterface : HANDLE -> "sptr"
; dwProtocolId : DWORD -> "sptr"
; lpdwUpdateResult : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MPRAPI.dll" #cfunc global MprAdminInterfaceQueryUpdateResult "MprAdminInterfaceQueryUpdateResult" sptr, sptr, int, var ; res = MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult) ; hMprServer : INT_PTR -> "sptr" ; hInterface : HANDLE -> "sptr" ; dwProtocolId : DWORD -> "int" ; lpdwUpdateResult : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MPRAPI.dll" #cfunc global MprAdminInterfaceQueryUpdateResult "MprAdminInterfaceQueryUpdateResult" sptr, sptr, int, sptr ; res = MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, varptr(lpdwUpdateResult)) ; hMprServer : INT_PTR -> "sptr" ; hInterface : HANDLE -> "sptr" ; dwProtocolId : DWORD -> "int" ; lpdwUpdateResult : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MprAdminInterfaceQueryUpdateResult(INT_PTR hMprServer, HANDLE hInterface, DWORD dwProtocolId, DWORD* lpdwUpdateResult) #uselib "MPRAPI.dll" #cfunc global MprAdminInterfaceQueryUpdateResult "MprAdminInterfaceQueryUpdateResult" intptr, intptr, int, var ; res = MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult) ; hMprServer : INT_PTR -> "intptr" ; hInterface : HANDLE -> "intptr" ; dwProtocolId : DWORD -> "int" ; lpdwUpdateResult : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MprAdminInterfaceQueryUpdateResult(INT_PTR hMprServer, HANDLE hInterface, DWORD dwProtocolId, DWORD* lpdwUpdateResult) #uselib "MPRAPI.dll" #cfunc global MprAdminInterfaceQueryUpdateResult "MprAdminInterfaceQueryUpdateResult" intptr, intptr, int, intptr ; res = MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, varptr(lpdwUpdateResult)) ; hMprServer : INT_PTR -> "intptr" ; hInterface : HANDLE -> "intptr" ; dwProtocolId : DWORD -> "int" ; lpdwUpdateResult : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
procMprAdminInterfaceQueryUpdateResult = mprapi.NewProc("MprAdminInterfaceQueryUpdateResult")
)
// hMprServer (INT_PTR), hInterface (HANDLE), dwProtocolId (DWORD), lpdwUpdateResult (DWORD* out)
r1, _, err := procMprAdminInterfaceQueryUpdateResult.Call(
uintptr(hMprServer),
uintptr(hInterface),
uintptr(dwProtocolId),
uintptr(lpdwUpdateResult),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MprAdminInterfaceQueryUpdateResult(
hMprServer: NativeInt; // INT_PTR
hInterface: THandle; // HANDLE
dwProtocolId: DWORD; // DWORD
lpdwUpdateResult: Pointer // DWORD* out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminInterfaceQueryUpdateResult';result := DllCall("MPRAPI\MprAdminInterfaceQueryUpdateResult"
, "Ptr", hMprServer ; INT_PTR
, "Ptr", hInterface ; HANDLE
, "UInt", dwProtocolId ; DWORD
, "Ptr", lpdwUpdateResult ; DWORD* out
, "UInt") ; return: DWORD●MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult) = DLL("MPRAPI.dll", "dword MprAdminInterfaceQueryUpdateResult(int, void*, dword, void*)")
# 呼び出し: MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult)
# hMprServer : INT_PTR -> "int"
# hInterface : HANDLE -> "void*"
# dwProtocolId : DWORD -> "dword"
# lpdwUpdateResult : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mprapi" fn MprAdminInterfaceQueryUpdateResult(
hMprServer: isize, // INT_PTR
hInterface: ?*anyopaque, // HANDLE
dwProtocolId: u32, // DWORD
lpdwUpdateResult: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) u32;proc MprAdminInterfaceQueryUpdateResult(
hMprServer: int, # INT_PTR
hInterface: pointer, # HANDLE
dwProtocolId: uint32, # DWORD
lpdwUpdateResult: ptr uint32 # DWORD* out
): uint32 {.importc: "MprAdminInterfaceQueryUpdateResult", stdcall, dynlib: "MPRAPI.dll".}pragma(lib, "mprapi");
extern(Windows)
uint MprAdminInterfaceQueryUpdateResult(
ptrdiff_t hMprServer, // INT_PTR
void* hInterface, // HANDLE
uint dwProtocolId, // DWORD
uint* lpdwUpdateResult // DWORD* out
);ccall((:MprAdminInterfaceQueryUpdateResult, "MPRAPI.dll"), stdcall, UInt32,
(Int, Ptr{Cvoid}, UInt32, Ptr{UInt32}),
hMprServer, hInterface, dwProtocolId, lpdwUpdateResult)
# hMprServer : INT_PTR -> Int
# hInterface : HANDLE -> Ptr{Cvoid}
# dwProtocolId : DWORD -> UInt32
# lpdwUpdateResult : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t MprAdminInterfaceQueryUpdateResult(
intptr_t hMprServer,
void* hInterface,
uint32_t dwProtocolId,
uint32_t* lpdwUpdateResult);
]]
local mprapi = ffi.load("mprapi")
-- mprapi.MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult)
-- hMprServer : INT_PTR
-- hInterface : HANDLE
-- dwProtocolId : DWORD
-- lpdwUpdateResult : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MPRAPI.dll');
const MprAdminInterfaceQueryUpdateResult = lib.func('__stdcall', 'MprAdminInterfaceQueryUpdateResult', 'uint32_t', ['intptr_t', 'void *', 'uint32_t', 'uint32_t *']);
// MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult)
// hMprServer : INT_PTR -> 'intptr_t'
// hInterface : HANDLE -> 'void *'
// dwProtocolId : DWORD -> 'uint32_t'
// lpdwUpdateResult : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MPRAPI.dll", {
MprAdminInterfaceQueryUpdateResult: { parameters: ["isize", "pointer", "u32", "pointer"], result: "u32" },
});
// lib.symbols.MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult)
// hMprServer : INT_PTR -> "isize"
// hInterface : HANDLE -> "pointer"
// dwProtocolId : DWORD -> "u32"
// lpdwUpdateResult : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t MprAdminInterfaceQueryUpdateResult(
intptr_t hMprServer,
void* hInterface,
uint32_t dwProtocolId,
uint32_t* lpdwUpdateResult);
C, "MPRAPI.dll");
// $ffi->MprAdminInterfaceQueryUpdateResult(hMprServer, hInterface, dwProtocolId, lpdwUpdateResult);
// hMprServer : INT_PTR
// hInterface : HANDLE
// dwProtocolId : DWORD
// lpdwUpdateResult : DWORD* 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 Mprapi extends StdCallLibrary {
Mprapi INSTANCE = Native.load("mprapi", Mprapi.class);
int MprAdminInterfaceQueryUpdateResult(
long hMprServer, // INT_PTR
Pointer hInterface, // HANDLE
int dwProtocolId, // DWORD
IntByReference lpdwUpdateResult // DWORD* out
);
}@[Link("mprapi")]
lib LibMPRAPI
fun MprAdminInterfaceQueryUpdateResult = MprAdminInterfaceQueryUpdateResult(
hMprServer : LibC::SSizeT, # INT_PTR
hInterface : Void*, # HANDLE
dwProtocolId : UInt32, # DWORD
lpdwUpdateResult : UInt32* # DWORD* out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MprAdminInterfaceQueryUpdateResultNative = Uint32 Function(IntPtr, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef MprAdminInterfaceQueryUpdateResultDart = int Function(int, Pointer<Void>, int, Pointer<Uint32>);
final MprAdminInterfaceQueryUpdateResult = DynamicLibrary.open('MPRAPI.dll')
.lookupFunction<MprAdminInterfaceQueryUpdateResultNative, MprAdminInterfaceQueryUpdateResultDart>('MprAdminInterfaceQueryUpdateResult');
// hMprServer : INT_PTR -> IntPtr
// hInterface : HANDLE -> Pointer<Void>
// dwProtocolId : DWORD -> Uint32
// lpdwUpdateResult : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MprAdminInterfaceQueryUpdateResult(
hMprServer: NativeInt; // INT_PTR
hInterface: THandle; // HANDLE
dwProtocolId: DWORD; // DWORD
lpdwUpdateResult: Pointer // DWORD* out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprAdminInterfaceQueryUpdateResult';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MprAdminInterfaceQueryUpdateResult"
c_MprAdminInterfaceQueryUpdateResult :: CIntPtr -> Ptr () -> Word32 -> Ptr Word32 -> IO Word32
-- hMprServer : INT_PTR -> CIntPtr
-- hInterface : HANDLE -> Ptr ()
-- dwProtocolId : DWORD -> Word32
-- lpdwUpdateResult : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mpradmininterfacequeryupdateresult =
foreign "MprAdminInterfaceQueryUpdateResult"
(intptr_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning uint32_t)
(* hMprServer : INT_PTR -> intptr_t *)
(* hInterface : HANDLE -> (ptr void) *)
(* dwProtocolId : DWORD -> uint32_t *)
(* lpdwUpdateResult : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mprapi (t "MPRAPI.dll"))
(cffi:use-foreign-library mprapi)
(cffi:defcfun ("MprAdminInterfaceQueryUpdateResult" mpr-admin-interface-query-update-result :convention :stdcall) :uint32
(h-mpr-server :int64) ; INT_PTR
(h-interface :pointer) ; HANDLE
(dw-protocol-id :uint32) ; DWORD
(lpdw-update-result :pointer)) ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MprAdminInterfaceQueryUpdateResult = Win32::API::More->new('MPRAPI',
'DWORD MprAdminInterfaceQueryUpdateResult(LPARAM hMprServer, HANDLE hInterface, DWORD dwProtocolId, LPVOID lpdwUpdateResult)');
# my $ret = $MprAdminInterfaceQueryUpdateResult->Call($hMprServer, $hInterface, $dwProtocolId, $lpdwUpdateResult);
# hMprServer : INT_PTR -> LPARAM
# hInterface : HANDLE -> HANDLE
# dwProtocolId : DWORD -> DWORD
# lpdwUpdateResult : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。