ホーム › System.Hypervisor › WHV_CPUID_OUTPUT
WHV_CPUID_OUTPUT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Eax | DWORD | 4 | +0 | +0 | CPUID命令の出力EAXレジスタ値である。 |
| Ebx | DWORD | 4 | +4 | +4 | CPUID命令の出力EBXレジスタ値である。 |
| Ecx | DWORD | 4 | +8 | +8 | CPUID命令の出力ECXレジスタ値である。 |
| Edx | DWORD | 4 | +12 | +12 | CPUID命令の出力EDXレジスタ値である。 |
各言語での定義
#include <windows.h>
// WHV_CPUID_OUTPUT (x64 16 / x86 16 バイト)
typedef struct WHV_CPUID_OUTPUT {
DWORD Eax;
DWORD Ebx;
DWORD Ecx;
DWORD Edx;
} WHV_CPUID_OUTPUT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WHV_CPUID_OUTPUT
{
public uint Eax;
public uint Ebx;
public uint Ecx;
public uint Edx;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WHV_CPUID_OUTPUT
Public Eax As UInteger
Public Ebx As UInteger
Public Ecx As UInteger
Public Edx As UInteger
End Structureimport ctypes
from ctypes import wintypes
class WHV_CPUID_OUTPUT(ctypes.Structure):
_fields_ = [
("Eax", wintypes.DWORD),
("Ebx", wintypes.DWORD),
("Ecx", wintypes.DWORD),
("Edx", wintypes.DWORD),
]#[repr(C)]
pub struct WHV_CPUID_OUTPUT {
pub Eax: u32,
pub Ebx: u32,
pub Ecx: u32,
pub Edx: u32,
}import "golang.org/x/sys/windows"
type WHV_CPUID_OUTPUT struct {
Eax uint32
Ebx uint32
Ecx uint32
Edx uint32
}type
WHV_CPUID_OUTPUT = record
Eax: DWORD;
Ebx: DWORD;
Ecx: DWORD;
Edx: DWORD;
end;const WHV_CPUID_OUTPUT = extern struct {
Eax: u32,
Ebx: u32,
Ecx: u32,
Edx: u32,
};type
WHV_CPUID_OUTPUT {.bycopy.} = object
Eax: uint32
Ebx: uint32
Ecx: uint32
Edx: uint32struct WHV_CPUID_OUTPUT
{
uint Eax;
uint Ebx;
uint Ecx;
uint Edx;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WHV_CPUID_OUTPUT サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Eax : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Ebx : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Ecx : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Edx : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WHV_CPUID_OUTPUT
#field int Eax
#field int Ebx
#field int Ecx
#field int Edx
#endstruct
stdim st, WHV_CPUID_OUTPUT ; NSTRUCT 変数を確保
st->Eax = 100
mes "Eax=" + st->Eax