ホーム › System.DeploymentServices › PxeDhcpv6Initialize
PxeDhcpv6Initialize
関数受信パケットを基にDHCPv6応答パケットを初期化する。
シグネチャ
// WDSPXE.dll
#include <windows.h>
DWORD PxeDhcpv6Initialize(
void* pRequest,
DWORD cbRequest,
void* pReply,
DWORD cbReply,
DWORD* pcbReplyUsed
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pRequest | void* | in | 受信したDHCPv6要求パケットへのポインタ。 |
| cbRequest | DWORD | in | 要求パケットの長さ(バイト単位)。 |
| pReply | void* | out | 構築する応答DHCPv6パケットを書き込むバッファ。 |
| cbReply | DWORD | in | 応答バッファの最大サイズ(バイト単位)。 |
| pcbReplyUsed | DWORD* | out | 実際に使用された応答パケット長を受け取るDWORDポインタ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// WDSPXE.dll
#include <windows.h>
DWORD PxeDhcpv6Initialize(
void* pRequest,
DWORD cbRequest,
void* pReply,
DWORD cbReply,
DWORD* pcbReplyUsed
);[DllImport("WDSPXE.dll", ExactSpelling = true)]
static extern uint PxeDhcpv6Initialize(
IntPtr pRequest, // void*
uint cbRequest, // DWORD
IntPtr pReply, // void* out
uint cbReply, // DWORD
out uint pcbReplyUsed // DWORD* out
);<DllImport("WDSPXE.dll", ExactSpelling:=True)>
Public Shared Function PxeDhcpv6Initialize(
pRequest As IntPtr, ' void*
cbRequest As UInteger, ' DWORD
pReply As IntPtr, ' void* out
cbReply As UInteger, ' DWORD
<Out> ByRef pcbReplyUsed As UInteger ' DWORD* out
) As UInteger
End Function' pRequest : void*
' cbRequest : DWORD
' pReply : void* out
' cbReply : DWORD
' pcbReplyUsed : DWORD* out
Declare PtrSafe Function PxeDhcpv6Initialize Lib "wdspxe" ( _
ByVal pRequest As LongPtr, _
ByVal cbRequest As Long, _
ByVal pReply As LongPtr, _
ByVal cbReply As Long, _
ByRef pcbReplyUsed As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PxeDhcpv6Initialize = ctypes.windll.wdspxe.PxeDhcpv6Initialize
PxeDhcpv6Initialize.restype = wintypes.DWORD
PxeDhcpv6Initialize.argtypes = [
ctypes.POINTER(None), # pRequest : void*
wintypes.DWORD, # cbRequest : DWORD
ctypes.POINTER(None), # pReply : void* out
wintypes.DWORD, # cbReply : DWORD
ctypes.POINTER(wintypes.DWORD), # pcbReplyUsed : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WDSPXE.dll')
PxeDhcpv6Initialize = Fiddle::Function.new(
lib['PxeDhcpv6Initialize'],
[
Fiddle::TYPE_VOIDP, # pRequest : void*
-Fiddle::TYPE_INT, # cbRequest : DWORD
Fiddle::TYPE_VOIDP, # pReply : void* out
-Fiddle::TYPE_INT, # cbReply : DWORD
Fiddle::TYPE_VOIDP, # pcbReplyUsed : DWORD* out
],
-Fiddle::TYPE_INT)#[link(name = "wdspxe")]
extern "system" {
fn PxeDhcpv6Initialize(
pRequest: *mut (), // void*
cbRequest: u32, // DWORD
pReply: *mut (), // void* out
cbReply: u32, // DWORD
pcbReplyUsed: *mut u32 // DWORD* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WDSPXE.dll")]
public static extern uint PxeDhcpv6Initialize(IntPtr pRequest, uint cbRequest, IntPtr pReply, uint cbReply, out uint pcbReplyUsed);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WDSPXE_PxeDhcpv6Initialize' -Namespace Win32 -PassThru
# $api::PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed)#uselib "WDSPXE.dll"
#func global PxeDhcpv6Initialize "PxeDhcpv6Initialize" sptr, sptr, sptr, sptr, sptr
; PxeDhcpv6Initialize pRequest, cbRequest, pReply, cbReply, varptr(pcbReplyUsed) ; 戻り値は stat
; pRequest : void* -> "sptr"
; cbRequest : DWORD -> "sptr"
; pReply : void* out -> "sptr"
; cbReply : DWORD -> "sptr"
; pcbReplyUsed : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WDSPXE.dll" #cfunc global PxeDhcpv6Initialize "PxeDhcpv6Initialize" sptr, int, sptr, int, var ; res = PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed) ; pRequest : void* -> "sptr" ; cbRequest : DWORD -> "int" ; pReply : void* out -> "sptr" ; cbReply : DWORD -> "int" ; pcbReplyUsed : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WDSPXE.dll" #cfunc global PxeDhcpv6Initialize "PxeDhcpv6Initialize" sptr, int, sptr, int, sptr ; res = PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, varptr(pcbReplyUsed)) ; pRequest : void* -> "sptr" ; cbRequest : DWORD -> "int" ; pReply : void* out -> "sptr" ; cbReply : DWORD -> "int" ; pcbReplyUsed : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD PxeDhcpv6Initialize(void* pRequest, DWORD cbRequest, void* pReply, DWORD cbReply, DWORD* pcbReplyUsed) #uselib "WDSPXE.dll" #cfunc global PxeDhcpv6Initialize "PxeDhcpv6Initialize" intptr, int, intptr, int, var ; res = PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed) ; pRequest : void* -> "intptr" ; cbRequest : DWORD -> "int" ; pReply : void* out -> "intptr" ; cbReply : DWORD -> "int" ; pcbReplyUsed : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD PxeDhcpv6Initialize(void* pRequest, DWORD cbRequest, void* pReply, DWORD cbReply, DWORD* pcbReplyUsed) #uselib "WDSPXE.dll" #cfunc global PxeDhcpv6Initialize "PxeDhcpv6Initialize" intptr, int, intptr, int, intptr ; res = PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, varptr(pcbReplyUsed)) ; pRequest : void* -> "intptr" ; cbRequest : DWORD -> "int" ; pReply : void* out -> "intptr" ; cbReply : DWORD -> "int" ; pcbReplyUsed : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wdspxe = windows.NewLazySystemDLL("WDSPXE.dll")
procPxeDhcpv6Initialize = wdspxe.NewProc("PxeDhcpv6Initialize")
)
// pRequest (void*), cbRequest (DWORD), pReply (void* out), cbReply (DWORD), pcbReplyUsed (DWORD* out)
r1, _, err := procPxeDhcpv6Initialize.Call(
uintptr(pRequest),
uintptr(cbRequest),
uintptr(pReply),
uintptr(cbReply),
uintptr(pcbReplyUsed),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PxeDhcpv6Initialize(
pRequest: Pointer; // void*
cbRequest: DWORD; // DWORD
pReply: Pointer; // void* out
cbReply: DWORD; // DWORD
pcbReplyUsed: Pointer // DWORD* out
): DWORD; stdcall;
external 'WDSPXE.dll' name 'PxeDhcpv6Initialize';result := DllCall("WDSPXE\PxeDhcpv6Initialize"
, "Ptr", pRequest ; void*
, "UInt", cbRequest ; DWORD
, "Ptr", pReply ; void* out
, "UInt", cbReply ; DWORD
, "Ptr", pcbReplyUsed ; DWORD* out
, "UInt") ; return: DWORD●PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed) = DLL("WDSPXE.dll", "dword PxeDhcpv6Initialize(void*, dword, void*, dword, void*)")
# 呼び出し: PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed)
# pRequest : void* -> "void*"
# cbRequest : DWORD -> "dword"
# pReply : void* out -> "void*"
# cbReply : DWORD -> "dword"
# pcbReplyUsed : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wdspxe" fn PxeDhcpv6Initialize(
pRequest: ?*anyopaque, // void*
cbRequest: u32, // DWORD
pReply: ?*anyopaque, // void* out
cbReply: u32, // DWORD
pcbReplyUsed: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) u32;proc PxeDhcpv6Initialize(
pRequest: pointer, # void*
cbRequest: uint32, # DWORD
pReply: pointer, # void* out
cbReply: uint32, # DWORD
pcbReplyUsed: ptr uint32 # DWORD* out
): uint32 {.importc: "PxeDhcpv6Initialize", stdcall, dynlib: "WDSPXE.dll".}pragma(lib, "wdspxe");
extern(Windows)
uint PxeDhcpv6Initialize(
void* pRequest, // void*
uint cbRequest, // DWORD
void* pReply, // void* out
uint cbReply, // DWORD
uint* pcbReplyUsed // DWORD* out
);ccall((:PxeDhcpv6Initialize, "WDSPXE.dll"), stdcall, UInt32,
(Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{UInt32}),
pRequest, cbRequest, pReply, cbReply, pcbReplyUsed)
# pRequest : void* -> Ptr{Cvoid}
# cbRequest : DWORD -> UInt32
# pReply : void* out -> Ptr{Cvoid}
# cbReply : DWORD -> UInt32
# pcbReplyUsed : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t PxeDhcpv6Initialize(
void* pRequest,
uint32_t cbRequest,
void* pReply,
uint32_t cbReply,
uint32_t* pcbReplyUsed);
]]
local wdspxe = ffi.load("wdspxe")
-- wdspxe.PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed)
-- pRequest : void*
-- cbRequest : DWORD
-- pReply : void* out
-- cbReply : DWORD
-- pcbReplyUsed : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WDSPXE.dll');
const PxeDhcpv6Initialize = lib.func('__stdcall', 'PxeDhcpv6Initialize', 'uint32_t', ['void *', 'uint32_t', 'void *', 'uint32_t', 'uint32_t *']);
// PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed)
// pRequest : void* -> 'void *'
// cbRequest : DWORD -> 'uint32_t'
// pReply : void* out -> 'void *'
// cbReply : DWORD -> 'uint32_t'
// pcbReplyUsed : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WDSPXE.dll", {
PxeDhcpv6Initialize: { parameters: ["pointer", "u32", "pointer", "u32", "pointer"], result: "u32" },
});
// lib.symbols.PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed)
// pRequest : void* -> "pointer"
// cbRequest : DWORD -> "u32"
// pReply : void* out -> "pointer"
// cbReply : DWORD -> "u32"
// pcbReplyUsed : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t PxeDhcpv6Initialize(
void* pRequest,
uint32_t cbRequest,
void* pReply,
uint32_t cbReply,
uint32_t* pcbReplyUsed);
C, "WDSPXE.dll");
// $ffi->PxeDhcpv6Initialize(pRequest, cbRequest, pReply, cbReply, pcbReplyUsed);
// pRequest : void*
// cbRequest : DWORD
// pReply : void* out
// cbReply : DWORD
// pcbReplyUsed : 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 Wdspxe extends StdCallLibrary {
Wdspxe INSTANCE = Native.load("wdspxe", Wdspxe.class);
int PxeDhcpv6Initialize(
Pointer pRequest, // void*
int cbRequest, // DWORD
Pointer pReply, // void* out
int cbReply, // DWORD
IntByReference pcbReplyUsed // DWORD* out
);
}@[Link("wdspxe")]
lib LibWDSPXE
fun PxeDhcpv6Initialize = PxeDhcpv6Initialize(
pRequest : Void*, # void*
cbRequest : UInt32, # DWORD
pReply : Void*, # void* out
cbReply : UInt32, # DWORD
pcbReplyUsed : 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 PxeDhcpv6InitializeNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef PxeDhcpv6InitializeDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Uint32>);
final PxeDhcpv6Initialize = DynamicLibrary.open('WDSPXE.dll')
.lookupFunction<PxeDhcpv6InitializeNative, PxeDhcpv6InitializeDart>('PxeDhcpv6Initialize');
// pRequest : void* -> Pointer<Void>
// cbRequest : DWORD -> Uint32
// pReply : void* out -> Pointer<Void>
// cbReply : DWORD -> Uint32
// pcbReplyUsed : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function PxeDhcpv6Initialize(
pRequest: Pointer; // void*
cbRequest: DWORD; // DWORD
pReply: Pointer; // void* out
cbReply: DWORD; // DWORD
pcbReplyUsed: Pointer // DWORD* out
): DWORD; stdcall;
external 'WDSPXE.dll' name 'PxeDhcpv6Initialize';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "PxeDhcpv6Initialize"
c_PxeDhcpv6Initialize :: Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr Word32 -> IO Word32
-- pRequest : void* -> Ptr ()
-- cbRequest : DWORD -> Word32
-- pReply : void* out -> Ptr ()
-- cbReply : DWORD -> Word32
-- pcbReplyUsed : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let pxedhcpv6initialize =
foreign "PxeDhcpv6Initialize"
((ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning uint32_t)
(* pRequest : void* -> (ptr void) *)
(* cbRequest : DWORD -> uint32_t *)
(* pReply : void* out -> (ptr void) *)
(* cbReply : DWORD -> uint32_t *)
(* pcbReplyUsed : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wdspxe (t "WDSPXE.dll"))
(cffi:use-foreign-library wdspxe)
(cffi:defcfun ("PxeDhcpv6Initialize" pxe-dhcpv6-initialize :convention :stdcall) :uint32
(p-request :pointer) ; void*
(cb-request :uint32) ; DWORD
(p-reply :pointer) ; void* out
(cb-reply :uint32) ; DWORD
(pcb-reply-used :pointer)) ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $PxeDhcpv6Initialize = Win32::API::More->new('WDSPXE',
'DWORD PxeDhcpv6Initialize(LPVOID pRequest, DWORD cbRequest, LPVOID pReply, DWORD cbReply, LPVOID pcbReplyUsed)');
# my $ret = $PxeDhcpv6Initialize->Call($pRequest, $cbRequest, $pReply, $cbReply, $pcbReplyUsed);
# pRequest : void* -> LPVOID
# cbRequest : DWORD -> DWORD
# pReply : void* out -> LPVOID
# cbReply : DWORD -> DWORD
# pcbReplyUsed : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。