ホーム › Storage.FileSystem › GetTapeParameters
GetTapeParameters
関数テープドライブやメディアのパラメータ情報を取得する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
DWORD GetTapeParameters(
HANDLE hDevice,
GET_TAPE_DRIVE_PARAMETERS_OPERATION dwOperation,
DWORD* lpdwSize,
void* lpTapeInformation
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hDevice | HANDLE | in |
| dwOperation | GET_TAPE_DRIVE_PARAMETERS_OPERATION | in |
| lpdwSize | DWORD* | inout |
| lpTapeInformation | void* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
DWORD GetTapeParameters(
HANDLE hDevice,
GET_TAPE_DRIVE_PARAMETERS_OPERATION dwOperation,
DWORD* lpdwSize,
void* lpTapeInformation
);[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint GetTapeParameters(
IntPtr hDevice, // HANDLE
uint dwOperation, // GET_TAPE_DRIVE_PARAMETERS_OPERATION
ref uint lpdwSize, // DWORD* in/out
IntPtr lpTapeInformation // void* out
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GetTapeParameters(
hDevice As IntPtr, ' HANDLE
dwOperation As UInteger, ' GET_TAPE_DRIVE_PARAMETERS_OPERATION
ByRef lpdwSize As UInteger, ' DWORD* in/out
lpTapeInformation As IntPtr ' void* out
) As UInteger
End Function' hDevice : HANDLE
' dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION
' lpdwSize : DWORD* in/out
' lpTapeInformation : void* out
Declare PtrSafe Function GetTapeParameters Lib "kernel32" ( _
ByVal hDevice As LongPtr, _
ByVal dwOperation As Long, _
ByRef lpdwSize 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
GetTapeParameters = ctypes.windll.kernel32.GetTapeParameters
GetTapeParameters.restype = wintypes.DWORD
GetTapeParameters.argtypes = [
wintypes.HANDLE, # hDevice : HANDLE
wintypes.DWORD, # dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION
ctypes.POINTER(wintypes.DWORD), # lpdwSize : DWORD* in/out
ctypes.POINTER(None), # lpTapeInformation : void* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetTapeParameters = Fiddle::Function.new(
lib['GetTapeParameters'],
[
Fiddle::TYPE_VOIDP, # hDevice : HANDLE
-Fiddle::TYPE_INT, # dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION
Fiddle::TYPE_VOIDP, # lpdwSize : DWORD* in/out
Fiddle::TYPE_VOIDP, # lpTapeInformation : void* out
],
-Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn GetTapeParameters(
hDevice: *mut core::ffi::c_void, // HANDLE
dwOperation: u32, // GET_TAPE_DRIVE_PARAMETERS_OPERATION
lpdwSize: *mut u32, // DWORD* in/out
lpTapeInformation: *mut () // void* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint GetTapeParameters(IntPtr hDevice, uint dwOperation, ref uint lpdwSize, IntPtr lpTapeInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetTapeParameters' -Namespace Win32 -PassThru
# $api::GetTapeParameters(hDevice, dwOperation, lpdwSize, lpTapeInformation)#uselib "KERNEL32.dll"
#func global GetTapeParameters "GetTapeParameters" sptr, sptr, sptr, sptr
; GetTapeParameters hDevice, dwOperation, varptr(lpdwSize), lpTapeInformation ; 戻り値は stat
; hDevice : HANDLE -> "sptr"
; dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION -> "sptr"
; lpdwSize : DWORD* in/out -> "sptr"
; lpTapeInformation : void* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global GetTapeParameters "GetTapeParameters" sptr, int, var, sptr ; res = GetTapeParameters(hDevice, dwOperation, lpdwSize, lpTapeInformation) ; hDevice : HANDLE -> "sptr" ; dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION -> "int" ; lpdwSize : DWORD* in/out -> "var" ; lpTapeInformation : void* out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global GetTapeParameters "GetTapeParameters" sptr, int, sptr, sptr ; res = GetTapeParameters(hDevice, dwOperation, varptr(lpdwSize), lpTapeInformation) ; hDevice : HANDLE -> "sptr" ; dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION -> "int" ; lpdwSize : DWORD* in/out -> "sptr" ; lpTapeInformation : void* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD GetTapeParameters(HANDLE hDevice, GET_TAPE_DRIVE_PARAMETERS_OPERATION dwOperation, DWORD* lpdwSize, void* lpTapeInformation) #uselib "KERNEL32.dll" #cfunc global GetTapeParameters "GetTapeParameters" intptr, int, var, intptr ; res = GetTapeParameters(hDevice, dwOperation, lpdwSize, lpTapeInformation) ; hDevice : HANDLE -> "intptr" ; dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION -> "int" ; lpdwSize : DWORD* in/out -> "var" ; lpTapeInformation : void* out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD GetTapeParameters(HANDLE hDevice, GET_TAPE_DRIVE_PARAMETERS_OPERATION dwOperation, DWORD* lpdwSize, void* lpTapeInformation) #uselib "KERNEL32.dll" #cfunc global GetTapeParameters "GetTapeParameters" intptr, int, intptr, intptr ; res = GetTapeParameters(hDevice, dwOperation, varptr(lpdwSize), lpTapeInformation) ; hDevice : HANDLE -> "intptr" ; dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION -> "int" ; lpdwSize : DWORD* in/out -> "intptr" ; lpTapeInformation : void* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetTapeParameters = kernel32.NewProc("GetTapeParameters")
)
// hDevice (HANDLE), dwOperation (GET_TAPE_DRIVE_PARAMETERS_OPERATION), lpdwSize (DWORD* in/out), lpTapeInformation (void* out)
r1, _, err := procGetTapeParameters.Call(
uintptr(hDevice),
uintptr(dwOperation),
uintptr(lpdwSize),
uintptr(lpTapeInformation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetTapeParameters(
hDevice: THandle; // HANDLE
dwOperation: DWORD; // GET_TAPE_DRIVE_PARAMETERS_OPERATION
lpdwSize: Pointer; // DWORD* in/out
lpTapeInformation: Pointer // void* out
): DWORD; stdcall;
external 'KERNEL32.dll' name 'GetTapeParameters';result := DllCall("KERNEL32\GetTapeParameters"
, "Ptr", hDevice ; HANDLE
, "UInt", dwOperation ; GET_TAPE_DRIVE_PARAMETERS_OPERATION
, "Ptr", lpdwSize ; DWORD* in/out
, "Ptr", lpTapeInformation ; void* out
, "UInt") ; return: DWORD●GetTapeParameters(hDevice, dwOperation, lpdwSize, lpTapeInformation) = DLL("KERNEL32.dll", "dword GetTapeParameters(void*, dword, void*, void*)")
# 呼び出し: GetTapeParameters(hDevice, dwOperation, lpdwSize, lpTapeInformation)
# hDevice : HANDLE -> "void*"
# dwOperation : GET_TAPE_DRIVE_PARAMETERS_OPERATION -> "dword"
# lpdwSize : DWORD* in/out -> "void*"
# lpTapeInformation : void* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。