ホーム › NetworkManagement.IpHelper › RegisterInterfaceTimestampConfigChange
RegisterInterfaceTimestampConfigChange
関数タイムスタンプ構成変更の通知コールバックを登録する。
シグネチャ
// IPHLPAPI.dll
#include <windows.h>
DWORD RegisterInterfaceTimestampConfigChange(
PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK Callback,
void* CallerContext, // optional
HIFTIMESTAMPCHANGE* NotificationHandle
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Callback | PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK | in | タイムスタンプ機能の変更が発生したときに呼び出される、ユーザーのコールバック関数です。 |
| CallerContext | void* | inoptional | 呼び出し元が割り当てる省略可能なコンテキストです。 |
| NotificationHandle | HIFTIMESTAMPCHANGE* | out | 関数によって返される、登録を識別するハンドルです。 |
戻り値の型: DWORD
公式ドキュメント
タイムスタンプ機能の変更を通知するためにシステムが呼び出す、ユーザー実装のコールバック関数を登録します。
戻り値
型: DWORD
成功または失敗を示す DWORD の戻り値コードです。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// IPHLPAPI.dll
#include <windows.h>
DWORD RegisterInterfaceTimestampConfigChange(
PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK Callback,
void* CallerContext, // optional
HIFTIMESTAMPCHANGE* NotificationHandle
);[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint RegisterInterfaceTimestampConfigChange(
IntPtr Callback, // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
IntPtr CallerContext, // void* optional
IntPtr NotificationHandle // HIFTIMESTAMPCHANGE* out
);<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function RegisterInterfaceTimestampConfigChange(
Callback As IntPtr, ' PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext As IntPtr, ' void* optional
NotificationHandle As IntPtr ' HIFTIMESTAMPCHANGE* out
) As UInteger
End Function' Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
' CallerContext : void* optional
' NotificationHandle : HIFTIMESTAMPCHANGE* out
Declare PtrSafe Function RegisterInterfaceTimestampConfigChange Lib "iphlpapi" ( _
ByVal Callback As LongPtr, _
ByVal CallerContext As LongPtr, _
ByVal NotificationHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterInterfaceTimestampConfigChange = ctypes.windll.iphlpapi.RegisterInterfaceTimestampConfigChange
RegisterInterfaceTimestampConfigChange.restype = wintypes.DWORD
RegisterInterfaceTimestampConfigChange.argtypes = [
ctypes.c_void_p, # Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
ctypes.POINTER(None), # CallerContext : void* optional
ctypes.c_void_p, # NotificationHandle : HIFTIMESTAMPCHANGE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IPHLPAPI.dll')
RegisterInterfaceTimestampConfigChange = Fiddle::Function.new(
lib['RegisterInterfaceTimestampConfigChange'],
[
Fiddle::TYPE_VOIDP, # Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
Fiddle::TYPE_VOIDP, # CallerContext : void* optional
Fiddle::TYPE_VOIDP, # NotificationHandle : HIFTIMESTAMPCHANGE* out
],
-Fiddle::TYPE_INT)#[link(name = "iphlpapi")]
extern "system" {
fn RegisterInterfaceTimestampConfigChange(
Callback: *const core::ffi::c_void, // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext: *mut (), // void* optional
NotificationHandle: *mut *mut core::ffi::c_void // HIFTIMESTAMPCHANGE* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint RegisterInterfaceTimestampConfigChange(IntPtr Callback, IntPtr CallerContext, IntPtr NotificationHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_RegisterInterfaceTimestampConfigChange' -Namespace Win32 -PassThru
# $api::RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)#uselib "IPHLPAPI.dll"
#func global RegisterInterfaceTimestampConfigChange "RegisterInterfaceTimestampConfigChange" sptr, sptr, sptr
; RegisterInterfaceTimestampConfigChange Callback, CallerContext, NotificationHandle ; 戻り値は stat
; Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> "sptr"
; CallerContext : void* optional -> "sptr"
; NotificationHandle : HIFTIMESTAMPCHANGE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "IPHLPAPI.dll"
#cfunc global RegisterInterfaceTimestampConfigChange "RegisterInterfaceTimestampConfigChange" sptr, sptr, sptr
; res = RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)
; Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> "sptr"
; CallerContext : void* optional -> "sptr"
; NotificationHandle : HIFTIMESTAMPCHANGE* out -> "sptr"; DWORD RegisterInterfaceTimestampConfigChange(PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK Callback, void* CallerContext, HIFTIMESTAMPCHANGE* NotificationHandle)
#uselib "IPHLPAPI.dll"
#cfunc global RegisterInterfaceTimestampConfigChange "RegisterInterfaceTimestampConfigChange" intptr, intptr, intptr
; res = RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)
; Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> "intptr"
; CallerContext : void* optional -> "intptr"
; NotificationHandle : HIFTIMESTAMPCHANGE* out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
procRegisterInterfaceTimestampConfigChange = iphlpapi.NewProc("RegisterInterfaceTimestampConfigChange")
)
// Callback (PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK), CallerContext (void* optional), NotificationHandle (HIFTIMESTAMPCHANGE* out)
r1, _, err := procRegisterInterfaceTimestampConfigChange.Call(
uintptr(Callback),
uintptr(CallerContext),
uintptr(NotificationHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RegisterInterfaceTimestampConfigChange(
Callback: Pointer; // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext: Pointer; // void* optional
NotificationHandle: Pointer // HIFTIMESTAMPCHANGE* out
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'RegisterInterfaceTimestampConfigChange';result := DllCall("IPHLPAPI\RegisterInterfaceTimestampConfigChange"
, "Ptr", Callback ; PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
, "Ptr", CallerContext ; void* optional
, "Ptr", NotificationHandle ; HIFTIMESTAMPCHANGE* out
, "UInt") ; return: DWORD●RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle) = DLL("IPHLPAPI.dll", "dword RegisterInterfaceTimestampConfigChange(void*, void*, void*)")
# 呼び出し: RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)
# Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> "void*"
# CallerContext : void* optional -> "void*"
# NotificationHandle : HIFTIMESTAMPCHANGE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "iphlpapi" fn RegisterInterfaceTimestampConfigChange(
Callback: ?*anyopaque, // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext: ?*anyopaque, // void* optional
NotificationHandle: ?*anyopaque // HIFTIMESTAMPCHANGE* out
) callconv(std.os.windows.WINAPI) u32;proc RegisterInterfaceTimestampConfigChange(
Callback: pointer, # PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext: pointer, # void* optional
NotificationHandle: pointer # HIFTIMESTAMPCHANGE* out
): uint32 {.importc: "RegisterInterfaceTimestampConfigChange", stdcall, dynlib: "IPHLPAPI.dll".}pragma(lib, "iphlpapi");
extern(Windows)
uint RegisterInterfaceTimestampConfigChange(
void* Callback, // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
void* CallerContext, // void* optional
void* NotificationHandle // HIFTIMESTAMPCHANGE* out
);ccall((:RegisterInterfaceTimestampConfigChange, "IPHLPAPI.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
Callback, CallerContext, NotificationHandle)
# Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> Ptr{Cvoid}
# CallerContext : void* optional -> Ptr{Cvoid}
# NotificationHandle : HIFTIMESTAMPCHANGE* out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t RegisterInterfaceTimestampConfigChange(
void* Callback,
void* CallerContext,
void* NotificationHandle);
]]
local iphlpapi = ffi.load("iphlpapi")
-- iphlpapi.RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)
-- Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
-- CallerContext : void* optional
-- NotificationHandle : HIFTIMESTAMPCHANGE* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('IPHLPAPI.dll');
const RegisterInterfaceTimestampConfigChange = lib.func('__stdcall', 'RegisterInterfaceTimestampConfigChange', 'uint32_t', ['void *', 'void *', 'void *']);
// RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)
// Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> 'void *'
// CallerContext : void* optional -> 'void *'
// NotificationHandle : HIFTIMESTAMPCHANGE* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("IPHLPAPI.dll", {
RegisterInterfaceTimestampConfigChange: { parameters: ["pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle)
// Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> "pointer"
// CallerContext : void* optional -> "pointer"
// NotificationHandle : HIFTIMESTAMPCHANGE* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t RegisterInterfaceTimestampConfigChange(
void* Callback,
void* CallerContext,
void* NotificationHandle);
C, "IPHLPAPI.dll");
// $ffi->RegisterInterfaceTimestampConfigChange(Callback, CallerContext, NotificationHandle);
// Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
// CallerContext : void* optional
// NotificationHandle : HIFTIMESTAMPCHANGE* 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 Iphlpapi extends StdCallLibrary {
Iphlpapi INSTANCE = Native.load("iphlpapi", Iphlpapi.class);
int RegisterInterfaceTimestampConfigChange(
Callback Callback, // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
Pointer CallerContext, // void* optional
Pointer NotificationHandle // HIFTIMESTAMPCHANGE* out
);
}@[Link("iphlpapi")]
lib LibIPHLPAPI
fun RegisterInterfaceTimestampConfigChange = RegisterInterfaceTimestampConfigChange(
Callback : Void*, # PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext : Void*, # void* optional
NotificationHandle : Void* # HIFTIMESTAMPCHANGE* out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RegisterInterfaceTimestampConfigChangeNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef RegisterInterfaceTimestampConfigChangeDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final RegisterInterfaceTimestampConfigChange = DynamicLibrary.open('IPHLPAPI.dll')
.lookupFunction<RegisterInterfaceTimestampConfigChangeNative, RegisterInterfaceTimestampConfigChangeDart>('RegisterInterfaceTimestampConfigChange');
// Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> Pointer<Void>
// CallerContext : void* optional -> Pointer<Void>
// NotificationHandle : HIFTIMESTAMPCHANGE* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RegisterInterfaceTimestampConfigChange(
Callback: Pointer; // PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
CallerContext: Pointer; // void* optional
NotificationHandle: Pointer // HIFTIMESTAMPCHANGE* out
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'RegisterInterfaceTimestampConfigChange';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RegisterInterfaceTimestampConfigChange"
c_RegisterInterfaceTimestampConfigChange :: Ptr () -> Ptr () -> Ptr () -> IO Word32
-- Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> Ptr ()
-- CallerContext : void* optional -> Ptr ()
-- NotificationHandle : HIFTIMESTAMPCHANGE* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let registerinterfacetimestampconfigchange =
foreign "RegisterInterfaceTimestampConfigChange"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> (ptr void) *)
(* CallerContext : void* optional -> (ptr void) *)
(* NotificationHandle : HIFTIMESTAMPCHANGE* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library iphlpapi (t "IPHLPAPI.dll"))
(cffi:use-foreign-library iphlpapi)
(cffi:defcfun ("RegisterInterfaceTimestampConfigChange" register-interface-timestamp-config-change :convention :stdcall) :uint32
(callback :pointer) ; PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK
(caller-context :pointer) ; void* optional
(notification-handle :pointer)) ; HIFTIMESTAMPCHANGE* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RegisterInterfaceTimestampConfigChange = Win32::API::More->new('IPHLPAPI',
'DWORD RegisterInterfaceTimestampConfigChange(LPVOID Callback, LPVOID CallerContext, HANDLE NotificationHandle)');
# my $ret = $RegisterInterfaceTimestampConfigChange->Call($Callback, $CallerContext, $NotificationHandle);
# Callback : PINTERFACE_TIMESTAMP_CONFIG_CHANGE_CALLBACK -> LPVOID
# CallerContext : void* optional -> LPVOID
# NotificationHandle : HIFTIMESTAMPCHANGE* out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。