Win32 API 日本語リファレンス
ホームSystem.Ioctl › SCM_PD_DEVICE_SPECIFIC_INFO

SCM_PD_DEVICE_SPECIFIC_INFO

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0この構造体のバージョン番号。
SizeDWORD4+4+4この構造体のバイト単位のサイズ。
NumberOfPropertiesDWORD4+8+8DeviceSpecificProperties配列に含まれるプロパティ数。
DeviceSpecificPropertiesSCM_PD_DEVICE_SPECIFIC_PROPERTY264+16+16SCM_PD_DEVICE_SPECIFIC_PROPERTYの可変長配列。先頭要素。

各言語での定義

#include <windows.h>

// SCM_PD_DEVICE_SPECIFIC_PROPERTY  (x64 264 / x86 264 バイト)
typedef struct SCM_PD_DEVICE_SPECIFIC_PROPERTY {
    WCHAR Name[128];
    LONGLONG Value;
} SCM_PD_DEVICE_SPECIFIC_PROPERTY;

// SCM_PD_DEVICE_SPECIFIC_INFO  (x64 280 / x86 280 バイト)
typedef struct SCM_PD_DEVICE_SPECIFIC_INFO {
    DWORD Version;
    DWORD Size;
    DWORD NumberOfProperties;
    SCM_PD_DEVICE_SPECIFIC_PROPERTY DeviceSpecificProperties[1];
} SCM_PD_DEVICE_SPECIFIC_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCM_PD_DEVICE_SPECIFIC_PROPERTY
{
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string Name;
    public long Value;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCM_PD_DEVICE_SPECIFIC_INFO
{
    public uint Version;
    public uint Size;
    public uint NumberOfProperties;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public SCM_PD_DEVICE_SPECIFIC_PROPERTY[] DeviceSpecificProperties;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCM_PD_DEVICE_SPECIFIC_PROPERTY
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public Name As String
    Public Value As Long
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCM_PD_DEVICE_SPECIFIC_INFO
    Public Version As UInteger
    Public Size As UInteger
    Public NumberOfProperties As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public DeviceSpecificProperties() As SCM_PD_DEVICE_SPECIFIC_PROPERTY
End Structure
import ctypes
from ctypes import wintypes

class SCM_PD_DEVICE_SPECIFIC_PROPERTY(ctypes.Structure):
    _fields_ = [
        ("Name", ctypes.c_wchar * 128),
        ("Value", ctypes.c_longlong),
    ]

class SCM_PD_DEVICE_SPECIFIC_INFO(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("NumberOfProperties", wintypes.DWORD),
        ("DeviceSpecificProperties", SCM_PD_DEVICE_SPECIFIC_PROPERTY * 1),
    ]
#[repr(C)]
pub struct SCM_PD_DEVICE_SPECIFIC_PROPERTY {
    pub Name: [u16; 128],
    pub Value: i64,
}

#[repr(C)]
pub struct SCM_PD_DEVICE_SPECIFIC_INFO {
    pub Version: u32,
    pub Size: u32,
    pub NumberOfProperties: u32,
    pub DeviceSpecificProperties: [SCM_PD_DEVICE_SPECIFIC_PROPERTY; 1],
}
import "golang.org/x/sys/windows"

type SCM_PD_DEVICE_SPECIFIC_PROPERTY struct {
	Name [128]uint16
	Value int64
}

type SCM_PD_DEVICE_SPECIFIC_INFO struct {
	Version uint32
	Size uint32
	NumberOfProperties uint32
	DeviceSpecificProperties [1]SCM_PD_DEVICE_SPECIFIC_PROPERTY
}
type
  SCM_PD_DEVICE_SPECIFIC_PROPERTY = record
    Name: array[0..127] of WideChar;
    Value: Int64;
  end;

  SCM_PD_DEVICE_SPECIFIC_INFO = record
    Version: DWORD;
    Size: DWORD;
    NumberOfProperties: DWORD;
    DeviceSpecificProperties: array[0..0] of SCM_PD_DEVICE_SPECIFIC_PROPERTY;
  end;
const SCM_PD_DEVICE_SPECIFIC_PROPERTY = extern struct {
    Name: [128]u16,
    Value: i64,
};

const SCM_PD_DEVICE_SPECIFIC_INFO = extern struct {
    Version: u32,
    Size: u32,
    NumberOfProperties: u32,
    DeviceSpecificProperties: [1]SCM_PD_DEVICE_SPECIFIC_PROPERTY,
};
type
  SCM_PD_DEVICE_SPECIFIC_PROPERTY {.bycopy.} = object
    Name: array[128, uint16]
    Value: int64

  SCM_PD_DEVICE_SPECIFIC_INFO {.bycopy.} = object
    Version: uint32
    Size: uint32
    NumberOfProperties: uint32
    DeviceSpecificProperties: array[1, SCM_PD_DEVICE_SPECIFIC_PROPERTY]
struct SCM_PD_DEVICE_SPECIFIC_PROPERTY
{
    wchar[128] Name;
    long Value;
}

struct SCM_PD_DEVICE_SPECIFIC_INFO
{
    uint Version;
    uint Size;
    uint NumberOfProperties;
    SCM_PD_DEVICE_SPECIFIC_PROPERTY[1] DeviceSpecificProperties;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCM_PD_DEVICE_SPECIFIC_INFO サイズ: 280 バイト(x64)
dim st, 70    ; 4byte整数×70(構造体サイズ 280 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; NumberOfProperties : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; DeviceSpecificProperties : SCM_PD_DEVICE_SPECIFIC_PROPERTY (+16, 264byte)  varptr(st)+16 を基点に操作(264byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SCM_PD_DEVICE_SPECIFIC_PROPERTY
    #field wchar Name 128
    #field int64 Value
#endstruct

#defstruct global SCM_PD_DEVICE_SPECIFIC_INFO
    #field int Version
    #field int Size
    #field int NumberOfProperties
    #field SCM_PD_DEVICE_SPECIFIC_PROPERTY DeviceSpecificProperties 1
#endstruct

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