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

PxeGetServerInfoEx

関数
WDS PXEサーバーの情報を使用バイト数付きで取得する(拡張)。
DLLWDSPXE.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD PxeGetServerInfoEx(
    DWORD uInfoType,
    void* pBuffer,
    DWORD uBufferLen,
    DWORD* puBufferUsed
);

パラメーター

名前方向
uInfoTypeDWORDin
pBuffervoid*out
uBufferLenDWORDin
puBufferUsedDWORD*out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PxeGetServerInfoEx(
    DWORD uInfoType,
    void* pBuffer,
    DWORD uBufferLen,
    DWORD* puBufferUsed
);
[DllImport("WDSPXE.dll", ExactSpelling = true)]
static extern uint PxeGetServerInfoEx(
    uint uInfoType,   // DWORD
    IntPtr pBuffer,   // void* out
    uint uBufferLen,   // DWORD
    out uint puBufferUsed   // DWORD* out
);
<DllImport("WDSPXE.dll", ExactSpelling:=True)>
Public Shared Function PxeGetServerInfoEx(
    uInfoType As UInteger,   ' DWORD
    pBuffer As IntPtr,   ' void* out
    uBufferLen As UInteger,   ' DWORD
    <Out> ByRef puBufferUsed As UInteger   ' DWORD* out
) As UInteger
End Function
' uInfoType : DWORD
' pBuffer : void* out
' uBufferLen : DWORD
' puBufferUsed : DWORD* out
Declare PtrSafe Function PxeGetServerInfoEx Lib "wdspxe" ( _
    ByVal uInfoType As Long, _
    ByVal pBuffer As LongPtr, _
    ByVal uBufferLen As Long, _
    ByRef puBufferUsed As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PxeGetServerInfoEx = ctypes.windll.wdspxe.PxeGetServerInfoEx
PxeGetServerInfoEx.restype = wintypes.DWORD
PxeGetServerInfoEx.argtypes = [
    wintypes.DWORD,  # uInfoType : DWORD
    ctypes.POINTER(None),  # pBuffer : void* out
    wintypes.DWORD,  # uBufferLen : DWORD
    ctypes.POINTER(wintypes.DWORD),  # puBufferUsed : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wdspxe = windows.NewLazySystemDLL("WDSPXE.dll")
	procPxeGetServerInfoEx = wdspxe.NewProc("PxeGetServerInfoEx")
)

// uInfoType (DWORD), pBuffer (void* out), uBufferLen (DWORD), puBufferUsed (DWORD* out)
r1, _, err := procPxeGetServerInfoEx.Call(
	uintptr(uInfoType),
	uintptr(pBuffer),
	uintptr(uBufferLen),
	uintptr(puBufferUsed),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PxeGetServerInfoEx(
  uInfoType: DWORD;   // DWORD
  pBuffer: Pointer;   // void* out
  uBufferLen: DWORD;   // DWORD
  puBufferUsed: Pointer   // DWORD* out
): DWORD; stdcall;
  external 'WDSPXE.dll' name 'PxeGetServerInfoEx';
result := DllCall("WDSPXE\PxeGetServerInfoEx"
    , "UInt", uInfoType   ; DWORD
    , "Ptr", pBuffer   ; void* out
    , "UInt", uBufferLen   ; DWORD
    , "Ptr", puBufferUsed   ; DWORD* out
    , "UInt")   ; return: DWORD
●PxeGetServerInfoEx(uInfoType, pBuffer, uBufferLen, puBufferUsed) = DLL("WDSPXE.dll", "dword PxeGetServerInfoEx(dword, void*, dword, void*)")
# 呼び出し: PxeGetServerInfoEx(uInfoType, pBuffer, uBufferLen, puBufferUsed)
# uInfoType : DWORD -> "dword"
# pBuffer : void* out -> "void*"
# uBufferLen : DWORD -> "dword"
# puBufferUsed : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。