Win32 API 日本語リファレンス
ホームSystem.DeploymentServices › PxeSendReply

PxeSendReply

関数
PXEクライアント要求に対して応答パケットを送信する。
DLLWDSPXE.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD PxeSendReply(
    HANDLE hClientRequest,
    void* pPacket,
    DWORD uPacketLen,
    PXE_ADDRESS* pAddress
);

パラメーター

名前方向説明
hClientRequestHANDLEin応答対象のクライアント要求ハンドル。
pPacketvoid*in送信する応答パケットデータへのポインタ。
uPacketLenDWORDin応答パケットの長さ(バイト単位)。
pAddressPXE_ADDRESS*in送信先クライアントのアドレス情報を示すPXE_ADDRESS構造体。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PxeSendReply(
    HANDLE hClientRequest,
    void* pPacket,
    DWORD uPacketLen,
    PXE_ADDRESS* pAddress
);
[DllImport("WDSPXE.dll", ExactSpelling = true)]
static extern uint PxeSendReply(
    IntPtr hClientRequest,   // HANDLE
    IntPtr pPacket,   // void*
    uint uPacketLen,   // DWORD
    IntPtr pAddress   // PXE_ADDRESS*
);
<DllImport("WDSPXE.dll", ExactSpelling:=True)>
Public Shared Function PxeSendReply(
    hClientRequest As IntPtr,   ' HANDLE
    pPacket As IntPtr,   ' void*
    uPacketLen As UInteger,   ' DWORD
    pAddress As IntPtr   ' PXE_ADDRESS*
) As UInteger
End Function
' hClientRequest : HANDLE
' pPacket : void*
' uPacketLen : DWORD
' pAddress : PXE_ADDRESS*
Declare PtrSafe Function PxeSendReply Lib "wdspxe" ( _
    ByVal hClientRequest As LongPtr, _
    ByVal pPacket As LongPtr, _
    ByVal uPacketLen As Long, _
    ByVal pAddress As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PxeSendReply = ctypes.windll.wdspxe.PxeSendReply
PxeSendReply.restype = wintypes.DWORD
PxeSendReply.argtypes = [
    wintypes.HANDLE,  # hClientRequest : HANDLE
    ctypes.POINTER(None),  # pPacket : void*
    wintypes.DWORD,  # uPacketLen : DWORD
    ctypes.c_void_p,  # pAddress : PXE_ADDRESS*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wdspxe = windows.NewLazySystemDLL("WDSPXE.dll")
	procPxeSendReply = wdspxe.NewProc("PxeSendReply")
)

// hClientRequest (HANDLE), pPacket (void*), uPacketLen (DWORD), pAddress (PXE_ADDRESS*)
r1, _, err := procPxeSendReply.Call(
	uintptr(hClientRequest),
	uintptr(pPacket),
	uintptr(uPacketLen),
	uintptr(pAddress),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PxeSendReply(
  hClientRequest: THandle;   // HANDLE
  pPacket: Pointer;   // void*
  uPacketLen: DWORD;   // DWORD
  pAddress: Pointer   // PXE_ADDRESS*
): DWORD; stdcall;
  external 'WDSPXE.dll' name 'PxeSendReply';
result := DllCall("WDSPXE\PxeSendReply"
    , "Ptr", hClientRequest   ; HANDLE
    , "Ptr", pPacket   ; void*
    , "UInt", uPacketLen   ; DWORD
    , "Ptr", pAddress   ; PXE_ADDRESS*
    , "UInt")   ; return: DWORD
●PxeSendReply(hClientRequest, pPacket, uPacketLen, pAddress) = DLL("WDSPXE.dll", "dword PxeSendReply(void*, void*, dword, void*)")
# 呼び出し: PxeSendReply(hClientRequest, pPacket, uPacketLen, pAddress)
# hClientRequest : HANDLE -> "void*"
# pPacket : void* -> "void*"
# uPacketLen : DWORD -> "dword"
# pAddress : PXE_ADDRESS* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef PxeSendReplyNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Uint32, Pointer<Void>);
typedef PxeSendReplyDart = int Function(Pointer<Void>, Pointer<Void>, int, Pointer<Void>);
final PxeSendReply = DynamicLibrary.open('WDSPXE.dll')
    .lookupFunction<PxeSendReplyNative, PxeSendReplyDart>('PxeSendReply');
// hClientRequest : HANDLE -> Pointer<Void>
// pPacket : void* -> Pointer<Void>
// uPacketLen : DWORD -> Uint32
// pAddress : PXE_ADDRESS* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PxeSendReply(
  hClientRequest: THandle;   // HANDLE
  pPacket: Pointer;   // void*
  uPacketLen: DWORD;   // DWORD
  pAddress: Pointer   // PXE_ADDRESS*
): DWORD; stdcall;
  external 'WDSPXE.dll' name 'PxeSendReply';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PxeSendReply"
  c_PxeSendReply :: Ptr () -> Ptr () -> Word32 -> Ptr () -> IO Word32
-- hClientRequest : HANDLE -> Ptr ()
-- pPacket : void* -> Ptr ()
-- uPacketLen : DWORD -> Word32
-- pAddress : PXE_ADDRESS* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let pxesendreply =
  foreign "PxeSendReply"
    ((ptr void) @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning uint32_t)
(* hClientRequest : HANDLE -> (ptr void) *)
(* pPacket : void* -> (ptr void) *)
(* uPacketLen : DWORD -> uint32_t *)
(* pAddress : PXE_ADDRESS* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wdspxe (t "WDSPXE.dll"))
(cffi:use-foreign-library wdspxe)

(cffi:defcfun ("PxeSendReply" pxe-send-reply :convention :stdcall) :uint32
  (h-client-request :pointer)   ; HANDLE
  (p-packet :pointer)   ; void*
  (u-packet-len :uint32)   ; DWORD
  (p-address :pointer))   ; PXE_ADDRESS*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PxeSendReply = Win32::API::More->new('WDSPXE',
    'DWORD PxeSendReply(HANDLE hClientRequest, LPVOID pPacket, DWORD uPacketLen, LPVOID pAddress)');
# my $ret = $PxeSendReply->Call($hClientRequest, $pPacket, $uPacketLen, $pAddress);
# hClientRequest : HANDLE -> HANDLE
# pPacket : void* -> LPVOID
# uPacketLen : DWORD -> DWORD
# pAddress : PXE_ADDRESS* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型