ホーム › Devices.ImageAcquisition › MINIDRV_TRANSFER_CONTEXT
MINIDRV_TRANSFER_CONTEXT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lSize | INT | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| lWidthInPixels | INT | 4 | +4 | +4 | 画像の幅(ピクセル)。 |
| lLines | INT | 4 | +8 | +8 | 画像の高さ(ライン数)。 |
| lDepth | INT | 4 | +12 | +12 | 1ピクセルあたりのビット数(色深度)。 |
| lXRes | INT | 4 | +16 | +16 | 水平解像度(DPI)。 |
| lYRes | INT | 4 | +20 | +20 | 垂直解像度(DPI)。 |
| lCompression | INT | 4 | +24 | +24 | 圧縮方式を示す値。 |
| guidFormatID | GUID | 16 | +28 | +28 | 転送データの形式を示すGUID。 |
| tymed | INT | 4 | +44 | +44 | データの格納媒体種別を示すTYMED値。 |
| hFile | INT_PTR | 8/4 | +48 | +48 | 転送先ファイルのハンドル。 |
| cbOffset | INT | 4 | +56 | +52 | データ部の開始オフセット(バイト)。 |
| lBufferSize | INT | 4 | +60 | +56 | 転送バッファーのバイトサイズ。 |
| lActiveBuffer | INT | 4 | +64 | +60 | 現在使用中のバッファーのインデックス。 |
| lNumBuffers | INT | 4 | +68 | +64 | 使用するバッファーの数。 |
| pBaseBuffer | BYTE* | 8/4 | +72 | +68 | バッファー領域の基底アドレスへのポインター。 |
| pTransferBuffer | BYTE* | 8/4 | +80 | +72 | 現在の転送バッファーへのポインター。 |
| bTransferDataCB | BOOL | 4 | +88 | +76 | データ転送コールバックを使用するかを示すBOOL。 |
| bClassDrvAllocBuf | BOOL | 4 | +92 | +80 | クラスドライバーがバッファーを確保したかを示すBOOL。 |
| lClientAddress | INT_PTR | 8/4 | +96 | +84 | クライアント側のアドレス値。 |
| pIWiaMiniDrvCallBack | IWiaMiniDrvCallBack* | 8/4 | +104 | +88 | ミニドライバーコールバックインターフェイスへのポインター。 |
| lImageSize | INT | 4 | +112 | +92 | 画像データ全体のバイトサイズ。 |
| lHeaderSize | INT | 4 | +116 | +96 | ヘッダー部のバイトサイズ。 |
| lItemSize | INT | 4 | +120 | +100 | アイテム全体のバイトサイズ。 |
| cbWidthInBytes | INT | 4 | +124 | +104 | 1ラインあたりのバイト数。 |
| lPage | INT | 4 | +128 | +108 | 現在処理中のページ番号。 |
| lCurIfdOffset | INT | 4 | +132 | +112 | 現在のIFD(イメージファイルディレクトリ)のオフセット。 |
| lPrevIfdOffset | INT | 4 | +136 | +116 | 直前のIFDのオフセット。 |
各言語での定義
#include <windows.h>
// MINIDRV_TRANSFER_CONTEXT (x64 144 / x86 120 バイト)
typedef struct MINIDRV_TRANSFER_CONTEXT {
INT lSize;
INT lWidthInPixels;
INT lLines;
INT lDepth;
INT lXRes;
INT lYRes;
INT lCompression;
GUID guidFormatID;
INT tymed;
INT_PTR hFile;
INT cbOffset;
INT lBufferSize;
INT lActiveBuffer;
INT lNumBuffers;
BYTE* pBaseBuffer;
BYTE* pTransferBuffer;
BOOL bTransferDataCB;
BOOL bClassDrvAllocBuf;
INT_PTR lClientAddress;
IWiaMiniDrvCallBack* pIWiaMiniDrvCallBack;
INT lImageSize;
INT lHeaderSize;
INT lItemSize;
INT cbWidthInBytes;
INT lPage;
INT lCurIfdOffset;
INT lPrevIfdOffset;
} MINIDRV_TRANSFER_CONTEXT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MINIDRV_TRANSFER_CONTEXT
{
public int lSize;
public int lWidthInPixels;
public int lLines;
public int lDepth;
public int lXRes;
public int lYRes;
public int lCompression;
public Guid guidFormatID;
public int tymed;
public IntPtr hFile;
public int cbOffset;
public int lBufferSize;
public int lActiveBuffer;
public int lNumBuffers;
public IntPtr pBaseBuffer;
public IntPtr pTransferBuffer;
[MarshalAs(UnmanagedType.Bool)] public bool bTransferDataCB;
[MarshalAs(UnmanagedType.Bool)] public bool bClassDrvAllocBuf;
public IntPtr lClientAddress;
public IntPtr pIWiaMiniDrvCallBack;
public int lImageSize;
public int lHeaderSize;
public int lItemSize;
public int cbWidthInBytes;
public int lPage;
public int lCurIfdOffset;
public int lPrevIfdOffset;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MINIDRV_TRANSFER_CONTEXT
Public lSize As Integer
Public lWidthInPixels As Integer
Public lLines As Integer
Public lDepth As Integer
Public lXRes As Integer
Public lYRes As Integer
Public lCompression As Integer
Public guidFormatID As Guid
Public tymed As Integer
Public hFile As IntPtr
Public cbOffset As Integer
Public lBufferSize As Integer
Public lActiveBuffer As Integer
Public lNumBuffers As Integer
Public pBaseBuffer As IntPtr
Public pTransferBuffer As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public bTransferDataCB As Boolean
<MarshalAs(UnmanagedType.Bool)> Public bClassDrvAllocBuf As Boolean
Public lClientAddress As IntPtr
Public pIWiaMiniDrvCallBack As IntPtr
Public lImageSize As Integer
Public lHeaderSize As Integer
Public lItemSize As Integer
Public cbWidthInBytes As Integer
Public lPage As Integer
Public lCurIfdOffset As Integer
Public lPrevIfdOffset As Integer
End Structureimport ctypes
from ctypes import wintypes
class MINIDRV_TRANSFER_CONTEXT(ctypes.Structure):
_fields_ = [
("lSize", ctypes.c_int),
("lWidthInPixels", ctypes.c_int),
("lLines", ctypes.c_int),
("lDepth", ctypes.c_int),
("lXRes", ctypes.c_int),
("lYRes", ctypes.c_int),
("lCompression", ctypes.c_int),
("guidFormatID", GUID),
("tymed", ctypes.c_int),
("hFile", ctypes.c_ssize_t),
("cbOffset", ctypes.c_int),
("lBufferSize", ctypes.c_int),
("lActiveBuffer", ctypes.c_int),
("lNumBuffers", ctypes.c_int),
("pBaseBuffer", ctypes.c_void_p),
("pTransferBuffer", ctypes.c_void_p),
("bTransferDataCB", wintypes.BOOL),
("bClassDrvAllocBuf", wintypes.BOOL),
("lClientAddress", ctypes.c_ssize_t),
("pIWiaMiniDrvCallBack", ctypes.c_void_p),
("lImageSize", ctypes.c_int),
("lHeaderSize", ctypes.c_int),
("lItemSize", ctypes.c_int),
("cbWidthInBytes", ctypes.c_int),
("lPage", ctypes.c_int),
("lCurIfdOffset", ctypes.c_int),
("lPrevIfdOffset", ctypes.c_int),
]#[repr(C)]
pub struct MINIDRV_TRANSFER_CONTEXT {
pub lSize: i32,
pub lWidthInPixels: i32,
pub lLines: i32,
pub lDepth: i32,
pub lXRes: i32,
pub lYRes: i32,
pub lCompression: i32,
pub guidFormatID: GUID,
pub tymed: i32,
pub hFile: isize,
pub cbOffset: i32,
pub lBufferSize: i32,
pub lActiveBuffer: i32,
pub lNumBuffers: i32,
pub pBaseBuffer: *mut core::ffi::c_void,
pub pTransferBuffer: *mut core::ffi::c_void,
pub bTransferDataCB: i32,
pub bClassDrvAllocBuf: i32,
pub lClientAddress: isize,
pub pIWiaMiniDrvCallBack: *mut core::ffi::c_void,
pub lImageSize: i32,
pub lHeaderSize: i32,
pub lItemSize: i32,
pub cbWidthInBytes: i32,
pub lPage: i32,
pub lCurIfdOffset: i32,
pub lPrevIfdOffset: i32,
}import "golang.org/x/sys/windows"
type MINIDRV_TRANSFER_CONTEXT struct {
lSize int32
lWidthInPixels int32
lLines int32
lDepth int32
lXRes int32
lYRes int32
lCompression int32
guidFormatID windows.GUID
tymed int32
hFile uintptr
cbOffset int32
lBufferSize int32
lActiveBuffer int32
lNumBuffers int32
pBaseBuffer uintptr
pTransferBuffer uintptr
bTransferDataCB int32
bClassDrvAllocBuf int32
lClientAddress uintptr
pIWiaMiniDrvCallBack uintptr
lImageSize int32
lHeaderSize int32
lItemSize int32
cbWidthInBytes int32
lPage int32
lCurIfdOffset int32
lPrevIfdOffset int32
}type
MINIDRV_TRANSFER_CONTEXT = record
lSize: Integer;
lWidthInPixels: Integer;
lLines: Integer;
lDepth: Integer;
lXRes: Integer;
lYRes: Integer;
lCompression: Integer;
guidFormatID: TGUID;
tymed: Integer;
hFile: NativeInt;
cbOffset: Integer;
lBufferSize: Integer;
lActiveBuffer: Integer;
lNumBuffers: Integer;
pBaseBuffer: Pointer;
pTransferBuffer: Pointer;
bTransferDataCB: BOOL;
bClassDrvAllocBuf: BOOL;
lClientAddress: NativeInt;
pIWiaMiniDrvCallBack: Pointer;
lImageSize: Integer;
lHeaderSize: Integer;
lItemSize: Integer;
cbWidthInBytes: Integer;
lPage: Integer;
lCurIfdOffset: Integer;
lPrevIfdOffset: Integer;
end;const MINIDRV_TRANSFER_CONTEXT = extern struct {
lSize: i32,
lWidthInPixels: i32,
lLines: i32,
lDepth: i32,
lXRes: i32,
lYRes: i32,
lCompression: i32,
guidFormatID: GUID,
tymed: i32,
hFile: isize,
cbOffset: i32,
lBufferSize: i32,
lActiveBuffer: i32,
lNumBuffers: i32,
pBaseBuffer: ?*anyopaque,
pTransferBuffer: ?*anyopaque,
bTransferDataCB: i32,
bClassDrvAllocBuf: i32,
lClientAddress: isize,
pIWiaMiniDrvCallBack: ?*anyopaque,
lImageSize: i32,
lHeaderSize: i32,
lItemSize: i32,
cbWidthInBytes: i32,
lPage: i32,
lCurIfdOffset: i32,
lPrevIfdOffset: i32,
};type
MINIDRV_TRANSFER_CONTEXT {.bycopy.} = object
lSize: int32
lWidthInPixels: int32
lLines: int32
lDepth: int32
lXRes: int32
lYRes: int32
lCompression: int32
guidFormatID: GUID
tymed: int32
hFile: int
cbOffset: int32
lBufferSize: int32
lActiveBuffer: int32
lNumBuffers: int32
pBaseBuffer: pointer
pTransferBuffer: pointer
bTransferDataCB: int32
bClassDrvAllocBuf: int32
lClientAddress: int
pIWiaMiniDrvCallBack: pointer
lImageSize: int32
lHeaderSize: int32
lItemSize: int32
cbWidthInBytes: int32
lPage: int32
lCurIfdOffset: int32
lPrevIfdOffset: int32struct MINIDRV_TRANSFER_CONTEXT
{
int lSize;
int lWidthInPixels;
int lLines;
int lDepth;
int lXRes;
int lYRes;
int lCompression;
GUID guidFormatID;
int tymed;
ptrdiff_t hFile;
int cbOffset;
int lBufferSize;
int lActiveBuffer;
int lNumBuffers;
void* pBaseBuffer;
void* pTransferBuffer;
int bTransferDataCB;
int bClassDrvAllocBuf;
ptrdiff_t lClientAddress;
void* pIWiaMiniDrvCallBack;
int lImageSize;
int lHeaderSize;
int lItemSize;
int cbWidthInBytes;
int lPage;
int lCurIfdOffset;
int lPrevIfdOffset;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MINIDRV_TRANSFER_CONTEXT サイズ: 120 バイト(x86)
dim st, 30 ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; lSize : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lWidthInPixels : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; lLines : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lDepth : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lXRes : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lYRes : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lCompression : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; guidFormatID : GUID (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; tymed : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; hFile : INT_PTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; cbOffset : INT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; lBufferSize : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; lActiveBuffer : INT (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; lNumBuffers : INT (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; pBaseBuffer : BYTE* (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; pTransferBuffer : BYTE* (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; bTransferDataCB : BOOL (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; bClassDrvAllocBuf : BOOL (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; lClientAddress : INT_PTR (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; pIWiaMiniDrvCallBack : IWiaMiniDrvCallBack* (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; lImageSize : INT (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; lHeaderSize : INT (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; lItemSize : INT (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; cbWidthInBytes : INT (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; lPage : INT (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; lCurIfdOffset : INT (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; lPrevIfdOffset : INT (+116, 4byte) st.29 = 値 / 値 = st.29 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MINIDRV_TRANSFER_CONTEXT サイズ: 144 バイト(x64)
dim st, 36 ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; lSize : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; lWidthInPixels : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; lLines : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lDepth : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lXRes : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lYRes : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lCompression : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; guidFormatID : GUID (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; tymed : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; hFile : INT_PTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; cbOffset : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; lBufferSize : INT (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; lActiveBuffer : INT (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; lNumBuffers : INT (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; pBaseBuffer : BYTE* (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; pTransferBuffer : BYTE* (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; bTransferDataCB : BOOL (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; bClassDrvAllocBuf : BOOL (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; lClientAddress : INT_PTR (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; pIWiaMiniDrvCallBack : IWiaMiniDrvCallBack* (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; lImageSize : INT (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; lHeaderSize : INT (+116, 4byte) st.29 = 値 / 値 = st.29 (lpoke/lpeek も可)
; lItemSize : INT (+120, 4byte) st.30 = 値 / 値 = st.30 (lpoke/lpeek も可)
; cbWidthInBytes : INT (+124, 4byte) st.31 = 値 / 値 = st.31 (lpoke/lpeek も可)
; lPage : INT (+128, 4byte) st.32 = 値 / 値 = st.32 (lpoke/lpeek も可)
; lCurIfdOffset : INT (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; lPrevIfdOffset : INT (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global MINIDRV_TRANSFER_CONTEXT
#field int lSize
#field int lWidthInPixels
#field int lLines
#field int lDepth
#field int lXRes
#field int lYRes
#field int lCompression
#field GUID guidFormatID
#field int tymed
#field intptr hFile
#field int cbOffset
#field int lBufferSize
#field int lActiveBuffer
#field int lNumBuffers
#field intptr pBaseBuffer
#field intptr pTransferBuffer
#field bool bTransferDataCB
#field bool bClassDrvAllocBuf
#field intptr lClientAddress
#field intptr pIWiaMiniDrvCallBack
#field int lImageSize
#field int lHeaderSize
#field int lItemSize
#field int cbWidthInBytes
#field int lPage
#field int lCurIfdOffset
#field int lPrevIfdOffset
#endstruct
stdim st, MINIDRV_TRANSFER_CONTEXT ; NSTRUCT 変数を確保
st->lSize = 100
mes "lSize=" + st->lSize