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

DDDEVICEIDENTIFIER

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

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

フィールド

フィールドサイズx64x86説明
szDriverCHAR512+0+0ディスプレイドライバ名を格納するANSI文字列(配列)。
szDescriptionCHAR512+512+512デバイスの説明文字列を格納するANSI文字列(配列)。
liDriverVersionLONGLONG8+1024+1024ドライバのバージョンを64ビット値で示す。
dwVendorIdDWORD4+1032+1032ハードウェアベンダーID(PCIベンダID)を示す。
dwDeviceIdDWORD4+1036+1036デバイスID(PCIデバイスID)を示す。
dwSubSysIdDWORD4+1040+1040サブシステムIDを示す。
dwRevisionDWORD4+1044+1044チップのリビジョン番号を示す。
guidDeviceIdentifierGUID16+1048+1048ドライバ/チップ組み合わせを一意に識別するGUID。

各言語での定義

#include <windows.h>

// DDDEVICEIDENTIFIER  (x64 1064 / x86 1064 バイト)
typedef struct DDDEVICEIDENTIFIER {
    CHAR szDriver[512];
    CHAR szDescription[512];
    LONGLONG liDriverVersion;
    DWORD dwVendorId;
    DWORD dwDeviceId;
    DWORD dwSubSysId;
    DWORD dwRevision;
    GUID guidDeviceIdentifier;
} DDDEVICEIDENTIFIER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDDEVICEIDENTIFIER
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public sbyte[] szDriver;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public sbyte[] szDescription;
    public long liDriverVersion;
    public uint dwVendorId;
    public uint dwDeviceId;
    public uint dwSubSysId;
    public uint dwRevision;
    public Guid guidDeviceIdentifier;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDDEVICEIDENTIFIER
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=512)> Public szDriver() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=512)> Public szDescription() As SByte
    Public liDriverVersion As Long
    Public dwVendorId As UInteger
    Public dwDeviceId As UInteger
    Public dwSubSysId As UInteger
    Public dwRevision As UInteger
    Public guidDeviceIdentifier As Guid
End Structure
import ctypes
from ctypes import wintypes

class DDDEVICEIDENTIFIER(ctypes.Structure):
    _fields_ = [
        ("szDriver", ctypes.c_byte * 512),
        ("szDescription", ctypes.c_byte * 512),
        ("liDriverVersion", ctypes.c_longlong),
        ("dwVendorId", wintypes.DWORD),
        ("dwDeviceId", wintypes.DWORD),
        ("dwSubSysId", wintypes.DWORD),
        ("dwRevision", wintypes.DWORD),
        ("guidDeviceIdentifier", GUID),
    ]
#[repr(C)]
pub struct DDDEVICEIDENTIFIER {
    pub szDriver: [i8; 512],
    pub szDescription: [i8; 512],
    pub liDriverVersion: i64,
    pub dwVendorId: u32,
    pub dwDeviceId: u32,
    pub dwSubSysId: u32,
    pub dwRevision: u32,
    pub guidDeviceIdentifier: GUID,
}
import "golang.org/x/sys/windows"

type DDDEVICEIDENTIFIER struct {
	szDriver [512]int8
	szDescription [512]int8
	liDriverVersion int64
	dwVendorId uint32
	dwDeviceId uint32
	dwSubSysId uint32
	dwRevision uint32
	guidDeviceIdentifier windows.GUID
}
type
  DDDEVICEIDENTIFIER = record
    szDriver: array[0..511] of Shortint;
    szDescription: array[0..511] of Shortint;
    liDriverVersion: Int64;
    dwVendorId: DWORD;
    dwDeviceId: DWORD;
    dwSubSysId: DWORD;
    dwRevision: DWORD;
    guidDeviceIdentifier: TGUID;
  end;
const DDDEVICEIDENTIFIER = extern struct {
    szDriver: [512]i8,
    szDescription: [512]i8,
    liDriverVersion: i64,
    dwVendorId: u32,
    dwDeviceId: u32,
    dwSubSysId: u32,
    dwRevision: u32,
    guidDeviceIdentifier: GUID,
};
type
  DDDEVICEIDENTIFIER {.bycopy.} = object
    szDriver: array[512, int8]
    szDescription: array[512, int8]
    liDriverVersion: int64
    dwVendorId: uint32
    dwDeviceId: uint32
    dwSubSysId: uint32
    dwRevision: uint32
    guidDeviceIdentifier: GUID
struct DDDEVICEIDENTIFIER
{
    byte[512] szDriver;
    byte[512] szDescription;
    long liDriverVersion;
    uint dwVendorId;
    uint dwDeviceId;
    uint dwSubSysId;
    uint dwRevision;
    GUID guidDeviceIdentifier;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDDEVICEIDENTIFIER サイズ: 1064 バイト(x64)
dim st, 266    ; 4byte整数×266(構造体サイズ 1064 / 4 切り上げ)
; szDriver : CHAR (+0, 512byte)  varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; szDescription : CHAR (+512, 512byte)  varptr(st)+512 を基点に操作(512byte:入れ子/配列)
; liDriverVersion : LONGLONG (+1024, 8byte)  qpoke st,1024,値 / qpeek(st,1024)  ※IronHSPのみ。3.7/3.8は lpoke st,1024,下位 : lpoke st,1028,上位
; dwVendorId : DWORD (+1032, 4byte)  st.258 = 値  /  値 = st.258   (lpoke/lpeek も可)
; dwDeviceId : DWORD (+1036, 4byte)  st.259 = 値  /  値 = st.259   (lpoke/lpeek も可)
; dwSubSysId : DWORD (+1040, 4byte)  st.260 = 値  /  値 = st.260   (lpoke/lpeek も可)
; dwRevision : DWORD (+1044, 4byte)  st.261 = 値  /  値 = st.261   (lpoke/lpeek も可)
; guidDeviceIdentifier : GUID (+1048, 16byte)  varptr(st)+1048 を基点に操作(16byte:入れ子/配列)
; ※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 DDDEVICEIDENTIFIER
    #field byte szDriver 512
    #field byte szDescription 512
    #field int64 liDriverVersion
    #field int dwVendorId
    #field int dwDeviceId
    #field int dwSubSysId
    #field int dwRevision
    #field GUID guidDeviceIdentifier
#endstruct

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