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

ReportIScsiSendTargetPortalsExA

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

シグネチャ

// ISCSIDSC.dll  (ANSI / -A)
#include <windows.h>

DWORD ReportIScsiSendTargetPortalsExA(
    DWORD* PortalCount,
    DWORD* PortalInfoSize,
    ISCSI_TARGET_PORTAL_INFO_EXA* PortalInfo
);

パラメーター

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

戻り値の型: DWORD

各言語での呼び出し定義

// ISCSIDSC.dll  (ANSI / -A)
#include <windows.h>

DWORD ReportIScsiSendTargetPortalsExA(
    DWORD* PortalCount,
    DWORD* PortalInfoSize,
    ISCSI_TARGET_PORTAL_INFO_EXA* PortalInfo
);
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint ReportIScsiSendTargetPortalsExA(
    ref uint PortalCount,   // DWORD* in/out
    ref uint PortalInfoSize,   // DWORD* in/out
    IntPtr PortalInfo   // ISCSI_TARGET_PORTAL_INFO_EXA* in/out
);
<DllImport("ISCSIDSC.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function ReportIScsiSendTargetPortalsExA(
    ByRef PortalCount As UInteger,   ' DWORD* in/out
    ByRef PortalInfoSize As UInteger,   ' DWORD* in/out
    PortalInfo As IntPtr   ' ISCSI_TARGET_PORTAL_INFO_EXA* in/out
) As UInteger
End Function
' PortalCount : DWORD* in/out
' PortalInfoSize : DWORD* in/out
' PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out
Declare PtrSafe Function ReportIScsiSendTargetPortalsExA Lib "iscsidsc" ( _
    ByRef PortalCount As Long, _
    ByRef PortalInfoSize As Long, _
    ByVal PortalInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ReportIScsiSendTargetPortalsExA = ctypes.windll.iscsidsc.ReportIScsiSendTargetPortalsExA
ReportIScsiSendTargetPortalsExA.restype = wintypes.DWORD
ReportIScsiSendTargetPortalsExA.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_EXA* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	iscsidsc = windows.NewLazySystemDLL("ISCSIDSC.dll")
	procReportIScsiSendTargetPortalsExA = iscsidsc.NewProc("ReportIScsiSendTargetPortalsExA")
)

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

extern "iscsidsc" fn ReportIScsiSendTargetPortalsExA(
    PortalCount: [*c]u32, // DWORD* in/out
    PortalInfoSize: [*c]u32, // DWORD* in/out
    PortalInfo: [*c]ISCSI_TARGET_PORTAL_INFO_EXA // ISCSI_TARGET_PORTAL_INFO_EXA* in/out
) callconv(std.os.windows.WINAPI) u32;
proc ReportIScsiSendTargetPortalsExA(
    PortalCount: ptr uint32,  # DWORD* in/out
    PortalInfoSize: ptr uint32,  # DWORD* in/out
    PortalInfo: ptr ISCSI_TARGET_PORTAL_INFO_EXA  # ISCSI_TARGET_PORTAL_INFO_EXA* in/out
): uint32 {.importc: "ReportIScsiSendTargetPortalsExA", stdcall, dynlib: "ISCSIDSC.dll".}
pragma(lib, "iscsidsc");
extern(Windows)
uint ReportIScsiSendTargetPortalsExA(
    uint* PortalCount,   // DWORD* in/out
    uint* PortalInfoSize,   // DWORD* in/out
    ISCSI_TARGET_PORTAL_INFO_EXA* PortalInfo   // ISCSI_TARGET_PORTAL_INFO_EXA* in/out
);
ccall((:ReportIScsiSendTargetPortalsExA, "ISCSIDSC.dll"), stdcall, UInt32,
      (Ptr{UInt32}, Ptr{UInt32}, Ptr{ISCSI_TARGET_PORTAL_INFO_EXA}),
      PortalCount, PortalInfoSize, PortalInfo)
# PortalCount : DWORD* in/out -> Ptr{UInt32}
# PortalInfoSize : DWORD* in/out -> Ptr{UInt32}
# PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out -> Ptr{ISCSI_TARGET_PORTAL_INFO_EXA}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ReportIScsiSendTargetPortalsExA(
    uint32_t* PortalCount,
    uint32_t* PortalInfoSize,
    void* PortalInfo);
]]
local iscsidsc = ffi.load("iscsidsc")
-- iscsidsc.ReportIScsiSendTargetPortalsExA(PortalCount, PortalInfoSize, PortalInfo)
-- PortalCount : DWORD* in/out
-- PortalInfoSize : DWORD* in/out
-- PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('ISCSIDSC.dll');
const ReportIScsiSendTargetPortalsExA = lib.func('__stdcall', 'ReportIScsiSendTargetPortalsExA', 'uint32_t', ['uint32_t *', 'uint32_t *', 'void *']);
// ReportIScsiSendTargetPortalsExA(PortalCount, PortalInfoSize, PortalInfo)
// PortalCount : DWORD* in/out -> 'uint32_t *'
// PortalInfoSize : DWORD* in/out -> 'uint32_t *'
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ISCSIDSC.dll", {
  ReportIScsiSendTargetPortalsExA: { parameters: ["pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ReportIScsiSendTargetPortalsExA(PortalCount, PortalInfoSize, PortalInfo)
// PortalCount : DWORD* in/out -> "pointer"
// PortalInfoSize : DWORD* in/out -> "pointer"
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ReportIScsiSendTargetPortalsExA(
    uint32_t* PortalCount,
    uint32_t* PortalInfoSize,
    void* PortalInfo);
C, "ISCSIDSC.dll");
// $ffi->ReportIScsiSendTargetPortalsExA(PortalCount, PortalInfoSize, PortalInfo);
// PortalCount : DWORD* in/out
// PortalInfoSize : DWORD* in/out
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* 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.ASCII_OPTIONS);
    int ReportIScsiSendTargetPortalsExA(
        IntByReference PortalCount,   // DWORD* in/out
        IntByReference PortalInfoSize,   // DWORD* in/out
        Pointer PortalInfo   // ISCSI_TARGET_PORTAL_INFO_EXA* in/out
    );
}
@[Link("iscsidsc")]
lib LibISCSIDSC
  fun ReportIScsiSendTargetPortalsExA = ReportIScsiSendTargetPortalsExA(
    PortalCount : UInt32*,   # DWORD* in/out
    PortalInfoSize : UInt32*,   # DWORD* in/out
    PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA*   # ISCSI_TARGET_PORTAL_INFO_EXA* 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 ReportIScsiSendTargetPortalsExANative = Uint32 Function(Pointer<Uint32>, Pointer<Uint32>, Pointer<Void>);
typedef ReportIScsiSendTargetPortalsExADart = int Function(Pointer<Uint32>, Pointer<Uint32>, Pointer<Void>);
final ReportIScsiSendTargetPortalsExA = DynamicLibrary.open('ISCSIDSC.dll')
    .lookupFunction<ReportIScsiSendTargetPortalsExANative, ReportIScsiSendTargetPortalsExADart>('ReportIScsiSendTargetPortalsExA');
// PortalCount : DWORD* in/out -> Pointer<Uint32>
// PortalInfoSize : DWORD* in/out -> Pointer<Uint32>
// PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ReportIScsiSendTargetPortalsExA(
  PortalCount: Pointer;   // DWORD* in/out
  PortalInfoSize: Pointer;   // DWORD* in/out
  PortalInfo: Pointer   // ISCSI_TARGET_PORTAL_INFO_EXA* in/out
): DWORD; stdcall;
  external 'ISCSIDSC.dll' name 'ReportIScsiSendTargetPortalsExA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let reportiscsisendtargetportalsexa =
  foreign "ReportIScsiSendTargetPortalsExA"
    ((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_EXA* 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 ("ReportIScsiSendTargetPortalsExA" report-iscsi-send-target-portals-ex-a :convention :stdcall) :uint32
  (portal-count :pointer)   ; DWORD* in/out
  (portal-info-size :pointer)   ; DWORD* in/out
  (portal-info :pointer))   ; ISCSI_TARGET_PORTAL_INFO_EXA* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ReportIScsiSendTargetPortalsExA = Win32::API::More->new('ISCSIDSC',
    'DWORD ReportIScsiSendTargetPortalsExA(LPVOID PortalCount, LPVOID PortalInfoSize, LPVOID PortalInfo)');
# my $ret = $ReportIScsiSendTargetPortalsExA->Call($PortalCount, $PortalInfoSize, $PortalInfo);
# PortalCount : DWORD* in/out -> LPVOID
# PortalInfoSize : DWORD* in/out -> LPVOID
# PortalInfo : ISCSI_TARGET_PORTAL_INFO_EXA* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

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