ホーム › System.Diagnostics.Debug › CPU_INFORMATION
CPU_INFORMATION
共用体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| X86CpuInfo | _X86CpuInfo_e__Struct | 24 | +0 | +0 | x86向けCPUID結果(ベンダID/機能ビット)を格納する構造体。 |
| OtherCpuInfo | _OtherCpuInfo_e__Struct | 16 | +0 | +0 | 非x86アーキテクチャ向けの機能ビット情報を格納する構造体。 |
構造体: _X86CpuInfo_e__Struct x64 24B / x86 24B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| VendorId | DWORD | 12 | +0 | +0 |
| VersionInformation | DWORD | 4 | +12 | +12 |
| FeatureInformation | DWORD | 4 | +16 | +16 |
| AMDExtendedCpuFeatures | DWORD | 4 | +20 | +20 |
構造体: _OtherCpuInfo_e__Struct x64 16B / x86 16B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ProcessorFeatures | ULONGLONG | 16 | +0 | +0 |
各言語での定義
#include <windows.h>
// CPU_INFORMATION (x64 24 / x86 24 バイト)
typedef struct CPU_INFORMATION {
_X86CpuInfo_e__Struct X86CpuInfo;
_OtherCpuInfo_e__Struct OtherCpuInfo;
} CPU_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CPU_INFORMATION
{
public _X86CpuInfo_e__Struct X86CpuInfo;
public _OtherCpuInfo_e__Struct OtherCpuInfo;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CPU_INFORMATION
Public X86CpuInfo As _X86CpuInfo_e__Struct
Public OtherCpuInfo As _OtherCpuInfo_e__Struct
End Structureimport ctypes
from ctypes import wintypes
class CPU_INFORMATION(ctypes.Structure):
_fields_ = [
("X86CpuInfo", _X86CpuInfo_e__Struct),
("OtherCpuInfo", _OtherCpuInfo_e__Struct),
]#[repr(C)]
pub struct CPU_INFORMATION {
pub X86CpuInfo: _X86CpuInfo_e__Struct,
pub OtherCpuInfo: _OtherCpuInfo_e__Struct,
}import "golang.org/x/sys/windows"
type CPU_INFORMATION struct {
X86CpuInfo _X86CpuInfo_e__Struct
OtherCpuInfo _OtherCpuInfo_e__Struct
}type
CPU_INFORMATION = record
X86CpuInfo: _X86CpuInfo_e__Struct;
OtherCpuInfo: _OtherCpuInfo_e__Struct;
end;const CPU_INFORMATION = extern struct {
X86CpuInfo: _X86CpuInfo_e__Struct,
OtherCpuInfo: _OtherCpuInfo_e__Struct,
};type
CPU_INFORMATION {.bycopy.} = object
X86CpuInfo: _X86CpuInfo_e__Struct
OtherCpuInfo: _OtherCpuInfo_e__Structstruct CPU_INFORMATION
{
_X86CpuInfo_e__Struct X86CpuInfo;
_OtherCpuInfo_e__Struct OtherCpuInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CPU_INFORMATION サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; X86CpuInfo : _X86CpuInfo_e__Struct (+0, 24byte) varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; OtherCpuInfo : _OtherCpuInfo_e__Struct (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CPU_INFORMATION
#field _X86CpuInfo_e__Struct X86CpuInfo
#field _OtherCpuInfo_e__Struct OtherCpuInfo
#endstruct
stdim st, CPU_INFORMATION ; NSTRUCT 変数を確保