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

STI_WIA_DEVICE_INFORMATIONW

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のサイズをバイト単位で示すDWORD。
DeviceTypeDWORD4+4+4WIAデバイスの種別を示すDWORD。スキャナ/カメラ等。
szDeviceInternalNameWCHAR256+8+8デバイス内部名を保持するワイド文字配列。
DeviceCapabilitiesASTI_DEV_CAPS4+264+264デバイスの能力情報を保持するSTI_DEV_CAPS。
dwHardwareConfigurationDWORD4+268+268ハードウェア構成を示すDWORD。接続種別等。
pszVendorDescriptionLPWSTR8/4+272+272ベンダ説明文字列を指すワイド文字列。
pszDeviceDescriptionLPWSTR8/4+280+276デバイス説明文字列を指すワイド文字列。
pszPortNameLPWSTR8/4+288+280デバイスが接続されているポート名を指すワイド文字列。
pszPropProviderLPWSTR8/4+296+284プロパティプロバイダ名を指すワイド文字列。
pszLocalNameLPWSTR8/4+304+288デバイスのローカル名を指すワイド文字列。
pszUiDllLPWSTR8/4+312+292デバイス固有UIを提供するDLL名を指すワイド文字列。
pszServerLPWSTR8/4+320+296デバイスを管理するサーバ名を指すワイド文字列。

各言語での定義

#include <windows.h>

// STI_DEV_CAPS  (x64 4 / x86 4 バイト)
typedef struct STI_DEV_CAPS {
    DWORD dwGeneric;
} STI_DEV_CAPS;

// STI_WIA_DEVICE_INFORMATIONW  (x64 328 / x86 300 バイト)
typedef struct STI_WIA_DEVICE_INFORMATIONW {
    DWORD dwSize;
    DWORD DeviceType;
    WCHAR szDeviceInternalName[128];
    STI_DEV_CAPS DeviceCapabilitiesA;
    DWORD dwHardwareConfiguration;
    LPWSTR pszVendorDescription;
    LPWSTR pszDeviceDescription;
    LPWSTR pszPortName;
    LPWSTR pszPropProvider;
    LPWSTR pszLocalName;
    LPWSTR pszUiDll;
    LPWSTR pszServer;
} STI_WIA_DEVICE_INFORMATIONW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STI_DEV_CAPS
{
    public uint dwGeneric;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STI_WIA_DEVICE_INFORMATIONW
{
    public uint dwSize;
    public uint DeviceType;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szDeviceInternalName;
    public STI_DEV_CAPS DeviceCapabilitiesA;
    public uint dwHardwareConfiguration;
    public IntPtr pszVendorDescription;
    public IntPtr pszDeviceDescription;
    public IntPtr pszPortName;
    public IntPtr pszPropProvider;
    public IntPtr pszLocalName;
    public IntPtr pszUiDll;
    public IntPtr pszServer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STI_DEV_CAPS
    Public dwGeneric As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STI_WIA_DEVICE_INFORMATIONW
    Public dwSize As UInteger
    Public DeviceType As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public szDeviceInternalName As String
    Public DeviceCapabilitiesA As STI_DEV_CAPS
    Public dwHardwareConfiguration As UInteger
    Public pszVendorDescription As IntPtr
    Public pszDeviceDescription As IntPtr
    Public pszPortName As IntPtr
    Public pszPropProvider As IntPtr
    Public pszLocalName As IntPtr
    Public pszUiDll As IntPtr
    Public pszServer As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class STI_DEV_CAPS(ctypes.Structure):
    _fields_ = [
        ("dwGeneric", wintypes.DWORD),
    ]

class STI_WIA_DEVICE_INFORMATIONW(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("DeviceType", wintypes.DWORD),
        ("szDeviceInternalName", ctypes.c_wchar * 128),
        ("DeviceCapabilitiesA", STI_DEV_CAPS),
        ("dwHardwareConfiguration", wintypes.DWORD),
        ("pszVendorDescription", ctypes.c_void_p),
        ("pszDeviceDescription", ctypes.c_void_p),
        ("pszPortName", ctypes.c_void_p),
        ("pszPropProvider", ctypes.c_void_p),
        ("pszLocalName", ctypes.c_void_p),
        ("pszUiDll", ctypes.c_void_p),
        ("pszServer", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct STI_DEV_CAPS {
    pub dwGeneric: u32,
}

#[repr(C)]
pub struct STI_WIA_DEVICE_INFORMATIONW {
    pub dwSize: u32,
    pub DeviceType: u32,
    pub szDeviceInternalName: [u16; 128],
    pub DeviceCapabilitiesA: STI_DEV_CAPS,
    pub dwHardwareConfiguration: u32,
    pub pszVendorDescription: *mut core::ffi::c_void,
    pub pszDeviceDescription: *mut core::ffi::c_void,
    pub pszPortName: *mut core::ffi::c_void,
    pub pszPropProvider: *mut core::ffi::c_void,
    pub pszLocalName: *mut core::ffi::c_void,
    pub pszUiDll: *mut core::ffi::c_void,
    pub pszServer: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type STI_DEV_CAPS struct {
	dwGeneric uint32
}

type STI_WIA_DEVICE_INFORMATIONW struct {
	dwSize uint32
	DeviceType uint32
	szDeviceInternalName [128]uint16
	DeviceCapabilitiesA STI_DEV_CAPS
	dwHardwareConfiguration uint32
	pszVendorDescription uintptr
	pszDeviceDescription uintptr
	pszPortName uintptr
	pszPropProvider uintptr
	pszLocalName uintptr
	pszUiDll uintptr
	pszServer uintptr
}
type
  STI_DEV_CAPS = record
    dwGeneric: DWORD;
  end;

  STI_WIA_DEVICE_INFORMATIONW = record
    dwSize: DWORD;
    DeviceType: DWORD;
    szDeviceInternalName: array[0..127] of WideChar;
    DeviceCapabilitiesA: STI_DEV_CAPS;
    dwHardwareConfiguration: DWORD;
    pszVendorDescription: Pointer;
    pszDeviceDescription: Pointer;
    pszPortName: Pointer;
    pszPropProvider: Pointer;
    pszLocalName: Pointer;
    pszUiDll: Pointer;
    pszServer: Pointer;
  end;
const STI_DEV_CAPS = extern struct {
    dwGeneric: u32,
};

const STI_WIA_DEVICE_INFORMATIONW = extern struct {
    dwSize: u32,
    DeviceType: u32,
    szDeviceInternalName: [128]u16,
    DeviceCapabilitiesA: STI_DEV_CAPS,
    dwHardwareConfiguration: u32,
    pszVendorDescription: ?*anyopaque,
    pszDeviceDescription: ?*anyopaque,
    pszPortName: ?*anyopaque,
    pszPropProvider: ?*anyopaque,
    pszLocalName: ?*anyopaque,
    pszUiDll: ?*anyopaque,
    pszServer: ?*anyopaque,
};
type
  STI_DEV_CAPS {.bycopy.} = object
    dwGeneric: uint32

  STI_WIA_DEVICE_INFORMATIONW {.bycopy.} = object
    dwSize: uint32
    DeviceType: uint32
    szDeviceInternalName: array[128, uint16]
    DeviceCapabilitiesA: STI_DEV_CAPS
    dwHardwareConfiguration: uint32
    pszVendorDescription: pointer
    pszDeviceDescription: pointer
    pszPortName: pointer
    pszPropProvider: pointer
    pszLocalName: pointer
    pszUiDll: pointer
    pszServer: pointer
struct STI_DEV_CAPS
{
    uint dwGeneric;
}

struct STI_WIA_DEVICE_INFORMATIONW
{
    uint dwSize;
    uint DeviceType;
    wchar[128] szDeviceInternalName;
    STI_DEV_CAPS DeviceCapabilitiesA;
    uint dwHardwareConfiguration;
    void* pszVendorDescription;
    void* pszDeviceDescription;
    void* pszPortName;
    void* pszPropProvider;
    void* pszLocalName;
    void* pszUiDll;
    void* pszServer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STI_WIA_DEVICE_INFORMATIONW サイズ: 300 バイト(x86)
dim st, 75    ; 4byte整数×75(構造体サイズ 300 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DeviceType : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; szDeviceInternalName : WCHAR (+8, 256byte)  varptr(st)+8 を基点に操作(256byte:入れ子/配列)
; DeviceCapabilitiesA : STI_DEV_CAPS (+264, 4byte)  varptr(st)+264 を基点に操作(4byte:入れ子/配列)
; dwHardwareConfiguration : DWORD (+268, 4byte)  st.67 = 値  /  値 = st.67   (lpoke/lpeek も可)
; pszVendorDescription : LPWSTR (+272, 4byte)  st.68 = 値  /  値 = st.68   (lpoke/lpeek も可)
; pszDeviceDescription : LPWSTR (+276, 4byte)  st.69 = 値  /  値 = st.69   (lpoke/lpeek も可)
; pszPortName : LPWSTR (+280, 4byte)  st.70 = 値  /  値 = st.70   (lpoke/lpeek も可)
; pszPropProvider : LPWSTR (+284, 4byte)  st.71 = 値  /  値 = st.71   (lpoke/lpeek も可)
; pszLocalName : LPWSTR (+288, 4byte)  st.72 = 値  /  値 = st.72   (lpoke/lpeek も可)
; pszUiDll : LPWSTR (+292, 4byte)  st.73 = 値  /  値 = st.73   (lpoke/lpeek も可)
; pszServer : LPWSTR (+296, 4byte)  st.74 = 値  /  値 = st.74   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STI_WIA_DEVICE_INFORMATIONW サイズ: 328 バイト(x64)
dim st, 82    ; 4byte整数×82(構造体サイズ 328 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DeviceType : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; szDeviceInternalName : WCHAR (+8, 256byte)  varptr(st)+8 を基点に操作(256byte:入れ子/配列)
; DeviceCapabilitiesA : STI_DEV_CAPS (+264, 4byte)  varptr(st)+264 を基点に操作(4byte:入れ子/配列)
; dwHardwareConfiguration : DWORD (+268, 4byte)  st.67 = 値  /  値 = st.67   (lpoke/lpeek も可)
; pszVendorDescription : LPWSTR (+272, 8byte)  qpoke st,272,値 / qpeek(st,272)  ※IronHSPのみ。3.7/3.8は lpoke st,272,下位 : lpoke st,276,上位
; pszDeviceDescription : LPWSTR (+280, 8byte)  qpoke st,280,値 / qpeek(st,280)  ※IronHSPのみ。3.7/3.8は lpoke st,280,下位 : lpoke st,284,上位
; pszPortName : LPWSTR (+288, 8byte)  qpoke st,288,値 / qpeek(st,288)  ※IronHSPのみ。3.7/3.8は lpoke st,288,下位 : lpoke st,292,上位
; pszPropProvider : LPWSTR (+296, 8byte)  qpoke st,296,値 / qpeek(st,296)  ※IronHSPのみ。3.7/3.8は lpoke st,296,下位 : lpoke st,300,上位
; pszLocalName : LPWSTR (+304, 8byte)  qpoke st,304,値 / qpeek(st,304)  ※IronHSPのみ。3.7/3.8は lpoke st,304,下位 : lpoke st,308,上位
; pszUiDll : LPWSTR (+312, 8byte)  qpoke st,312,値 / qpeek(st,312)  ※IronHSPのみ。3.7/3.8は lpoke st,312,下位 : lpoke st,316,上位
; pszServer : LPWSTR (+320, 8byte)  qpoke st,320,値 / qpeek(st,320)  ※IronHSPのみ。3.7/3.8は lpoke st,320,下位 : lpoke st,324,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STI_DEV_CAPS
    #field int dwGeneric
#endstruct

#defstruct global STI_WIA_DEVICE_INFORMATIONW
    #field int dwSize
    #field int DeviceType
    #field wchar szDeviceInternalName 128
    #field STI_DEV_CAPS DeviceCapabilitiesA
    #field int dwHardwareConfiguration
    #field intptr pszVendorDescription
    #field intptr pszDeviceDescription
    #field intptr pszPortName
    #field intptr pszPropProvider
    #field intptr pszLocalName
    #field intptr pszUiDll
    #field intptr pszServer
#endstruct

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