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

RemovePersistentIScsiDeviceW

関数
永続的iSCSIデバイスの登録を削除する。
DLLISCSIDSC.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD RemovePersistentIScsiDeviceW(
    LPWSTR DevicePath
);

パラメーター

名前方向
DevicePathLPWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RemovePersistentIScsiDeviceW(
    LPWSTR DevicePath
);
[DllImport("ISCSIDSC.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint RemovePersistentIScsiDeviceW(
    [MarshalAs(UnmanagedType.LPWStr)] string DevicePath   // LPWSTR
);
<DllImport("ISCSIDSC.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RemovePersistentIScsiDeviceW(
    <MarshalAs(UnmanagedType.LPWStr)> DevicePath As String   ' LPWSTR
) As UInteger
End Function
' DevicePath : LPWSTR
Declare PtrSafe Function RemovePersistentIScsiDeviceW Lib "iscsidsc" ( _
    ByVal DevicePath 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

RemovePersistentIScsiDeviceW = ctypes.windll.iscsidsc.RemovePersistentIScsiDeviceW
RemovePersistentIScsiDeviceW.restype = wintypes.DWORD
RemovePersistentIScsiDeviceW.argtypes = [
    wintypes.LPCWSTR,  # DevicePath : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	iscsidsc = windows.NewLazySystemDLL("ISCSIDSC.dll")
	procRemovePersistentIScsiDeviceW = iscsidsc.NewProc("RemovePersistentIScsiDeviceW")
)

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