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

HcnQueryLoadBalancerProperties

関数
ロードバランサーのプロパティを照会して取得する。
DLLcomputenetwork.dll呼出規約winapi

シグネチャ

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

HRESULT HcnQueryLoadBalancerProperties(
    void* LoadBalancer,
    LPCWSTR Query,
    LPWSTR* Properties,
    LPWSTR* ErrorRecord   // optional
);

パラメーター

名前方向
LoadBalancervoid*in
QueryLPCWSTRin
PropertiesLPWSTR*out
ErrorRecordLPWSTR*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcnQueryLoadBalancerProperties(
    void* LoadBalancer,
    LPCWSTR Query,
    LPWSTR* Properties,
    LPWSTR* ErrorRecord   // optional
);
[DllImport("computenetwork.dll", ExactSpelling = true)]
static extern int HcnQueryLoadBalancerProperties(
    IntPtr LoadBalancer,   // void*
    [MarshalAs(UnmanagedType.LPWStr)] string Query,   // LPCWSTR
    IntPtr Properties,   // LPWSTR* out
    IntPtr ErrorRecord   // LPWSTR* optional, out
);
<DllImport("computenetwork.dll", ExactSpelling:=True)>
Public Shared Function HcnQueryLoadBalancerProperties(
    LoadBalancer As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPWStr)> Query As String,   ' LPCWSTR
    Properties As IntPtr,   ' LPWSTR* out
    ErrorRecord As IntPtr   ' LPWSTR* optional, out
) As Integer
End Function
' LoadBalancer : void*
' Query : LPCWSTR
' Properties : LPWSTR* out
' ErrorRecord : LPWSTR* optional, out
Declare PtrSafe Function HcnQueryLoadBalancerProperties Lib "computenetwork" ( _
    ByVal LoadBalancer As LongPtr, _
    ByVal Query As LongPtr, _
    ByVal Properties As LongPtr, _
    ByVal ErrorRecord As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HcnQueryLoadBalancerProperties = ctypes.windll.computenetwork.HcnQueryLoadBalancerProperties
HcnQueryLoadBalancerProperties.restype = ctypes.c_int
HcnQueryLoadBalancerProperties.argtypes = [
    ctypes.POINTER(None),  # LoadBalancer : void*
    wintypes.LPCWSTR,  # Query : LPCWSTR
    ctypes.c_void_p,  # Properties : LPWSTR* out
    ctypes.c_void_p,  # ErrorRecord : LPWSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computenetwork.dll')
HcnQueryLoadBalancerProperties = Fiddle::Function.new(
  lib['HcnQueryLoadBalancerProperties'],
  [
    Fiddle::TYPE_VOIDP,  # LoadBalancer : void*
    Fiddle::TYPE_VOIDP,  # Query : LPCWSTR
    Fiddle::TYPE_VOIDP,  # Properties : LPWSTR* out
    Fiddle::TYPE_VOIDP,  # ErrorRecord : LPWSTR* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "computenetwork")]
extern "system" {
    fn HcnQueryLoadBalancerProperties(
        LoadBalancer: *mut (),  // void*
        Query: *const u16,  // LPCWSTR
        Properties: *mut *mut u16,  // LPWSTR* out
        ErrorRecord: *mut *mut u16  // LPWSTR* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("computenetwork.dll")]
public static extern int HcnQueryLoadBalancerProperties(IntPtr LoadBalancer, [MarshalAs(UnmanagedType.LPWStr)] string Query, IntPtr Properties, IntPtr ErrorRecord);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computenetwork_HcnQueryLoadBalancerProperties' -Namespace Win32 -PassThru
# $api::HcnQueryLoadBalancerProperties(LoadBalancer, Query, Properties, ErrorRecord)
#uselib "computenetwork.dll"
#func global HcnQueryLoadBalancerProperties "HcnQueryLoadBalancerProperties" sptr, sptr, sptr, sptr
; HcnQueryLoadBalancerProperties LoadBalancer, Query, varptr(Properties), varptr(ErrorRecord)   ; 戻り値は stat
; LoadBalancer : void* -> "sptr"
; Query : LPCWSTR -> "sptr"
; Properties : LPWSTR* out -> "sptr"
; ErrorRecord : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "computenetwork.dll"
#cfunc global HcnQueryLoadBalancerProperties "HcnQueryLoadBalancerProperties" sptr, wstr, var, var
; res = HcnQueryLoadBalancerProperties(LoadBalancer, Query, Properties, ErrorRecord)
; LoadBalancer : void* -> "sptr"
; Query : LPCWSTR -> "wstr"
; Properties : LPWSTR* out -> "var"
; ErrorRecord : LPWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT HcnQueryLoadBalancerProperties(void* LoadBalancer, LPCWSTR Query, LPWSTR* Properties, LPWSTR* ErrorRecord)
#uselib "computenetwork.dll"
#cfunc global HcnQueryLoadBalancerProperties "HcnQueryLoadBalancerProperties" intptr, wstr, var, var
; res = HcnQueryLoadBalancerProperties(LoadBalancer, Query, Properties, ErrorRecord)
; LoadBalancer : void* -> "intptr"
; Query : LPCWSTR -> "wstr"
; Properties : LPWSTR* out -> "var"
; ErrorRecord : LPWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computenetwork = windows.NewLazySystemDLL("computenetwork.dll")
	procHcnQueryLoadBalancerProperties = computenetwork.NewProc("HcnQueryLoadBalancerProperties")
)

// LoadBalancer (void*), Query (LPCWSTR), Properties (LPWSTR* out), ErrorRecord (LPWSTR* optional, out)
r1, _, err := procHcnQueryLoadBalancerProperties.Call(
	uintptr(LoadBalancer),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Query))),
	uintptr(Properties),
	uintptr(ErrorRecord),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function HcnQueryLoadBalancerProperties(
  LoadBalancer: Pointer;   // void*
  Query: PWideChar;   // LPCWSTR
  Properties: PPWideChar;   // LPWSTR* out
  ErrorRecord: PPWideChar   // LPWSTR* optional, out
): Integer; stdcall;
  external 'computenetwork.dll' name 'HcnQueryLoadBalancerProperties';
result := DllCall("computenetwork\HcnQueryLoadBalancerProperties"
    , "Ptr", LoadBalancer   ; void*
    , "WStr", Query   ; LPCWSTR
    , "Ptr", Properties   ; LPWSTR* out
    , "Ptr", ErrorRecord   ; LPWSTR* optional, out
    , "Int")   ; return: HRESULT
●HcnQueryLoadBalancerProperties(LoadBalancer, Query, Properties, ErrorRecord) = DLL("computenetwork.dll", "int HcnQueryLoadBalancerProperties(void*, char*, void*, void*)")
# 呼び出し: HcnQueryLoadBalancerProperties(LoadBalancer, Query, Properties, ErrorRecord)
# LoadBalancer : void* -> "void*"
# Query : LPCWSTR -> "char*"
# Properties : LPWSTR* out -> "void*"
# ErrorRecord : LPWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。