ホーム › System.HostComputeNetwork › HcnModifyEndpoint
HcnModifyEndpoint
関数エンドポイントの設定を変更する。
シグネチャ
// computenetwork.dll
#include <windows.h>
HRESULT HcnModifyEndpoint(
void* Endpoint,
LPCWSTR Settings,
LPWSTR* ErrorRecord // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Endpoint | void* | in |
| Settings | LPCWSTR | in |
| ErrorRecord | LPWSTR* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// computenetwork.dll
#include <windows.h>
HRESULT HcnModifyEndpoint(
void* Endpoint,
LPCWSTR Settings,
LPWSTR* ErrorRecord // optional
);[DllImport("computenetwork.dll", ExactSpelling = true)]
static extern int HcnModifyEndpoint(
IntPtr Endpoint, // void*
[MarshalAs(UnmanagedType.LPWStr)] string Settings, // LPCWSTR
IntPtr ErrorRecord // LPWSTR* optional, out
);<DllImport("computenetwork.dll", ExactSpelling:=True)>
Public Shared Function HcnModifyEndpoint(
Endpoint As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> Settings As String, ' LPCWSTR
ErrorRecord As IntPtr ' LPWSTR* optional, out
) As Integer
End Function' Endpoint : void*
' Settings : LPCWSTR
' ErrorRecord : LPWSTR* optional, out
Declare PtrSafe Function HcnModifyEndpoint Lib "computenetwork" ( _
ByVal Endpoint As LongPtr, _
ByVal Settings 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
HcnModifyEndpoint = ctypes.windll.computenetwork.HcnModifyEndpoint
HcnModifyEndpoint.restype = ctypes.c_int
HcnModifyEndpoint.argtypes = [
ctypes.POINTER(None), # Endpoint : void*
wintypes.LPCWSTR, # Settings : LPCWSTR
ctypes.c_void_p, # ErrorRecord : LPWSTR* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('computenetwork.dll')
HcnModifyEndpoint = Fiddle::Function.new(
lib['HcnModifyEndpoint'],
[
Fiddle::TYPE_VOIDP, # Endpoint : void*
Fiddle::TYPE_VOIDP, # Settings : LPCWSTR
Fiddle::TYPE_VOIDP, # ErrorRecord : LPWSTR* optional, out
],
Fiddle::TYPE_INT)#[link(name = "computenetwork")]
extern "system" {
fn HcnModifyEndpoint(
Endpoint: *mut (), // void*
Settings: *const u16, // LPCWSTR
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 HcnModifyEndpoint(IntPtr Endpoint, [MarshalAs(UnmanagedType.LPWStr)] string Settings, IntPtr ErrorRecord);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computenetwork_HcnModifyEndpoint' -Namespace Win32 -PassThru
# $api::HcnModifyEndpoint(Endpoint, Settings, ErrorRecord)#uselib "computenetwork.dll"
#func global HcnModifyEndpoint "HcnModifyEndpoint" sptr, sptr, sptr
; HcnModifyEndpoint Endpoint, Settings, varptr(ErrorRecord) ; 戻り値は stat
; Endpoint : void* -> "sptr"
; Settings : LPCWSTR -> "sptr"
; ErrorRecord : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "computenetwork.dll" #cfunc global HcnModifyEndpoint "HcnModifyEndpoint" sptr, wstr, var ; res = HcnModifyEndpoint(Endpoint, Settings, ErrorRecord) ; Endpoint : void* -> "sptr" ; Settings : LPCWSTR -> "wstr" ; ErrorRecord : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "computenetwork.dll" #cfunc global HcnModifyEndpoint "HcnModifyEndpoint" sptr, wstr, sptr ; res = HcnModifyEndpoint(Endpoint, Settings, varptr(ErrorRecord)) ; Endpoint : void* -> "sptr" ; Settings : LPCWSTR -> "wstr" ; ErrorRecord : LPWSTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HcnModifyEndpoint(void* Endpoint, LPCWSTR Settings, LPWSTR* ErrorRecord) #uselib "computenetwork.dll" #cfunc global HcnModifyEndpoint "HcnModifyEndpoint" intptr, wstr, var ; res = HcnModifyEndpoint(Endpoint, Settings, ErrorRecord) ; Endpoint : void* -> "intptr" ; Settings : LPCWSTR -> "wstr" ; ErrorRecord : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HcnModifyEndpoint(void* Endpoint, LPCWSTR Settings, LPWSTR* ErrorRecord) #uselib "computenetwork.dll" #cfunc global HcnModifyEndpoint "HcnModifyEndpoint" intptr, wstr, intptr ; res = HcnModifyEndpoint(Endpoint, Settings, varptr(ErrorRecord)) ; Endpoint : void* -> "intptr" ; Settings : LPCWSTR -> "wstr" ; ErrorRecord : LPWSTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
computenetwork = windows.NewLazySystemDLL("computenetwork.dll")
procHcnModifyEndpoint = computenetwork.NewProc("HcnModifyEndpoint")
)
// Endpoint (void*), Settings (LPCWSTR), ErrorRecord (LPWSTR* optional, out)
r1, _, err := procHcnModifyEndpoint.Call(
uintptr(Endpoint),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Settings))),
uintptr(ErrorRecord),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HcnModifyEndpoint(
Endpoint: Pointer; // void*
Settings: PWideChar; // LPCWSTR
ErrorRecord: PPWideChar // LPWSTR* optional, out
): Integer; stdcall;
external 'computenetwork.dll' name 'HcnModifyEndpoint';result := DllCall("computenetwork\HcnModifyEndpoint"
, "Ptr", Endpoint ; void*
, "WStr", Settings ; LPCWSTR
, "Ptr", ErrorRecord ; LPWSTR* optional, out
, "Int") ; return: HRESULT●HcnModifyEndpoint(Endpoint, Settings, ErrorRecord) = DLL("computenetwork.dll", "int HcnModifyEndpoint(void*, char*, void*)")
# 呼び出し: HcnModifyEndpoint(Endpoint, Settings, ErrorRecord)
# Endpoint : void* -> "void*"
# Settings : LPCWSTR -> "char*"
# ErrorRecord : LPWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。