ホーム › Devices.DeviceAndDriverInstallation › SP_ALTPLATFORM_INFO_V1
SP_ALTPLATFORM_INFO_V1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。V1版識別のため正しく設定する。 |
| Platform | VER_PLATFORM | 4 | +4 | +4 | 対象プラットフォーム識別子(VER_PLATFORM)。 |
| MajorVersion | DWORD | 4 | +8 | +8 | 対象OSのメジャーバージョン番号。 |
| MinorVersion | DWORD | 4 | +12 | +12 | 対象OSのマイナーバージョン番号。 |
| ProcessorArchitecture | WORD | 2 | +16 | +16 | プロセッサアーキテクチャを示すWORD値。 |
| Reserved | WORD | 2 | +18 | +18 | システム内部利用の予約領域。0を設定する。 |
各言語での定義
#include <windows.h>
// SP_ALTPLATFORM_INFO_V1 (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct SP_ALTPLATFORM_INFO_V1 {
DWORD cbSize;
VER_PLATFORM Platform;
DWORD MajorVersion;
DWORD MinorVersion;
WORD ProcessorArchitecture;
WORD Reserved;
} SP_ALTPLATFORM_INFO_V1;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SP_ALTPLATFORM_INFO_V1
{
public uint cbSize;
public uint Platform;
public uint MajorVersion;
public uint MinorVersion;
public ushort ProcessorArchitecture;
public ushort Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SP_ALTPLATFORM_INFO_V1
Public cbSize As UInteger
Public Platform As UInteger
Public MajorVersion As UInteger
Public MinorVersion As UInteger
Public ProcessorArchitecture As UShort
Public Reserved As UShort
End Structureimport ctypes
from ctypes import wintypes
class SP_ALTPLATFORM_INFO_V1(ctypes.Structure):
_pack_ = 1
_fields_ = [
("cbSize", wintypes.DWORD),
("Platform", wintypes.DWORD),
("MajorVersion", wintypes.DWORD),
("MinorVersion", wintypes.DWORD),
("ProcessorArchitecture", ctypes.c_ushort),
("Reserved", ctypes.c_ushort),
]#[repr(C, packed(1))]
pub struct SP_ALTPLATFORM_INFO_V1 {
pub cbSize: u32,
pub Platform: u32,
pub MajorVersion: u32,
pub MinorVersion: u32,
pub ProcessorArchitecture: u16,
pub Reserved: u16,
}import "golang.org/x/sys/windows"
type SP_ALTPLATFORM_INFO_V1 struct {
cbSize uint32
Platform uint32
MajorVersion uint32
MinorVersion uint32
ProcessorArchitecture uint16
Reserved uint16
}type
SP_ALTPLATFORM_INFO_V1 = packed record
cbSize: DWORD;
Platform: DWORD;
MajorVersion: DWORD;
MinorVersion: DWORD;
ProcessorArchitecture: Word;
Reserved: Word;
end;const SP_ALTPLATFORM_INFO_V1 = extern struct {
cbSize: u32,
Platform: u32,
MajorVersion: u32,
MinorVersion: u32,
ProcessorArchitecture: u16,
Reserved: u16,
};type
SP_ALTPLATFORM_INFO_V1 {.packed.} = object
cbSize: uint32
Platform: uint32
MajorVersion: uint32
MinorVersion: uint32
ProcessorArchitecture: uint16
Reserved: uint16align(1)
struct SP_ALTPLATFORM_INFO_V1
{
uint cbSize;
uint Platform;
uint MajorVersion;
uint MinorVersion;
ushort ProcessorArchitecture;
ushort Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SP_ALTPLATFORM_INFO_V1 サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Platform : VER_PLATFORM (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; MajorVersion : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MinorVersion : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ProcessorArchitecture : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; Reserved : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SP_ALTPLATFORM_INFO_V1, pack=1
#field int cbSize
#field int Platform
#field int MajorVersion
#field int MinorVersion
#field short ProcessorArchitecture
#field short Reserved
#endstruct
stdim st, SP_ALTPLATFORM_INFO_V1 ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize