ホーム › Storage.IscsiDisc › GetIScsiTargetInformationW
GetIScsiTargetInformationW
関数指定iSCSIターゲットの情報を取得する。
シグネチャ
// ISCSIDSC.dll (Unicode / -W)
#include <windows.h>
DWORD GetIScsiTargetInformationW(
LPWSTR TargetName,
LPWSTR DiscoveryMechanism, // optional
TARGET_INFORMATION_CLASS InfoClass,
DWORD* BufferSize,
void* Buffer
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| TargetName | LPWSTR | in |
| DiscoveryMechanism | LPWSTR | inoptional |
| InfoClass | TARGET_INFORMATION_CLASS | in |
| BufferSize | DWORD* | inout |
| Buffer | void* | inout |
戻り値の型: DWORD
各言語での呼び出し定義
// ISCSIDSC.dll (Unicode / -W)
#include <windows.h>
DWORD GetIScsiTargetInformationW(
LPWSTR TargetName,
LPWSTR DiscoveryMechanism, // optional
TARGET_INFORMATION_CLASS InfoClass,
DWORD* BufferSize,
void* Buffer
);[DllImport("ISCSIDSC.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint GetIScsiTargetInformationW(
[MarshalAs(UnmanagedType.LPWStr)] string TargetName, // LPWSTR
[MarshalAs(UnmanagedType.LPWStr)] string DiscoveryMechanism, // LPWSTR optional
int InfoClass, // TARGET_INFORMATION_CLASS
ref uint BufferSize, // DWORD* in/out
IntPtr Buffer // void* in/out
);<DllImport("ISCSIDSC.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function GetIScsiTargetInformationW(
<MarshalAs(UnmanagedType.LPWStr)> TargetName As String, ' LPWSTR
<MarshalAs(UnmanagedType.LPWStr)> DiscoveryMechanism As String, ' LPWSTR optional
InfoClass As Integer, ' TARGET_INFORMATION_CLASS
ByRef BufferSize As UInteger, ' DWORD* in/out
Buffer As IntPtr ' void* in/out
) As UInteger
End Function' TargetName : LPWSTR
' DiscoveryMechanism : LPWSTR optional
' InfoClass : TARGET_INFORMATION_CLASS
' BufferSize : DWORD* in/out
' Buffer : void* in/out
Declare PtrSafe Function GetIScsiTargetInformationW Lib "iscsidsc" ( _
ByVal TargetName As LongPtr, _
ByVal DiscoveryMechanism As LongPtr, _
ByVal InfoClass As Long, _
ByRef BufferSize As Long, _
ByVal Buffer As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetIScsiTargetInformationW = ctypes.windll.iscsidsc.GetIScsiTargetInformationW
GetIScsiTargetInformationW.restype = wintypes.DWORD
GetIScsiTargetInformationW.argtypes = [
wintypes.LPCWSTR, # TargetName : LPWSTR
wintypes.LPCWSTR, # DiscoveryMechanism : LPWSTR optional
ctypes.c_int, # InfoClass : TARGET_INFORMATION_CLASS
ctypes.POINTER(wintypes.DWORD), # BufferSize : DWORD* in/out
ctypes.POINTER(None), # Buffer : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ISCSIDSC.dll')
GetIScsiTargetInformationW = Fiddle::Function.new(
lib['GetIScsiTargetInformationW'],
[
Fiddle::TYPE_VOIDP, # TargetName : LPWSTR
Fiddle::TYPE_VOIDP, # DiscoveryMechanism : LPWSTR optional
Fiddle::TYPE_INT, # InfoClass : TARGET_INFORMATION_CLASS
Fiddle::TYPE_VOIDP, # BufferSize : DWORD* in/out
Fiddle::TYPE_VOIDP, # Buffer : void* in/out
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "iscsidsc")]
extern "system" {
fn GetIScsiTargetInformationW(
TargetName: *mut u16, // LPWSTR
DiscoveryMechanism: *mut u16, // LPWSTR optional
InfoClass: i32, // TARGET_INFORMATION_CLASS
BufferSize: *mut u32, // DWORD* in/out
Buffer: *mut () // void* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Unicode)]
public static extern uint GetIScsiTargetInformationW([MarshalAs(UnmanagedType.LPWStr)] string TargetName, [MarshalAs(UnmanagedType.LPWStr)] string DiscoveryMechanism, int InfoClass, ref uint BufferSize, IntPtr Buffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ISCSIDSC_GetIScsiTargetInformationW' -Namespace Win32 -PassThru
# $api::GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, BufferSize, Buffer)#uselib "ISCSIDSC.dll"
#func global GetIScsiTargetInformationW "GetIScsiTargetInformationW" wptr, wptr, wptr, wptr, wptr
; GetIScsiTargetInformationW TargetName, DiscoveryMechanism, InfoClass, varptr(BufferSize), Buffer ; 戻り値は stat
; TargetName : LPWSTR -> "wptr"
; DiscoveryMechanism : LPWSTR optional -> "wptr"
; InfoClass : TARGET_INFORMATION_CLASS -> "wptr"
; BufferSize : DWORD* in/out -> "wptr"
; Buffer : void* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ISCSIDSC.dll" #cfunc global GetIScsiTargetInformationW "GetIScsiTargetInformationW" wstr, wstr, int, var, sptr ; res = GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, BufferSize, Buffer) ; TargetName : LPWSTR -> "wstr" ; DiscoveryMechanism : LPWSTR optional -> "wstr" ; InfoClass : TARGET_INFORMATION_CLASS -> "int" ; BufferSize : DWORD* in/out -> "var" ; Buffer : void* in/out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ISCSIDSC.dll" #cfunc global GetIScsiTargetInformationW "GetIScsiTargetInformationW" wstr, wstr, int, sptr, sptr ; res = GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, varptr(BufferSize), Buffer) ; TargetName : LPWSTR -> "wstr" ; DiscoveryMechanism : LPWSTR optional -> "wstr" ; InfoClass : TARGET_INFORMATION_CLASS -> "int" ; BufferSize : DWORD* in/out -> "sptr" ; Buffer : void* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD GetIScsiTargetInformationW(LPWSTR TargetName, LPWSTR DiscoveryMechanism, TARGET_INFORMATION_CLASS InfoClass, DWORD* BufferSize, void* Buffer) #uselib "ISCSIDSC.dll" #cfunc global GetIScsiTargetInformationW "GetIScsiTargetInformationW" wstr, wstr, int, var, intptr ; res = GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, BufferSize, Buffer) ; TargetName : LPWSTR -> "wstr" ; DiscoveryMechanism : LPWSTR optional -> "wstr" ; InfoClass : TARGET_INFORMATION_CLASS -> "int" ; BufferSize : DWORD* in/out -> "var" ; Buffer : void* in/out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD GetIScsiTargetInformationW(LPWSTR TargetName, LPWSTR DiscoveryMechanism, TARGET_INFORMATION_CLASS InfoClass, DWORD* BufferSize, void* Buffer) #uselib "ISCSIDSC.dll" #cfunc global GetIScsiTargetInformationW "GetIScsiTargetInformationW" wstr, wstr, int, intptr, intptr ; res = GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, varptr(BufferSize), Buffer) ; TargetName : LPWSTR -> "wstr" ; DiscoveryMechanism : LPWSTR optional -> "wstr" ; InfoClass : TARGET_INFORMATION_CLASS -> "int" ; BufferSize : DWORD* in/out -> "intptr" ; Buffer : void* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iscsidsc = windows.NewLazySystemDLL("ISCSIDSC.dll")
procGetIScsiTargetInformationW = iscsidsc.NewProc("GetIScsiTargetInformationW")
)
// TargetName (LPWSTR), DiscoveryMechanism (LPWSTR optional), InfoClass (TARGET_INFORMATION_CLASS), BufferSize (DWORD* in/out), Buffer (void* in/out)
r1, _, err := procGetIScsiTargetInformationW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(TargetName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(DiscoveryMechanism))),
uintptr(InfoClass),
uintptr(BufferSize),
uintptr(Buffer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetIScsiTargetInformationW(
TargetName: PWideChar; // LPWSTR
DiscoveryMechanism: PWideChar; // LPWSTR optional
InfoClass: Integer; // TARGET_INFORMATION_CLASS
BufferSize: Pointer; // DWORD* in/out
Buffer: Pointer // void* in/out
): DWORD; stdcall;
external 'ISCSIDSC.dll' name 'GetIScsiTargetInformationW';result := DllCall("ISCSIDSC\GetIScsiTargetInformationW"
, "WStr", TargetName ; LPWSTR
, "WStr", DiscoveryMechanism ; LPWSTR optional
, "Int", InfoClass ; TARGET_INFORMATION_CLASS
, "Ptr", BufferSize ; DWORD* in/out
, "Ptr", Buffer ; void* in/out
, "UInt") ; return: DWORD●GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, BufferSize, Buffer) = DLL("ISCSIDSC.dll", "dword GetIScsiTargetInformationW(char*, char*, int, void*, void*)")
# 呼び出し: GetIScsiTargetInformationW(TargetName, DiscoveryMechanism, InfoClass, BufferSize, Buffer)
# TargetName : LPWSTR -> "char*"
# DiscoveryMechanism : LPWSTR optional -> "char*"
# InfoClass : TARGET_INFORMATION_CLASS -> "int"
# BufferSize : DWORD* in/out -> "void*"
# Buffer : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。