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

SetTapeParameters

関数
テープドライブやメディアのパラメータを設定する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

DWORD SetTapeParameters(
    HANDLE hDevice,
    TAPE_INFORMATION_TYPE dwOperation,
    void* lpTapeInformation
);

パラメーター

名前方向
hDeviceHANDLEin
dwOperationTAPE_INFORMATION_TYPEin
lpTapeInformationvoid*in

戻り値の型: DWORD

各言語での呼び出し定義

// KERNEL32.dll
#include <windows.h>

DWORD SetTapeParameters(
    HANDLE hDevice,
    TAPE_INFORMATION_TYPE dwOperation,
    void* lpTapeInformation
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint SetTapeParameters(
    IntPtr hDevice,   // HANDLE
    uint dwOperation,   // TAPE_INFORMATION_TYPE
    IntPtr lpTapeInformation   // void*
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function SetTapeParameters(
    hDevice As IntPtr,   ' HANDLE
    dwOperation As UInteger,   ' TAPE_INFORMATION_TYPE
    lpTapeInformation As IntPtr   ' void*
) As UInteger
End Function
' hDevice : HANDLE
' dwOperation : TAPE_INFORMATION_TYPE
' lpTapeInformation : void*
Declare PtrSafe Function SetTapeParameters Lib "kernel32" ( _
    ByVal hDevice As LongPtr, _
    ByVal dwOperation As Long, _
    ByVal lpTapeInformation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetTapeParameters = ctypes.windll.kernel32.SetTapeParameters
SetTapeParameters.restype = wintypes.DWORD
SetTapeParameters.argtypes = [
    wintypes.HANDLE,  # hDevice : HANDLE
    wintypes.DWORD,  # dwOperation : TAPE_INFORMATION_TYPE
    ctypes.POINTER(None),  # lpTapeInformation : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
SetTapeParameters = Fiddle::Function.new(
  lib['SetTapeParameters'],
  [
    Fiddle::TYPE_VOIDP,  # hDevice : HANDLE
    -Fiddle::TYPE_INT,  # dwOperation : TAPE_INFORMATION_TYPE
    Fiddle::TYPE_VOIDP,  # lpTapeInformation : void*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn SetTapeParameters(
        hDevice: *mut core::ffi::c_void,  // HANDLE
        dwOperation: u32,  // TAPE_INFORMATION_TYPE
        lpTapeInformation: *mut ()  // void*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint SetTapeParameters(IntPtr hDevice, uint dwOperation, IntPtr lpTapeInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_SetTapeParameters' -Namespace Win32 -PassThru
# $api::SetTapeParameters(hDevice, dwOperation, lpTapeInformation)
#uselib "KERNEL32.dll"
#func global SetTapeParameters "SetTapeParameters" sptr, sptr, sptr
; SetTapeParameters hDevice, dwOperation, lpTapeInformation   ; 戻り値は stat
; hDevice : HANDLE -> "sptr"
; dwOperation : TAPE_INFORMATION_TYPE -> "sptr"
; lpTapeInformation : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global SetTapeParameters "SetTapeParameters" sptr, int, sptr
; res = SetTapeParameters(hDevice, dwOperation, lpTapeInformation)
; hDevice : HANDLE -> "sptr"
; dwOperation : TAPE_INFORMATION_TYPE -> "int"
; lpTapeInformation : void* -> "sptr"
; DWORD SetTapeParameters(HANDLE hDevice, TAPE_INFORMATION_TYPE dwOperation, void* lpTapeInformation)
#uselib "KERNEL32.dll"
#cfunc global SetTapeParameters "SetTapeParameters" intptr, int, intptr
; res = SetTapeParameters(hDevice, dwOperation, lpTapeInformation)
; hDevice : HANDLE -> "intptr"
; dwOperation : TAPE_INFORMATION_TYPE -> "int"
; lpTapeInformation : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procSetTapeParameters = kernel32.NewProc("SetTapeParameters")
)

// hDevice (HANDLE), dwOperation (TAPE_INFORMATION_TYPE), lpTapeInformation (void*)
r1, _, err := procSetTapeParameters.Call(
	uintptr(hDevice),
	uintptr(dwOperation),
	uintptr(lpTapeInformation),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SetTapeParameters(
  hDevice: THandle;   // HANDLE
  dwOperation: DWORD;   // TAPE_INFORMATION_TYPE
  lpTapeInformation: Pointer   // void*
): DWORD; stdcall;
  external 'KERNEL32.dll' name 'SetTapeParameters';
result := DllCall("KERNEL32\SetTapeParameters"
    , "Ptr", hDevice   ; HANDLE
    , "UInt", dwOperation   ; TAPE_INFORMATION_TYPE
    , "Ptr", lpTapeInformation   ; void*
    , "UInt")   ; return: DWORD
●SetTapeParameters(hDevice, dwOperation, lpTapeInformation) = DLL("KERNEL32.dll", "dword SetTapeParameters(void*, dword, void*)")
# 呼び出し: SetTapeParameters(hDevice, dwOperation, lpTapeInformation)
# hDevice : HANDLE -> "void*"
# dwOperation : TAPE_INFORMATION_TYPE -> "dword"
# lpTapeInformation : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。