ホーム › System.DeploymentServices › PxeDhcpAppendOptionRaw
PxeDhcpAppendOptionRaw
関数DHCP応答パケットに生バイト列のオプションを追加する。
シグネチャ
// WDSPXE.dll
#include <windows.h>
DWORD PxeDhcpAppendOptionRaw(
void* pReplyPacket,
DWORD uMaxReplyPacketLen,
DWORD* puReplyPacketLen,
WORD uBufferLen,
void* pBuffer
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pReplyPacket | void* | inout |
| uMaxReplyPacketLen | DWORD | in |
| puReplyPacketLen | DWORD* | inout |
| uBufferLen | WORD | in |
| pBuffer | void* | in |
戻り値の型: DWORD
各言語での呼び出し定義
// WDSPXE.dll
#include <windows.h>
DWORD PxeDhcpAppendOptionRaw(
void* pReplyPacket,
DWORD uMaxReplyPacketLen,
DWORD* puReplyPacketLen,
WORD uBufferLen,
void* pBuffer
);[DllImport("WDSPXE.dll", ExactSpelling = true)]
static extern uint PxeDhcpAppendOptionRaw(
IntPtr pReplyPacket, // void* in/out
uint uMaxReplyPacketLen, // DWORD
ref uint puReplyPacketLen, // DWORD* in/out
ushort uBufferLen, // WORD
IntPtr pBuffer // void*
);<DllImport("WDSPXE.dll", ExactSpelling:=True)>
Public Shared Function PxeDhcpAppendOptionRaw(
pReplyPacket As IntPtr, ' void* in/out
uMaxReplyPacketLen As UInteger, ' DWORD
ByRef puReplyPacketLen As UInteger, ' DWORD* in/out
uBufferLen As UShort, ' WORD
pBuffer As IntPtr ' void*
) As UInteger
End Function' pReplyPacket : void* in/out
' uMaxReplyPacketLen : DWORD
' puReplyPacketLen : DWORD* in/out
' uBufferLen : WORD
' pBuffer : void*
Declare PtrSafe Function PxeDhcpAppendOptionRaw Lib "wdspxe" ( _
ByVal pReplyPacket As LongPtr, _
ByVal uMaxReplyPacketLen As Long, _
ByRef puReplyPacketLen As Long, _
ByVal uBufferLen As Integer, _
ByVal pBuffer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PxeDhcpAppendOptionRaw = ctypes.windll.wdspxe.PxeDhcpAppendOptionRaw
PxeDhcpAppendOptionRaw.restype = wintypes.DWORD
PxeDhcpAppendOptionRaw.argtypes = [
ctypes.POINTER(None), # pReplyPacket : void* in/out
wintypes.DWORD, # uMaxReplyPacketLen : DWORD
ctypes.POINTER(wintypes.DWORD), # puReplyPacketLen : DWORD* in/out
ctypes.c_ushort, # uBufferLen : WORD
ctypes.POINTER(None), # pBuffer : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WDSPXE.dll')
PxeDhcpAppendOptionRaw = Fiddle::Function.new(
lib['PxeDhcpAppendOptionRaw'],
[
Fiddle::TYPE_VOIDP, # pReplyPacket : void* in/out
-Fiddle::TYPE_INT, # uMaxReplyPacketLen : DWORD
Fiddle::TYPE_VOIDP, # puReplyPacketLen : DWORD* in/out
-Fiddle::TYPE_SHORT, # uBufferLen : WORD
Fiddle::TYPE_VOIDP, # pBuffer : void*
],
-Fiddle::TYPE_INT)#[link(name = "wdspxe")]
extern "system" {
fn PxeDhcpAppendOptionRaw(
pReplyPacket: *mut (), // void* in/out
uMaxReplyPacketLen: u32, // DWORD
puReplyPacketLen: *mut u32, // DWORD* in/out
uBufferLen: u16, // WORD
pBuffer: *mut () // void*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WDSPXE.dll")]
public static extern uint PxeDhcpAppendOptionRaw(IntPtr pReplyPacket, uint uMaxReplyPacketLen, ref uint puReplyPacketLen, ushort uBufferLen, IntPtr pBuffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WDSPXE_PxeDhcpAppendOptionRaw' -Namespace Win32 -PassThru
# $api::PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, puReplyPacketLen, uBufferLen, pBuffer)#uselib "WDSPXE.dll"
#func global PxeDhcpAppendOptionRaw "PxeDhcpAppendOptionRaw" sptr, sptr, sptr, sptr, sptr
; PxeDhcpAppendOptionRaw pReplyPacket, uMaxReplyPacketLen, varptr(puReplyPacketLen), uBufferLen, pBuffer ; 戻り値は stat
; pReplyPacket : void* in/out -> "sptr"
; uMaxReplyPacketLen : DWORD -> "sptr"
; puReplyPacketLen : DWORD* in/out -> "sptr"
; uBufferLen : WORD -> "sptr"
; pBuffer : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WDSPXE.dll" #cfunc global PxeDhcpAppendOptionRaw "PxeDhcpAppendOptionRaw" sptr, int, var, int, sptr ; res = PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, puReplyPacketLen, uBufferLen, pBuffer) ; pReplyPacket : void* in/out -> "sptr" ; uMaxReplyPacketLen : DWORD -> "int" ; puReplyPacketLen : DWORD* in/out -> "var" ; uBufferLen : WORD -> "int" ; pBuffer : void* -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WDSPXE.dll" #cfunc global PxeDhcpAppendOptionRaw "PxeDhcpAppendOptionRaw" sptr, int, sptr, int, sptr ; res = PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, varptr(puReplyPacketLen), uBufferLen, pBuffer) ; pReplyPacket : void* in/out -> "sptr" ; uMaxReplyPacketLen : DWORD -> "int" ; puReplyPacketLen : DWORD* in/out -> "sptr" ; uBufferLen : WORD -> "int" ; pBuffer : void* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD PxeDhcpAppendOptionRaw(void* pReplyPacket, DWORD uMaxReplyPacketLen, DWORD* puReplyPacketLen, WORD uBufferLen, void* pBuffer) #uselib "WDSPXE.dll" #cfunc global PxeDhcpAppendOptionRaw "PxeDhcpAppendOptionRaw" intptr, int, var, int, intptr ; res = PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, puReplyPacketLen, uBufferLen, pBuffer) ; pReplyPacket : void* in/out -> "intptr" ; uMaxReplyPacketLen : DWORD -> "int" ; puReplyPacketLen : DWORD* in/out -> "var" ; uBufferLen : WORD -> "int" ; pBuffer : void* -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD PxeDhcpAppendOptionRaw(void* pReplyPacket, DWORD uMaxReplyPacketLen, DWORD* puReplyPacketLen, WORD uBufferLen, void* pBuffer) #uselib "WDSPXE.dll" #cfunc global PxeDhcpAppendOptionRaw "PxeDhcpAppendOptionRaw" intptr, int, intptr, int, intptr ; res = PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, varptr(puReplyPacketLen), uBufferLen, pBuffer) ; pReplyPacket : void* in/out -> "intptr" ; uMaxReplyPacketLen : DWORD -> "int" ; puReplyPacketLen : DWORD* in/out -> "intptr" ; uBufferLen : WORD -> "int" ; pBuffer : void* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wdspxe = windows.NewLazySystemDLL("WDSPXE.dll")
procPxeDhcpAppendOptionRaw = wdspxe.NewProc("PxeDhcpAppendOptionRaw")
)
// pReplyPacket (void* in/out), uMaxReplyPacketLen (DWORD), puReplyPacketLen (DWORD* in/out), uBufferLen (WORD), pBuffer (void*)
r1, _, err := procPxeDhcpAppendOptionRaw.Call(
uintptr(pReplyPacket),
uintptr(uMaxReplyPacketLen),
uintptr(puReplyPacketLen),
uintptr(uBufferLen),
uintptr(pBuffer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PxeDhcpAppendOptionRaw(
pReplyPacket: Pointer; // void* in/out
uMaxReplyPacketLen: DWORD; // DWORD
puReplyPacketLen: Pointer; // DWORD* in/out
uBufferLen: Word; // WORD
pBuffer: Pointer // void*
): DWORD; stdcall;
external 'WDSPXE.dll' name 'PxeDhcpAppendOptionRaw';result := DllCall("WDSPXE\PxeDhcpAppendOptionRaw"
, "Ptr", pReplyPacket ; void* in/out
, "UInt", uMaxReplyPacketLen ; DWORD
, "Ptr", puReplyPacketLen ; DWORD* in/out
, "UShort", uBufferLen ; WORD
, "Ptr", pBuffer ; void*
, "UInt") ; return: DWORD●PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, puReplyPacketLen, uBufferLen, pBuffer) = DLL("WDSPXE.dll", "dword PxeDhcpAppendOptionRaw(void*, dword, void*, int, void*)")
# 呼び出し: PxeDhcpAppendOptionRaw(pReplyPacket, uMaxReplyPacketLen, puReplyPacketLen, uBufferLen, pBuffer)
# pReplyPacket : void* in/out -> "void*"
# uMaxReplyPacketLen : DWORD -> "dword"
# puReplyPacketLen : DWORD* in/out -> "void*"
# uBufferLen : WORD -> "int"
# pBuffer : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。