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

DRIVER_INFO_4A

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

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

フィールド

フィールドサイズx64x86説明
cVersionDWORD4+0+0ドライバのバージョン番号。
pNameLPSTR8/4+8+4プリンタドライバ名(ANSI)へのポインタ。
pEnvironmentLPSTR8/4+16+8ドライバの対象環境名(ANSI)。
pDriverPathLPSTR8/4+24+12ドライバ本体ファイルのパス(ANSI)へのポインタ。
pDataFileLPSTR8/4+32+16ドライバデータファイルのパス(ANSI)へのポインタ。
pConfigFileLPSTR8/4+40+20構成用DLLのパス(ANSI)へのポインタ。
pHelpFileLPSTR8/4+48+24ヘルプファイルのパス(ANSI)へのポインタ。NULL可。
pDependentFilesLPSTR8/4+56+28依存ファイルのパスをNULL区切りで連結した文字列(ANSI)へのポインタ。
pMonitorNameLPSTR8/4+64+32言語モニタ名(ANSI)へのポインタ。NULL可。
pDefaultDataTypeLPSTR8/4+72+36既定の印刷データ型(ANSI)へのポインタ。NULL可。
pszzPreviousNamesLPSTR8/4+80+40このドライバの旧名称をNULL区切りで連結した文字列(ANSI)へのポインタ。

公式ドキュメント

DRIVER_INFO_4 構造体には、プリンタードライバーの情報が格納されます。

解説(Remarks)

cVersion

ドライバーが記述された対象のオペレーティングシステムのバージョンです。サポートされる値は 3 です。

pName

ドライバーの名前(例: "QMS 810")を指定する、null で終わる文字列へのポインターです。

pEnvironment

ドライバーが記述された対象の環境(例: Windows x86、Windows IA64、Windows x64)を指定する、null で終わる文字列へのポインターです。

pDriverPath

デバイスドライバーを格納するファイルのファイル名、またはフルパスとファイル名(例: C:\DRIVERS\Pscript.dll)を指定する、null で終わる文字列へのポインターです。

pDataFile

ドライバーのデータを格納するファイルのファイル名、またはフルパスとファイル名(例: C:\DRIVERS\Qms810.ppd)を指定する、null で終わる文字列へのポインターです。

pConfigFile

デバイスドライバーの構成用ダイナミックリンクライブラリのファイル名、またはフルパスとファイル名(例: C:\DRIVERS\Pscrptui.dll)を指定する、null で終わる文字列へのポインターです。

pHelpFile

デバイスドライバーのヘルプファイルのファイル名、またはフルパスとファイル名を指定する、null で終わる文字列へのポインターです。

pDependentFiles

null で終わる文字列が連続して格納された MultiSZ バッファーへのポインターです。バッファー内の各文字列には、ドライバーが依存するファイルの名前が格納されます。文字列の並びは、長さ 0 の空文字列で終端されます。pDependentFilesNULL ではなく、ファイル名を 1 つも含まない場合は、2 つの空文字列を格納するバッファーを指します。

pMonitorName

言語モニター(例: PJL モニター)を指定する、null で終わる文字列へのポインターです。このメンバーは NULL でもかまいません。双方向通信が可能なプリンターに対してのみ指定してください。

pDefaultDataType

印刷ジョブの既定のデータ型(例: EMF)を指定する、null で終わる文字列へのポインターです。

pszzPreviousNames

このドライバーと互換性のある、以前のプリンタードライバー名を指定する、null で終わる文字列へのポインターです。例: OldName1\0OldName2\0\0。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp)

各言語での定義

#include <windows.h>

// DRIVER_INFO_4A  (x64 88 / x86 44 バイト)
typedef struct DRIVER_INFO_4A {
    DWORD cVersion;
    LPSTR pName;
    LPSTR pEnvironment;
    LPSTR pDriverPath;
    LPSTR pDataFile;
    LPSTR pConfigFile;
    LPSTR pHelpFile;
    LPSTR pDependentFiles;
    LPSTR pMonitorName;
    LPSTR pDefaultDataType;
    LPSTR pszzPreviousNames;
} DRIVER_INFO_4A;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DRIVER_INFO_4A
{
    public uint cVersion;
    public IntPtr pName;
    public IntPtr pEnvironment;
    public IntPtr pDriverPath;
    public IntPtr pDataFile;
    public IntPtr pConfigFile;
    public IntPtr pHelpFile;
    public IntPtr pDependentFiles;
    public IntPtr pMonitorName;
    public IntPtr pDefaultDataType;
    public IntPtr pszzPreviousNames;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DRIVER_INFO_4A
    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 pHelpFile As IntPtr
    Public pDependentFiles As IntPtr
    Public pMonitorName As IntPtr
    Public pDefaultDataType As IntPtr
    Public pszzPreviousNames As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DRIVER_INFO_4A(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),
        ("pHelpFile", ctypes.c_void_p),
        ("pDependentFiles", ctypes.c_void_p),
        ("pMonitorName", ctypes.c_void_p),
        ("pDefaultDataType", ctypes.c_void_p),
        ("pszzPreviousNames", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DRIVER_INFO_4A {
    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 pHelpFile: *mut core::ffi::c_void,
    pub pDependentFiles: *mut core::ffi::c_void,
    pub pMonitorName: *mut core::ffi::c_void,
    pub pDefaultDataType: *mut core::ffi::c_void,
    pub pszzPreviousNames: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DRIVER_INFO_4A struct {
	cVersion uint32
	pName uintptr
	pEnvironment uintptr
	pDriverPath uintptr
	pDataFile uintptr
	pConfigFile uintptr
	pHelpFile uintptr
	pDependentFiles uintptr
	pMonitorName uintptr
	pDefaultDataType uintptr
	pszzPreviousNames uintptr
}
type
  DRIVER_INFO_4A = record
    cVersion: DWORD;
    pName: Pointer;
    pEnvironment: Pointer;
    pDriverPath: Pointer;
    pDataFile: Pointer;
    pConfigFile: Pointer;
    pHelpFile: Pointer;
    pDependentFiles: Pointer;
    pMonitorName: Pointer;
    pDefaultDataType: Pointer;
    pszzPreviousNames: Pointer;
  end;
const DRIVER_INFO_4A = extern struct {
    cVersion: u32,
    pName: ?*anyopaque,
    pEnvironment: ?*anyopaque,
    pDriverPath: ?*anyopaque,
    pDataFile: ?*anyopaque,
    pConfigFile: ?*anyopaque,
    pHelpFile: ?*anyopaque,
    pDependentFiles: ?*anyopaque,
    pMonitorName: ?*anyopaque,
    pDefaultDataType: ?*anyopaque,
    pszzPreviousNames: ?*anyopaque,
};
type
  DRIVER_INFO_4A {.bycopy.} = object
    cVersion: uint32
    pName: pointer
    pEnvironment: pointer
    pDriverPath: pointer
    pDataFile: pointer
    pConfigFile: pointer
    pHelpFile: pointer
    pDependentFiles: pointer
    pMonitorName: pointer
    pDefaultDataType: pointer
    pszzPreviousNames: pointer
struct DRIVER_INFO_4A
{
    uint cVersion;
    void* pName;
    void* pEnvironment;
    void* pDriverPath;
    void* pDataFile;
    void* pConfigFile;
    void* pHelpFile;
    void* pDependentFiles;
    void* pMonitorName;
    void* pDefaultDataType;
    void* pszzPreviousNames;
}

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

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