ホーム › Storage.FileSystem › CreateTapePartition
CreateTapePartition
関数テープにパーティションを再構成して作成する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
DWORD CreateTapePartition(
HANDLE hDevice,
CREATE_TAPE_PARTITION_METHOD dwPartitionMethod,
DWORD dwCount,
DWORD dwSize
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hDevice | HANDLE | in |
| dwPartitionMethod | CREATE_TAPE_PARTITION_METHOD | in |
| dwCount | DWORD | in |
| dwSize | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
DWORD CreateTapePartition(
HANDLE hDevice,
CREATE_TAPE_PARTITION_METHOD dwPartitionMethod,
DWORD dwCount,
DWORD dwSize
);[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern uint CreateTapePartition(
IntPtr hDevice, // HANDLE
uint dwPartitionMethod, // CREATE_TAPE_PARTITION_METHOD
uint dwCount, // DWORD
uint dwSize // DWORD
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function CreateTapePartition(
hDevice As IntPtr, ' HANDLE
dwPartitionMethod As UInteger, ' CREATE_TAPE_PARTITION_METHOD
dwCount As UInteger, ' DWORD
dwSize As UInteger ' DWORD
) As UInteger
End Function' hDevice : HANDLE
' dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD
' dwCount : DWORD
' dwSize : DWORD
Declare PtrSafe Function CreateTapePartition Lib "kernel32" ( _
ByVal hDevice As LongPtr, _
ByVal dwPartitionMethod As Long, _
ByVal dwCount As Long, _
ByVal dwSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateTapePartition = ctypes.windll.kernel32.CreateTapePartition
CreateTapePartition.restype = wintypes.DWORD
CreateTapePartition.argtypes = [
wintypes.HANDLE, # hDevice : HANDLE
wintypes.DWORD, # dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD
wintypes.DWORD, # dwCount : DWORD
wintypes.DWORD, # dwSize : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
CreateTapePartition = Fiddle::Function.new(
lib['CreateTapePartition'],
[
Fiddle::TYPE_VOIDP, # hDevice : HANDLE
-Fiddle::TYPE_INT, # dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD
-Fiddle::TYPE_INT, # dwCount : DWORD
-Fiddle::TYPE_INT, # dwSize : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn CreateTapePartition(
hDevice: *mut core::ffi::c_void, // HANDLE
dwPartitionMethod: u32, // CREATE_TAPE_PARTITION_METHOD
dwCount: u32, // DWORD
dwSize: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll")]
public static extern uint CreateTapePartition(IntPtr hDevice, uint dwPartitionMethod, uint dwCount, uint dwSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_CreateTapePartition' -Namespace Win32 -PassThru
# $api::CreateTapePartition(hDevice, dwPartitionMethod, dwCount, dwSize)#uselib "KERNEL32.dll"
#func global CreateTapePartition "CreateTapePartition" sptr, sptr, sptr, sptr
; CreateTapePartition hDevice, dwPartitionMethod, dwCount, dwSize ; 戻り値は stat
; hDevice : HANDLE -> "sptr"
; dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD -> "sptr"
; dwCount : DWORD -> "sptr"
; dwSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global CreateTapePartition "CreateTapePartition" sptr, int, int, int
; res = CreateTapePartition(hDevice, dwPartitionMethod, dwCount, dwSize)
; hDevice : HANDLE -> "sptr"
; dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD -> "int"
; dwCount : DWORD -> "int"
; dwSize : DWORD -> "int"; DWORD CreateTapePartition(HANDLE hDevice, CREATE_TAPE_PARTITION_METHOD dwPartitionMethod, DWORD dwCount, DWORD dwSize)
#uselib "KERNEL32.dll"
#cfunc global CreateTapePartition "CreateTapePartition" intptr, int, int, int
; res = CreateTapePartition(hDevice, dwPartitionMethod, dwCount, dwSize)
; hDevice : HANDLE -> "intptr"
; dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD -> "int"
; dwCount : DWORD -> "int"
; dwSize : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procCreateTapePartition = kernel32.NewProc("CreateTapePartition")
)
// hDevice (HANDLE), dwPartitionMethod (CREATE_TAPE_PARTITION_METHOD), dwCount (DWORD), dwSize (DWORD)
r1, _, err := procCreateTapePartition.Call(
uintptr(hDevice),
uintptr(dwPartitionMethod),
uintptr(dwCount),
uintptr(dwSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction CreateTapePartition(
hDevice: THandle; // HANDLE
dwPartitionMethod: DWORD; // CREATE_TAPE_PARTITION_METHOD
dwCount: DWORD; // DWORD
dwSize: DWORD // DWORD
): DWORD; stdcall;
external 'KERNEL32.dll' name 'CreateTapePartition';result := DllCall("KERNEL32\CreateTapePartition"
, "Ptr", hDevice ; HANDLE
, "UInt", dwPartitionMethod ; CREATE_TAPE_PARTITION_METHOD
, "UInt", dwCount ; DWORD
, "UInt", dwSize ; DWORD
, "UInt") ; return: DWORD●CreateTapePartition(hDevice, dwPartitionMethod, dwCount, dwSize) = DLL("KERNEL32.dll", "dword CreateTapePartition(void*, dword, dword, dword)")
# 呼び出し: CreateTapePartition(hDevice, dwPartitionMethod, dwCount, dwSize)
# hDevice : HANDLE -> "void*"
# dwPartitionMethod : CREATE_TAPE_PARTITION_METHOD -> "dword"
# dwCount : DWORD -> "dword"
# dwSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。