Win32 API 日本語リファレンス
ホームGraphics.Printing › DRIVER_INFO_5W

DRIVER_INFO_5W

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

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

フィールド

フィールドサイズx64x86説明
cVersionDWORD4+0+0ドライバのバージョン番号。
pNameLPWSTR8/4+8+4プリンタドライバ名(Unicode)へのポインタ。
pEnvironmentLPWSTR8/4+16+8ドライバの対象環境名(Unicode)。
pDriverPathLPWSTR8/4+24+12ドライバ本体ファイルのパス(Unicode)へのポインタ。
pDataFileLPWSTR8/4+32+16ドライバデータファイルのパス(Unicode)へのポインタ。
pConfigFileLPWSTR8/4+40+20構成用DLLのパス(Unicode)へのポインタ。
dwDriverAttributesDWORD4+48+24ドライバの属性を示すビットフラグ。
dwConfigVersionDWORD4+52+28構成ファイルのバージョン番号。
dwDriverVersionDWORD4+56+32ドライバファイルのバージョン番号。

各言語での定義

#include <windows.h>

// DRIVER_INFO_5W  (x64 64 / x86 36 バイト)
typedef struct DRIVER_INFO_5W {
    DWORD cVersion;
    LPWSTR pName;
    LPWSTR pEnvironment;
    LPWSTR pDriverPath;
    LPWSTR pDataFile;
    LPWSTR pConfigFile;
    DWORD dwDriverAttributes;
    DWORD dwConfigVersion;
    DWORD dwDriverVersion;
} DRIVER_INFO_5W;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DRIVER_INFO_5W
{
    public uint cVersion;
    public IntPtr pName;
    public IntPtr pEnvironment;
    public IntPtr pDriverPath;
    public IntPtr pDataFile;
    public IntPtr pConfigFile;
    public uint dwDriverAttributes;
    public uint dwConfigVersion;
    public uint dwDriverVersion;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DRIVER_INFO_5W
    Public cVersion As UInteger
    Public pName As IntPtr
    Public pEnvironment As IntPtr
    Public pDriverPath As IntPtr
    Public pDataFile As IntPtr
    Public pConfigFile As IntPtr
    Public dwDriverAttributes As UInteger
    Public dwConfigVersion As UInteger
    Public dwDriverVersion As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DRIVER_INFO_5W(ctypes.Structure):
    _fields_ = [
        ("cVersion", wintypes.DWORD),
        ("pName", ctypes.c_void_p),
        ("pEnvironment", ctypes.c_void_p),
        ("pDriverPath", ctypes.c_void_p),
        ("pDataFile", ctypes.c_void_p),
        ("pConfigFile", ctypes.c_void_p),
        ("dwDriverAttributes", wintypes.DWORD),
        ("dwConfigVersion", wintypes.DWORD),
        ("dwDriverVersion", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DRIVER_INFO_5W {
    pub cVersion: u32,
    pub pName: *mut core::ffi::c_void,
    pub pEnvironment: *mut core::ffi::c_void,
    pub pDriverPath: *mut core::ffi::c_void,
    pub pDataFile: *mut core::ffi::c_void,
    pub pConfigFile: *mut core::ffi::c_void,
    pub dwDriverAttributes: u32,
    pub dwConfigVersion: u32,
    pub dwDriverVersion: u32,
}
import "golang.org/x/sys/windows"

type DRIVER_INFO_5W struct {
	cVersion uint32
	pName uintptr
	pEnvironment uintptr
	pDriverPath uintptr
	pDataFile uintptr
	pConfigFile uintptr
	dwDriverAttributes uint32
	dwConfigVersion uint32
	dwDriverVersion uint32
}
type
  DRIVER_INFO_5W = record
    cVersion: DWORD;
    pName: Pointer;
    pEnvironment: Pointer;
    pDriverPath: Pointer;
    pDataFile: Pointer;
    pConfigFile: Pointer;
    dwDriverAttributes: DWORD;
    dwConfigVersion: DWORD;
    dwDriverVersion: DWORD;
  end;
const DRIVER_INFO_5W = extern struct {
    cVersion: u32,
    pName: ?*anyopaque,
    pEnvironment: ?*anyopaque,
    pDriverPath: ?*anyopaque,
    pDataFile: ?*anyopaque,
    pConfigFile: ?*anyopaque,
    dwDriverAttributes: u32,
    dwConfigVersion: u32,
    dwDriverVersion: u32,
};
type
  DRIVER_INFO_5W {.bycopy.} = object
    cVersion: uint32
    pName: pointer
    pEnvironment: pointer
    pDriverPath: pointer
    pDataFile: pointer
    pConfigFile: pointer
    dwDriverAttributes: uint32
    dwConfigVersion: uint32
    dwDriverVersion: uint32
struct DRIVER_INFO_5W
{
    uint cVersion;
    void* pName;
    void* pEnvironment;
    void* pDriverPath;
    void* pDataFile;
    void* pConfigFile;
    uint dwDriverAttributes;
    uint dwConfigVersion;
    uint dwDriverVersion;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DRIVER_INFO_5W サイズ: 36 バイト(x86)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; cVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pName : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pEnvironment : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pDriverPath : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pDataFile : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pConfigFile : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwDriverAttributes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwConfigVersion : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwDriverVersion : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DRIVER_INFO_5W サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pName : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pEnvironment : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pDriverPath : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pDataFile : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pConfigFile : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dwDriverAttributes : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwConfigVersion : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; dwDriverVersion : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DRIVER_INFO_5W
    #field int cVersion
    #field intptr pName
    #field intptr pEnvironment
    #field intptr pDriverPath
    #field intptr pDataFile
    #field intptr pConfigFile
    #field int dwDriverAttributes
    #field int dwConfigVersion
    #field int dwDriverVersion
#endstruct

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