Win32 API 日本語リファレンス
ホームDevices.BiometricFramework › WINBIO_BDB_ANSI_381_HEADER

WINBIO_BDB_ANSI_381_HEADER

構造体
サイズx64: 40 バイト / x86: 40 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
RecordLengthULONGLONG8+0+0レコード全体のバイト数(ANSI 381形式)。
FormatIdentifierDWORD4+8+8形式識別子(マジック値)。
VersionNumberDWORD4+12+12形式のバージョン番号。
ProductIdWINBIO_REGISTERED_FORMAT4+16+16データを生成した製品の登録済み識別子。
CaptureDeviceIdWORD2+20+20キャプチャに用いたデバイスのID。
ImageAcquisitionLevelWORD2+22+22画像取得レベル(解像度等の品質水準)。
HorizontalScanResolutionWORD2+24+24水平方向のスキャン解像度(DPI)。
VerticalScanResolutionWORD2+26+26垂直方向のスキャン解像度(DPI)。
HorizontalImageResolutionWORD2+28+28水平方向の画像解像度(DPI)。
VerticalImageResolutionWORD2+30+30垂直方向の画像解像度(DPI)。
ElementCountBYTE1+32+32含まれる画像レコードの数。
ScaleUnitsBYTE1+33+33解像度の単位(インチ・センチ)を示すバイト値。
PixelDepthBYTE1+34+341ピクセルあたりのビット深度。
ImageCompressionAlgBYTE1+35+35画像の圧縮アルゴリズムを示すバイト値。
ReservedWORD2+36+36予約フィールド。

各言語での定義

#include <windows.h>

// WINBIO_REGISTERED_FORMAT  (x64 4 / x86 4 バイト)
typedef struct WINBIO_REGISTERED_FORMAT {
    WORD Owner;
    WORD Type;
} WINBIO_REGISTERED_FORMAT;

// WINBIO_BDB_ANSI_381_HEADER  (x64 40 / x86 40 バイト)
typedef struct WINBIO_BDB_ANSI_381_HEADER {
    ULONGLONG RecordLength;
    DWORD FormatIdentifier;
    DWORD VersionNumber;
    WINBIO_REGISTERED_FORMAT ProductId;
    WORD CaptureDeviceId;
    WORD ImageAcquisitionLevel;
    WORD HorizontalScanResolution;
    WORD VerticalScanResolution;
    WORD HorizontalImageResolution;
    WORD VerticalImageResolution;
    BYTE ElementCount;
    BYTE ScaleUnits;
    BYTE PixelDepth;
    BYTE ImageCompressionAlg;
    WORD Reserved;
} WINBIO_BDB_ANSI_381_HEADER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WINBIO_REGISTERED_FORMAT
{
    public ushort Owner;
    public ushort Type;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WINBIO_BDB_ANSI_381_HEADER
{
    public ulong RecordLength;
    public uint FormatIdentifier;
    public uint VersionNumber;
    public WINBIO_REGISTERED_FORMAT ProductId;
    public ushort CaptureDeviceId;
    public ushort ImageAcquisitionLevel;
    public ushort HorizontalScanResolution;
    public ushort VerticalScanResolution;
    public ushort HorizontalImageResolution;
    public ushort VerticalImageResolution;
    public byte ElementCount;
    public byte ScaleUnits;
    public byte PixelDepth;
    public byte ImageCompressionAlg;
    public ushort Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WINBIO_REGISTERED_FORMAT
    Public Owner As UShort
    Public Type As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WINBIO_BDB_ANSI_381_HEADER
    Public RecordLength As ULong
    Public FormatIdentifier As UInteger
    Public VersionNumber As UInteger
    Public ProductId As WINBIO_REGISTERED_FORMAT
    Public CaptureDeviceId As UShort
    Public ImageAcquisitionLevel As UShort
    Public HorizontalScanResolution As UShort
    Public VerticalScanResolution As UShort
    Public HorizontalImageResolution As UShort
    Public VerticalImageResolution As UShort
    Public ElementCount As Byte
    Public ScaleUnits As Byte
    Public PixelDepth As Byte
    Public ImageCompressionAlg As Byte
    Public Reserved As UShort
End Structure
import ctypes
from ctypes import wintypes

class WINBIO_REGISTERED_FORMAT(ctypes.Structure):
    _fields_ = [
        ("Owner", ctypes.c_ushort),
        ("Type", ctypes.c_ushort),
    ]

class WINBIO_BDB_ANSI_381_HEADER(ctypes.Structure):
    _fields_ = [
        ("RecordLength", ctypes.c_ulonglong),
        ("FormatIdentifier", wintypes.DWORD),
        ("VersionNumber", wintypes.DWORD),
        ("ProductId", WINBIO_REGISTERED_FORMAT),
        ("CaptureDeviceId", ctypes.c_ushort),
        ("ImageAcquisitionLevel", ctypes.c_ushort),
        ("HorizontalScanResolution", ctypes.c_ushort),
        ("VerticalScanResolution", ctypes.c_ushort),
        ("HorizontalImageResolution", ctypes.c_ushort),
        ("VerticalImageResolution", ctypes.c_ushort),
        ("ElementCount", ctypes.c_ubyte),
        ("ScaleUnits", ctypes.c_ubyte),
        ("PixelDepth", ctypes.c_ubyte),
        ("ImageCompressionAlg", ctypes.c_ubyte),
        ("Reserved", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct WINBIO_REGISTERED_FORMAT {
    pub Owner: u16,
    pub Type: u16,
}

#[repr(C)]
pub struct WINBIO_BDB_ANSI_381_HEADER {
    pub RecordLength: u64,
    pub FormatIdentifier: u32,
    pub VersionNumber: u32,
    pub ProductId: WINBIO_REGISTERED_FORMAT,
    pub CaptureDeviceId: u16,
    pub ImageAcquisitionLevel: u16,
    pub HorizontalScanResolution: u16,
    pub VerticalScanResolution: u16,
    pub HorizontalImageResolution: u16,
    pub VerticalImageResolution: u16,
    pub ElementCount: u8,
    pub ScaleUnits: u8,
    pub PixelDepth: u8,
    pub ImageCompressionAlg: u8,
    pub Reserved: u16,
}
import "golang.org/x/sys/windows"

type WINBIO_REGISTERED_FORMAT struct {
	Owner uint16
	Type uint16
}

type WINBIO_BDB_ANSI_381_HEADER struct {
	RecordLength uint64
	FormatIdentifier uint32
	VersionNumber uint32
	ProductId WINBIO_REGISTERED_FORMAT
	CaptureDeviceId uint16
	ImageAcquisitionLevel uint16
	HorizontalScanResolution uint16
	VerticalScanResolution uint16
	HorizontalImageResolution uint16
	VerticalImageResolution uint16
	ElementCount byte
	ScaleUnits byte
	PixelDepth byte
	ImageCompressionAlg byte
	Reserved uint16
}
type
  WINBIO_REGISTERED_FORMAT = record
    Owner: Word;
    Type: Word;
  end;

  WINBIO_BDB_ANSI_381_HEADER = record
    RecordLength: UInt64;
    FormatIdentifier: DWORD;
    VersionNumber: DWORD;
    ProductId: WINBIO_REGISTERED_FORMAT;
    CaptureDeviceId: Word;
    ImageAcquisitionLevel: Word;
    HorizontalScanResolution: Word;
    VerticalScanResolution: Word;
    HorizontalImageResolution: Word;
    VerticalImageResolution: Word;
    ElementCount: Byte;
    ScaleUnits: Byte;
    PixelDepth: Byte;
    ImageCompressionAlg: Byte;
    Reserved: Word;
  end;
const WINBIO_REGISTERED_FORMAT = extern struct {
    Owner: u16,
    Type: u16,
};

const WINBIO_BDB_ANSI_381_HEADER = extern struct {
    RecordLength: u64,
    FormatIdentifier: u32,
    VersionNumber: u32,
    ProductId: WINBIO_REGISTERED_FORMAT,
    CaptureDeviceId: u16,
    ImageAcquisitionLevel: u16,
    HorizontalScanResolution: u16,
    VerticalScanResolution: u16,
    HorizontalImageResolution: u16,
    VerticalImageResolution: u16,
    ElementCount: u8,
    ScaleUnits: u8,
    PixelDepth: u8,
    ImageCompressionAlg: u8,
    Reserved: u16,
};
type
  WINBIO_REGISTERED_FORMAT {.bycopy.} = object
    Owner: uint16
    Type: uint16

  WINBIO_BDB_ANSI_381_HEADER {.bycopy.} = object
    RecordLength: uint64
    FormatIdentifier: uint32
    VersionNumber: uint32
    ProductId: WINBIO_REGISTERED_FORMAT
    CaptureDeviceId: uint16
    ImageAcquisitionLevel: uint16
    HorizontalScanResolution: uint16
    VerticalScanResolution: uint16
    HorizontalImageResolution: uint16
    VerticalImageResolution: uint16
    ElementCount: uint8
    ScaleUnits: uint8
    PixelDepth: uint8
    ImageCompressionAlg: uint8
    Reserved: uint16
struct WINBIO_REGISTERED_FORMAT
{
    ushort Owner;
    ushort Type;
}

struct WINBIO_BDB_ANSI_381_HEADER
{
    ulong RecordLength;
    uint FormatIdentifier;
    uint VersionNumber;
    WINBIO_REGISTERED_FORMAT ProductId;
    ushort CaptureDeviceId;
    ushort ImageAcquisitionLevel;
    ushort HorizontalScanResolution;
    ushort VerticalScanResolution;
    ushort HorizontalImageResolution;
    ushort VerticalImageResolution;
    ubyte ElementCount;
    ubyte ScaleUnits;
    ubyte PixelDepth;
    ubyte ImageCompressionAlg;
    ushort Reserved;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINBIO_BDB_ANSI_381_HEADER サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; RecordLength : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; FormatIdentifier : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; VersionNumber : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ProductId : WINBIO_REGISTERED_FORMAT (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; CaptureDeviceId : WORD (+20, 2byte)  wpoke st,20,値  /  値 = wpeek(st,20)
; ImageAcquisitionLevel : WORD (+22, 2byte)  wpoke st,22,値  /  値 = wpeek(st,22)
; HorizontalScanResolution : WORD (+24, 2byte)  wpoke st,24,値  /  値 = wpeek(st,24)
; VerticalScanResolution : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; HorizontalImageResolution : WORD (+28, 2byte)  wpoke st,28,値  /  値 = wpeek(st,28)
; VerticalImageResolution : WORD (+30, 2byte)  wpoke st,30,値  /  値 = wpeek(st,30)
; ElementCount : BYTE (+32, 1byte)  poke st,32,値  /  値 = peek(st,32)
; ScaleUnits : BYTE (+33, 1byte)  poke st,33,値  /  値 = peek(st,33)
; PixelDepth : BYTE (+34, 1byte)  poke st,34,値  /  値 = peek(st,34)
; ImageCompressionAlg : BYTE (+35, 1byte)  poke st,35,値  /  値 = peek(st,35)
; Reserved : WORD (+36, 2byte)  wpoke st,36,値  /  値 = wpeek(st,36)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WINBIO_REGISTERED_FORMAT
    #field short Owner
    #field short Type
#endstruct

#defstruct global WINBIO_BDB_ANSI_381_HEADER
    #field int64 RecordLength
    #field int FormatIdentifier
    #field int VersionNumber
    #field WINBIO_REGISTERED_FORMAT ProductId
    #field short CaptureDeviceId
    #field short ImageAcquisitionLevel
    #field short HorizontalScanResolution
    #field short VerticalScanResolution
    #field short HorizontalImageResolution
    #field short VerticalImageResolution
    #field byte ElementCount
    #field byte ScaleUnits
    #field byte PixelDepth
    #field byte ImageCompressionAlg
    #field short Reserved
#endstruct

stdim st, WINBIO_BDB_ANSI_381_HEADER        ; NSTRUCT 変数を確保
st->RecordLength = 100
mes "RecordLength=" + st->RecordLength