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

AddPersistentIScsiDeviceA

関数
永続的に再接続するiSCSIデバイスを追加する(ANSI版)。
DLLISCSIDSC.dll文字セットANSI (-A)呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD AddPersistentIScsiDeviceA(
    LPSTR DevicePath
);

パラメーター

名前方向
DevicePathLPSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD AddPersistentIScsiDeviceA(
    LPSTR DevicePath
);
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint AddPersistentIScsiDeviceA(
    [MarshalAs(UnmanagedType.LPStr)] string DevicePath   // LPSTR
);
<DllImport("ISCSIDSC.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function AddPersistentIScsiDeviceA(
    <MarshalAs(UnmanagedType.LPStr)> DevicePath As String   ' LPSTR
) As UInteger
End Function
' DevicePath : LPSTR
Declare PtrSafe Function AddPersistentIScsiDeviceA Lib "iscsidsc" ( _
    ByVal DevicePath As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

AddPersistentIScsiDeviceA = ctypes.windll.iscsidsc.AddPersistentIScsiDeviceA
AddPersistentIScsiDeviceA.restype = wintypes.DWORD
AddPersistentIScsiDeviceA.argtypes = [
    wintypes.LPCSTR,  # DevicePath : LPSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ISCSIDSC.dll')
AddPersistentIScsiDeviceA = Fiddle::Function.new(
  lib['AddPersistentIScsiDeviceA'],
  [
    Fiddle::TYPE_VOIDP,  # DevicePath : LPSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "iscsidsc")]
extern "system" {
    fn AddPersistentIScsiDeviceA(
        DevicePath: *mut u8  // LPSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Ansi)]
public static extern uint AddPersistentIScsiDeviceA([MarshalAs(UnmanagedType.LPStr)] string DevicePath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ISCSIDSC_AddPersistentIScsiDeviceA' -Namespace Win32 -PassThru
# $api::AddPersistentIScsiDeviceA(DevicePath)
#uselib "ISCSIDSC.dll"
#func global AddPersistentIScsiDeviceA "AddPersistentIScsiDeviceA" sptr
; AddPersistentIScsiDeviceA DevicePath   ; 戻り値は stat
; DevicePath : LPSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ISCSIDSC.dll"
#cfunc global AddPersistentIScsiDeviceA "AddPersistentIScsiDeviceA" str
; res = AddPersistentIScsiDeviceA(DevicePath)
; DevicePath : LPSTR -> "str"
; DWORD AddPersistentIScsiDeviceA(LPSTR DevicePath)
#uselib "ISCSIDSC.dll"
#cfunc global AddPersistentIScsiDeviceA "AddPersistentIScsiDeviceA" str
; res = AddPersistentIScsiDeviceA(DevicePath)
; DevicePath : LPSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	iscsidsc = windows.NewLazySystemDLL("ISCSIDSC.dll")
	procAddPersistentIScsiDeviceA = iscsidsc.NewProc("AddPersistentIScsiDeviceA")
)

// DevicePath (LPSTR)
r1, _, err := procAddPersistentIScsiDeviceA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(DevicePath))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function AddPersistentIScsiDeviceA(
  DevicePath: PAnsiChar   // LPSTR
): DWORD; stdcall;
  external 'ISCSIDSC.dll' name 'AddPersistentIScsiDeviceA';
result := DllCall("ISCSIDSC\AddPersistentIScsiDeviceA"
    , "AStr", DevicePath   ; LPSTR
    , "UInt")   ; return: DWORD
●AddPersistentIScsiDeviceA(DevicePath) = DLL("ISCSIDSC.dll", "dword AddPersistentIScsiDeviceA(char*)")
# 呼び出し: AddPersistentIScsiDeviceA(DevicePath)
# DevicePath : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。