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

PxeGetServerInfo

関数
WDS PXEサーバーの情報を取得する。
DLLWDSPXE.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD PxeGetServerInfo(
    DWORD uInfoType,
    void* pBuffer,
    DWORD uBufferLen
);

パラメーター

名前方向説明
uInfoTypeDWORDin取得するサーバー情報の種類を示すDWORD値。
pBuffervoid*out取得した情報を書き込む呼び出し側バッファ。
uBufferLenDWORDinpBufferのサイズ(バイト単位)。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

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

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

var (
	wdspxe = windows.NewLazySystemDLL("WDSPXE.dll")
	procPxeGetServerInfo = wdspxe.NewProc("PxeGetServerInfo")
)

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

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

typedef PxeGetServerInfoNative = Uint32 Function(Uint32, Pointer<Void>, Uint32);
typedef PxeGetServerInfoDart = int Function(int, Pointer<Void>, int);
final PxeGetServerInfo = DynamicLibrary.open('WDSPXE.dll')
    .lookupFunction<PxeGetServerInfoNative, PxeGetServerInfoDart>('PxeGetServerInfo');
// uInfoType : DWORD -> Uint32
// pBuffer : void* out -> Pointer<Void>
// uBufferLen : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PxeGetServerInfo(
  uInfoType: DWORD;   // DWORD
  pBuffer: Pointer;   // void* out
  uBufferLen: DWORD   // DWORD
): DWORD; stdcall;
  external 'WDSPXE.dll' name 'PxeGetServerInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PxeGetServerInfo"
  c_PxeGetServerInfo :: Word32 -> Ptr () -> Word32 -> IO Word32
-- uInfoType : DWORD -> Word32
-- pBuffer : void* out -> Ptr ()
-- uBufferLen : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let pxegetserverinfo =
  foreign "PxeGetServerInfo"
    (uint32_t @-> (ptr void) @-> uint32_t @-> returning uint32_t)
(* uInfoType : DWORD -> uint32_t *)
(* pBuffer : void* out -> (ptr void) *)
(* uBufferLen : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wdspxe (t "WDSPXE.dll"))
(cffi:use-foreign-library wdspxe)

(cffi:defcfun ("PxeGetServerInfo" pxe-get-server-info :convention :stdcall) :uint32
  (u-info-type :uint32)   ; DWORD
  (p-buffer :pointer)   ; void* out
  (u-buffer-len :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PxeGetServerInfo = Win32::API::More->new('WDSPXE',
    'DWORD PxeGetServerInfo(DWORD uInfoType, LPVOID pBuffer, DWORD uBufferLen)');
# my $ret = $PxeGetServerInfo->Call($uInfoType, $pBuffer, $uBufferLen);
# uInfoType : DWORD -> DWORD
# pBuffer : void* out -> LPVOID
# uBufferLen : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API