Win32 API 日本語リファレンス
ホームStorage.IscsiDisc › ReportIScsiSendTargetPortalsExW

ReportIScsiSendTargetPortalsExW

関数
iSCSI SendTargetsポータルの拡張情報一覧を報告する。
DLLISCSIDSC.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// ISCSIDSC.dll  (Unicode / -W)
#include <windows.h>

DWORD ReportIScsiSendTargetPortalsExW(
    DWORD* PortalCount,
    DWORD* PortalInfoSize,
    ISCSI_TARGET_PORTAL_INFO_EXW* PortalInfo
);

パラメーター

名前方向説明
PortalCountDWORD*inout返されたポータル数を受け取るDWORDへのポインタ。
PortalInfoSizeDWORD*inout入力でバッファサイズ、出力で必要サイズを受け取るDWORDへのポインタ。
PortalInfoISCSI_TARGET_PORTAL_INFO_EXW*inout拡張ポータル情報の配列ISCSI_TARGET_PORTAL_INFO_EXWを受け取るポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

// ISCSIDSC.dll  (Unicode / -W)
#include <windows.h>

DWORD ReportIScsiSendTargetPortalsExW(
    DWORD* PortalCount,
    DWORD* PortalInfoSize,
    ISCSI_TARGET_PORTAL_INFO_EXW* PortalInfo
);
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint ReportIScsiSendTargetPortalsExW(
    ref uint PortalCount,   // DWORD* in/out
    ref uint PortalInfoSize,   // DWORD* in/out
    IntPtr PortalInfo   // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
);
<DllImport("ISCSIDSC.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function ReportIScsiSendTargetPortalsExW(
    ByRef PortalCount As UInteger,   ' DWORD* in/out
    ByRef PortalInfoSize As UInteger,   ' DWORD* in/out
    PortalInfo As IntPtr   ' ISCSI_TARGET_PORTAL_INFO_EXW* in/out
) As UInteger
End Function
' PortalCount : DWORD* in/out
' PortalInfoSize : DWORD* in/out
' PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out
Declare PtrSafe Function ReportIScsiSendTargetPortalsExW Lib "iscsidsc" ( _
    ByRef PortalCount As Long, _
    ByRef PortalInfoSize As Long, _
    ByVal PortalInfo 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

ReportIScsiSendTargetPortalsExW = ctypes.windll.iscsidsc.ReportIScsiSendTargetPortalsExW
ReportIScsiSendTargetPortalsExW.restype = wintypes.DWORD
ReportIScsiSendTargetPortalsExW.argtypes = [
    ctypes.POINTER(wintypes.DWORD),  # PortalCount : DWORD* in/out
    ctypes.POINTER(wintypes.DWORD),  # PortalInfoSize : DWORD* in/out
    ctypes.c_void_p,  # PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ISCSIDSC.dll')
ReportIScsiSendTargetPortalsExW = Fiddle::Function.new(
  lib['ReportIScsiSendTargetPortalsExW'],
  [
    Fiddle::TYPE_VOIDP,  # PortalCount : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # PortalInfoSize : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "iscsidsc")]
extern "system" {
    fn ReportIScsiSendTargetPortalsExW(
        PortalCount: *mut u32,  // DWORD* in/out
        PortalInfoSize: *mut u32,  // DWORD* in/out
        PortalInfo: *mut ISCSI_TARGET_PORTAL_INFO_EXW  // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Unicode)]
public static extern uint ReportIScsiSendTargetPortalsExW(ref uint PortalCount, ref uint PortalInfoSize, IntPtr PortalInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ISCSIDSC_ReportIScsiSendTargetPortalsExW' -Namespace Win32 -PassThru
# $api::ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
#uselib "ISCSIDSC.dll"
#func global ReportIScsiSendTargetPortalsExW "ReportIScsiSendTargetPortalsExW" wptr, wptr, wptr
; ReportIScsiSendTargetPortalsExW varptr(PortalCount), varptr(PortalInfoSize), varptr(PortalInfo)   ; 戻り値は stat
; PortalCount : DWORD* in/out -> "wptr"
; PortalInfoSize : DWORD* in/out -> "wptr"
; PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ISCSIDSC.dll"
#cfunc global ReportIScsiSendTargetPortalsExW "ReportIScsiSendTargetPortalsExW" var, var, var
; res = ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
; PortalCount : DWORD* in/out -> "var"
; PortalInfoSize : DWORD* in/out -> "var"
; PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ReportIScsiSendTargetPortalsExW(DWORD* PortalCount, DWORD* PortalInfoSize, ISCSI_TARGET_PORTAL_INFO_EXW* PortalInfo)
#uselib "ISCSIDSC.dll"
#cfunc global ReportIScsiSendTargetPortalsExW "ReportIScsiSendTargetPortalsExW" var, var, var
; res = ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
; PortalCount : DWORD* in/out -> "var"
; PortalInfoSize : DWORD* in/out -> "var"
; PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	iscsidsc = windows.NewLazySystemDLL("ISCSIDSC.dll")
	procReportIScsiSendTargetPortalsExW = iscsidsc.NewProc("ReportIScsiSendTargetPortalsExW")
)

// PortalCount (DWORD* in/out), PortalInfoSize (DWORD* in/out), PortalInfo (ISCSI_TARGET_PORTAL_INFO_EXW* in/out)
r1, _, err := procReportIScsiSendTargetPortalsExW.Call(
	uintptr(PortalCount),
	uintptr(PortalInfoSize),
	uintptr(PortalInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ReportIScsiSendTargetPortalsExW(
  PortalCount: Pointer;   // DWORD* in/out
  PortalInfoSize: Pointer;   // DWORD* in/out
  PortalInfo: Pointer   // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
): DWORD; stdcall;
  external 'ISCSIDSC.dll' name 'ReportIScsiSendTargetPortalsExW';
result := DllCall("ISCSIDSC\ReportIScsiSendTargetPortalsExW"
    , "Ptr", PortalCount   ; DWORD* in/out
    , "Ptr", PortalInfoSize   ; DWORD* in/out
    , "Ptr", PortalInfo   ; ISCSI_TARGET_PORTAL_INFO_EXW* in/out
    , "UInt")   ; return: DWORD
●ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo) = DLL("ISCSIDSC.dll", "dword ReportIScsiSendTargetPortalsExW(void*, void*, void*)")
# 呼び出し: ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
# PortalCount : DWORD* in/out -> "void*"
# PortalInfoSize : DWORD* in/out -> "void*"
# PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "iscsidsc" fn ReportIScsiSendTargetPortalsExW(
    PortalCount: [*c]u32, // DWORD* in/out
    PortalInfoSize: [*c]u32, // DWORD* in/out
    PortalInfo: [*c]ISCSI_TARGET_PORTAL_INFO_EXW // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
) callconv(std.os.windows.WINAPI) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc ReportIScsiSendTargetPortalsExW(
    PortalCount: ptr uint32,  # DWORD* in/out
    PortalInfoSize: ptr uint32,  # DWORD* in/out
    PortalInfo: ptr ISCSI_TARGET_PORTAL_INFO_EXW  # ISCSI_TARGET_PORTAL_INFO_EXW* in/out
): uint32 {.importc: "ReportIScsiSendTargetPortalsExW", stdcall, dynlib: "ISCSIDSC.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "iscsidsc");
extern(Windows)
uint ReportIScsiSendTargetPortalsExW(
    uint* PortalCount,   // DWORD* in/out
    uint* PortalInfoSize,   // DWORD* in/out
    ISCSI_TARGET_PORTAL_INFO_EXW* PortalInfo   // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
);
ccall((:ReportIScsiSendTargetPortalsExW, "ISCSIDSC.dll"), stdcall, UInt32,
      (Ptr{UInt32}, Ptr{UInt32}, Ptr{ISCSI_TARGET_PORTAL_INFO_EXW}),
      PortalCount, PortalInfoSize, PortalInfo)
# PortalCount : DWORD* in/out -> Ptr{UInt32}
# PortalInfoSize : DWORD* in/out -> Ptr{UInt32}
# PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> Ptr{ISCSI_TARGET_PORTAL_INFO_EXW}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ReportIScsiSendTargetPortalsExW(
    uint32_t* PortalCount,
    uint32_t* PortalInfoSize,
    void* PortalInfo);
]]
local iscsidsc = ffi.load("iscsidsc")
-- iscsidsc.ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
-- PortalCount : DWORD* in/out
-- PortalInfoSize : DWORD* in/out
-- PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('ISCSIDSC.dll');
const ReportIScsiSendTargetPortalsExW = lib.func('__stdcall', 'ReportIScsiSendTargetPortalsExW', 'uint32_t', ['uint32_t *', 'uint32_t *', 'void *']);
// ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
// PortalCount : DWORD* in/out -> 'uint32_t *'
// PortalInfoSize : DWORD* in/out -> 'uint32_t *'
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ISCSIDSC.dll", {
  ReportIScsiSendTargetPortalsExW: { parameters: ["pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo)
// PortalCount : DWORD* in/out -> "pointer"
// PortalInfoSize : DWORD* in/out -> "pointer"
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ReportIScsiSendTargetPortalsExW(
    uint32_t* PortalCount,
    uint32_t* PortalInfoSize,
    void* PortalInfo);
C, "ISCSIDSC.dll");
// $ffi->ReportIScsiSendTargetPortalsExW(PortalCount, PortalInfoSize, PortalInfo);
// PortalCount : DWORD* in/out
// PortalInfoSize : DWORD* in/out
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out
// 構造体/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 Iscsidsc extends StdCallLibrary {
    Iscsidsc INSTANCE = Native.load("iscsidsc", Iscsidsc.class, W32APIOptions.UNICODE_OPTIONS);
    int ReportIScsiSendTargetPortalsExW(
        IntByReference PortalCount,   // DWORD* in/out
        IntByReference PortalInfoSize,   // DWORD* in/out
        Pointer PortalInfo   // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("iscsidsc")]
lib LibISCSIDSC
  fun ReportIScsiSendTargetPortalsExW = ReportIScsiSendTargetPortalsExW(
    PortalCount : UInt32*,   # DWORD* in/out
    PortalInfoSize : UInt32*,   # DWORD* in/out
    PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW*   # ISCSI_TARGET_PORTAL_INFO_EXW* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ReportIScsiSendTargetPortalsExWNative = Uint32 Function(Pointer<Uint32>, Pointer<Uint32>, Pointer<Void>);
typedef ReportIScsiSendTargetPortalsExWDart = int Function(Pointer<Uint32>, Pointer<Uint32>, Pointer<Void>);
final ReportIScsiSendTargetPortalsExW = DynamicLibrary.open('ISCSIDSC.dll')
    .lookupFunction<ReportIScsiSendTargetPortalsExWNative, ReportIScsiSendTargetPortalsExWDart>('ReportIScsiSendTargetPortalsExW');
// PortalCount : DWORD* in/out -> Pointer<Uint32>
// PortalInfoSize : DWORD* in/out -> Pointer<Uint32>
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ReportIScsiSendTargetPortalsExW(
  PortalCount: Pointer;   // DWORD* in/out
  PortalInfoSize: Pointer;   // DWORD* in/out
  PortalInfo: Pointer   // ISCSI_TARGET_PORTAL_INFO_EXW* in/out
): DWORD; stdcall;
  external 'ISCSIDSC.dll' name 'ReportIScsiSendTargetPortalsExW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ReportIScsiSendTargetPortalsExW"
  c_ReportIScsiSendTargetPortalsExW :: Ptr Word32 -> Ptr Word32 -> Ptr () -> IO Word32
-- PortalCount : DWORD* in/out -> Ptr Word32
-- PortalInfoSize : DWORD* in/out -> Ptr Word32
-- PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let reportiscsisendtargetportalsexw =
  foreign "ReportIScsiSendTargetPortalsExW"
    ((ptr uint32_t) @-> (ptr uint32_t) @-> (ptr void) @-> returning uint32_t)
(* PortalCount : DWORD* in/out -> (ptr uint32_t) *)
(* PortalInfoSize : DWORD* in/out -> (ptr uint32_t) *)
(* PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library iscsidsc (t "ISCSIDSC.dll"))
(cffi:use-foreign-library iscsidsc)

(cffi:defcfun ("ReportIScsiSendTargetPortalsExW" report-iscsi-send-target-portals-ex-w :convention :stdcall) :uint32
  (portal-count :pointer)   ; DWORD* in/out
  (portal-info-size :pointer)   ; DWORD* in/out
  (portal-info :pointer))   ; ISCSI_TARGET_PORTAL_INFO_EXW* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ReportIScsiSendTargetPortalsExW = Win32::API::More->new('ISCSIDSC',
    'DWORD ReportIScsiSendTargetPortalsExW(LPVOID PortalCount, LPVOID PortalInfoSize, LPVOID PortalInfo)');
# my $ret = $ReportIScsiSendTargetPortalsExW->Call($PortalCount, $PortalInfoSize, $PortalInfo);
# PortalCount : DWORD* in/out -> LPVOID
# PortalInfoSize : DWORD* in/out -> LPVOID
# PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXW* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
類似 API
使用する型