ホーム › Storage.IscsiDisc › SetIScsiGroupPresharedKey
SetIScsiGroupPresharedKey
関数iSCSIグループの事前共有キーを設定する。
シグネチャ
// ISCSIDSC.dll
#include <windows.h>
DWORD SetIScsiGroupPresharedKey(
DWORD KeyLength,
BYTE* Key,
BOOLEAN Persist
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| KeyLength | DWORD | in |
| Key | BYTE* | inout |
| Persist | BOOLEAN | in |
戻り値の型: DWORD
各言語での呼び出し定義
// ISCSIDSC.dll
#include <windows.h>
DWORD SetIScsiGroupPresharedKey(
DWORD KeyLength,
BYTE* Key,
BOOLEAN Persist
);[DllImport("ISCSIDSC.dll", ExactSpelling = true)]
static extern uint SetIScsiGroupPresharedKey(
uint KeyLength, // DWORD
IntPtr Key, // BYTE* in/out
[MarshalAs(UnmanagedType.U1)] bool Persist // BOOLEAN
);<DllImport("ISCSIDSC.dll", ExactSpelling:=True)>
Public Shared Function SetIScsiGroupPresharedKey(
KeyLength As UInteger, ' DWORD
Key As IntPtr, ' BYTE* in/out
<MarshalAs(UnmanagedType.U1)> Persist As Boolean ' BOOLEAN
) As UInteger
End Function' KeyLength : DWORD
' Key : BYTE* in/out
' Persist : BOOLEAN
Declare PtrSafe Function SetIScsiGroupPresharedKey Lib "iscsidsc" ( _
ByVal KeyLength As Long, _
ByVal Key As LongPtr, _
ByVal Persist As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetIScsiGroupPresharedKey = ctypes.windll.iscsidsc.SetIScsiGroupPresharedKey
SetIScsiGroupPresharedKey.restype = wintypes.DWORD
SetIScsiGroupPresharedKey.argtypes = [
wintypes.DWORD, # KeyLength : DWORD
ctypes.POINTER(ctypes.c_ubyte), # Key : BYTE* in/out
ctypes.c_byte, # Persist : BOOLEAN
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ISCSIDSC.dll')
SetIScsiGroupPresharedKey = Fiddle::Function.new(
lib['SetIScsiGroupPresharedKey'],
[
-Fiddle::TYPE_INT, # KeyLength : DWORD
Fiddle::TYPE_VOIDP, # Key : BYTE* in/out
Fiddle::TYPE_CHAR, # Persist : BOOLEAN
],
-Fiddle::TYPE_INT)#[link(name = "iscsidsc")]
extern "system" {
fn SetIScsiGroupPresharedKey(
KeyLength: u32, // DWORD
Key: *mut u8, // BYTE* in/out
Persist: u8 // BOOLEAN
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ISCSIDSC.dll")]
public static extern uint SetIScsiGroupPresharedKey(uint KeyLength, IntPtr Key, [MarshalAs(UnmanagedType.U1)] bool Persist);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ISCSIDSC_SetIScsiGroupPresharedKey' -Namespace Win32 -PassThru
# $api::SetIScsiGroupPresharedKey(KeyLength, Key, Persist)#uselib "ISCSIDSC.dll"
#func global SetIScsiGroupPresharedKey "SetIScsiGroupPresharedKey" sptr, sptr, sptr
; SetIScsiGroupPresharedKey KeyLength, varptr(Key), Persist ; 戻り値は stat
; KeyLength : DWORD -> "sptr"
; Key : BYTE* in/out -> "sptr"
; Persist : BOOLEAN -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ISCSIDSC.dll" #cfunc global SetIScsiGroupPresharedKey "SetIScsiGroupPresharedKey" int, var, int ; res = SetIScsiGroupPresharedKey(KeyLength, Key, Persist) ; KeyLength : DWORD -> "int" ; Key : BYTE* in/out -> "var" ; Persist : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ISCSIDSC.dll" #cfunc global SetIScsiGroupPresharedKey "SetIScsiGroupPresharedKey" int, sptr, int ; res = SetIScsiGroupPresharedKey(KeyLength, varptr(Key), Persist) ; KeyLength : DWORD -> "int" ; Key : BYTE* in/out -> "sptr" ; Persist : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD SetIScsiGroupPresharedKey(DWORD KeyLength, BYTE* Key, BOOLEAN Persist) #uselib "ISCSIDSC.dll" #cfunc global SetIScsiGroupPresharedKey "SetIScsiGroupPresharedKey" int, var, int ; res = SetIScsiGroupPresharedKey(KeyLength, Key, Persist) ; KeyLength : DWORD -> "int" ; Key : BYTE* in/out -> "var" ; Persist : BOOLEAN -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD SetIScsiGroupPresharedKey(DWORD KeyLength, BYTE* Key, BOOLEAN Persist) #uselib "ISCSIDSC.dll" #cfunc global SetIScsiGroupPresharedKey "SetIScsiGroupPresharedKey" int, intptr, int ; res = SetIScsiGroupPresharedKey(KeyLength, varptr(Key), Persist) ; KeyLength : DWORD -> "int" ; Key : BYTE* in/out -> "intptr" ; Persist : BOOLEAN -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iscsidsc = windows.NewLazySystemDLL("ISCSIDSC.dll")
procSetIScsiGroupPresharedKey = iscsidsc.NewProc("SetIScsiGroupPresharedKey")
)
// KeyLength (DWORD), Key (BYTE* in/out), Persist (BOOLEAN)
r1, _, err := procSetIScsiGroupPresharedKey.Call(
uintptr(KeyLength),
uintptr(Key),
uintptr(Persist),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction SetIScsiGroupPresharedKey(
KeyLength: DWORD; // DWORD
Key: Pointer; // BYTE* in/out
Persist: ByteBool // BOOLEAN
): DWORD; stdcall;
external 'ISCSIDSC.dll' name 'SetIScsiGroupPresharedKey';result := DllCall("ISCSIDSC\SetIScsiGroupPresharedKey"
, "UInt", KeyLength ; DWORD
, "Ptr", Key ; BYTE* in/out
, "Char", Persist ; BOOLEAN
, "UInt") ; return: DWORD●SetIScsiGroupPresharedKey(KeyLength, Key, Persist) = DLL("ISCSIDSC.dll", "dword SetIScsiGroupPresharedKey(dword, void*, byte)")
# 呼び出し: SetIScsiGroupPresharedKey(KeyLength, Key, Persist)
# KeyLength : DWORD -> "dword"
# Key : BYTE* in/out -> "void*"
# Persist : BOOLEAN -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。