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

PCCARD_DES

構造体
サイズx64: 38 バイト / x86: 38 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
PCD_CountDWORD4+0+0記述子の数。通常は0。
PCD_TypeDWORD4+4+4PCカード記述子の種別を示す値。
PCD_FlagsPCD_FLAGS4+8+8PCカード記述子のフラグ群(PCD_FLAGS)。
PCD_ConfigIndexBYTE1+12+12カードの構成インデックス値。
PCD_ReservedBYTE3+13+13システム内部利用の予約バイト。
PCD_MemoryCardBase1DWORD4+16+16メモリカードのベースアドレス1。
PCD_MemoryCardBase2DWORD4+20+20メモリカードのベースアドレス2。
PCD_MemoryCardBaseDWORD8+24+24メモリカードのベースアドレス。
PCD_MemoryFlagsWORD4+32+32メモリ構成に関するフラグ群(WORD)。
PCD_IoFlagsBYTE2+36+36I/O構成に関するフラグ群(バイト)。

各言語での定義

#include <windows.h>

// PCCARD_DES  (x64 38 / x86 38 バイト)
#pragma pack(push, 1)
typedef struct PCCARD_DES {
    DWORD PCD_Count;
    DWORD PCD_Type;
    PCD_FLAGS PCD_Flags;
    BYTE PCD_ConfigIndex;
    BYTE PCD_Reserved[3];
    DWORD PCD_MemoryCardBase1;
    DWORD PCD_MemoryCardBase2;
    DWORD PCD_MemoryCardBase[2];
    WORD PCD_MemoryFlags[2];
    BYTE PCD_IoFlags[2];
} PCCARD_DES;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct PCCARD_DES
{
    public uint PCD_Count;
    public uint PCD_Type;
    public uint PCD_Flags;
    public byte PCD_ConfigIndex;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] PCD_Reserved;
    public uint PCD_MemoryCardBase1;
    public uint PCD_MemoryCardBase2;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] PCD_MemoryCardBase;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ushort[] PCD_MemoryFlags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] PCD_IoFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure PCCARD_DES
    Public PCD_Count As UInteger
    Public PCD_Type As UInteger
    Public PCD_Flags As UInteger
    Public PCD_ConfigIndex As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public PCD_Reserved() As Byte
    Public PCD_MemoryCardBase1 As UInteger
    Public PCD_MemoryCardBase2 As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public PCD_MemoryCardBase() As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public PCD_MemoryFlags() As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public PCD_IoFlags() As Byte
End Structure
import ctypes
from ctypes import wintypes

class PCCARD_DES(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("PCD_Count", wintypes.DWORD),
        ("PCD_Type", wintypes.DWORD),
        ("PCD_Flags", wintypes.DWORD),
        ("PCD_ConfigIndex", ctypes.c_ubyte),
        ("PCD_Reserved", ctypes.c_ubyte * 3),
        ("PCD_MemoryCardBase1", wintypes.DWORD),
        ("PCD_MemoryCardBase2", wintypes.DWORD),
        ("PCD_MemoryCardBase", wintypes.DWORD * 2),
        ("PCD_MemoryFlags", ctypes.c_ushort * 2),
        ("PCD_IoFlags", ctypes.c_ubyte * 2),
    ]
#[repr(C, packed(1))]
pub struct PCCARD_DES {
    pub PCD_Count: u32,
    pub PCD_Type: u32,
    pub PCD_Flags: u32,
    pub PCD_ConfigIndex: u8,
    pub PCD_Reserved: [u8; 3],
    pub PCD_MemoryCardBase1: u32,
    pub PCD_MemoryCardBase2: u32,
    pub PCD_MemoryCardBase: [u32; 2],
    pub PCD_MemoryFlags: [u16; 2],
    pub PCD_IoFlags: [u8; 2],
}
import "golang.org/x/sys/windows"

type PCCARD_DES struct {
	PCD_Count uint32
	PCD_Type uint32
	PCD_Flags uint32
	PCD_ConfigIndex byte
	PCD_Reserved [3]byte
	PCD_MemoryCardBase1 uint32
	PCD_MemoryCardBase2 uint32
	PCD_MemoryCardBase [2]uint32
	PCD_MemoryFlags [2]uint16
	PCD_IoFlags [2]byte
}
type
  PCCARD_DES = packed record
    PCD_Count: DWORD;
    PCD_Type: DWORD;
    PCD_Flags: DWORD;
    PCD_ConfigIndex: Byte;
    PCD_Reserved: array[0..2] of Byte;
    PCD_MemoryCardBase1: DWORD;
    PCD_MemoryCardBase2: DWORD;
    PCD_MemoryCardBase: array[0..1] of DWORD;
    PCD_MemoryFlags: array[0..1] of Word;
    PCD_IoFlags: array[0..1] of Byte;
  end;
const PCCARD_DES = extern struct {
    PCD_Count: u32,
    PCD_Type: u32,
    PCD_Flags: u32,
    PCD_ConfigIndex: u8,
    PCD_Reserved: [3]u8,
    PCD_MemoryCardBase1: u32,
    PCD_MemoryCardBase2: u32,
    PCD_MemoryCardBase: [2]u32,
    PCD_MemoryFlags: [2]u16,
    PCD_IoFlags: [2]u8,
};
type
  PCCARD_DES {.packed.} = object
    PCD_Count: uint32
    PCD_Type: uint32
    PCD_Flags: uint32
    PCD_ConfigIndex: uint8
    PCD_Reserved: array[3, uint8]
    PCD_MemoryCardBase1: uint32
    PCD_MemoryCardBase2: uint32
    PCD_MemoryCardBase: array[2, uint32]
    PCD_MemoryFlags: array[2, uint16]
    PCD_IoFlags: array[2, uint8]
align(1)
struct PCCARD_DES
{
    uint PCD_Count;
    uint PCD_Type;
    uint PCD_Flags;
    ubyte PCD_ConfigIndex;
    ubyte[3] PCD_Reserved;
    uint PCD_MemoryCardBase1;
    uint PCD_MemoryCardBase2;
    uint[2] PCD_MemoryCardBase;
    ushort[2] PCD_MemoryFlags;
    ubyte[2] PCD_IoFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PCCARD_DES サイズ: 38 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 38 / 4 切り上げ)
; PCD_Count : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; PCD_Type : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; PCD_Flags : PCD_FLAGS (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; PCD_ConfigIndex : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; PCD_Reserved : BYTE (+13, 3byte)  varptr(st)+13 を基点に操作(3byte:入れ子/配列)
; PCD_MemoryCardBase1 : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; PCD_MemoryCardBase2 : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; PCD_MemoryCardBase : DWORD (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; PCD_MemoryFlags : WORD (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; PCD_IoFlags : BYTE (+36, 2byte)  varptr(st)+36 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PCCARD_DES, pack=1
    #field int PCD_Count
    #field int PCD_Type
    #field int PCD_Flags
    #field byte PCD_ConfigIndex
    #field byte PCD_Reserved 3
    #field int PCD_MemoryCardBase1
    #field int PCD_MemoryCardBase2
    #field int PCD_MemoryCardBase 2
    #field short PCD_MemoryFlags 2
    #field byte PCD_IoFlags 2
#endstruct

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