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

SP_ALTPLATFORM_INFO_V1

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズ (バイト単位)。
PlatformVER_PLATFORM4+4+4

オペレーティングシステム。次のいずれかの値でなければなりません。

意味
VER_PLATFORM_WIN32_WINDOWS
従来のオペレーティングシステム。
VER_PLATFORM_WIN32_NT
Windows Server 2008、Windows Vista、Windows Server 2003、Windows XP、または Windows 2000。
MajorVersionDWORD4+8+8オペレーティングシステムのメジャーバージョン。
MinorVersionDWORD4+12+12オペレーティングシステムのマイナーバージョン。
ProcessorArchitectureWORD2+16+16プロセッサアーキテクチャ。PROCESSOR_ARCHITECTURE_INTELPROCESSOR_ARCHITECTURE_ALPHAPROCESSOR_ARCHITECTURE_IA64PROCESSOR_ARCHITECTURE_ALPHA64 のいずれかでなければなりません。
ReservedWORD2+18+180 に設定しなければなりません。

公式ドキュメント

この構造体は、代替プラットフォームの情報を SetupQueryInfOriginalFileInformation に渡すために使用されます。

USE_SP_ALTPLATFORM_INFO_V1 が 1 に設定されている場合、または _WIN32_WINNT が 0x500 以下の場合、セットアップは暗黙的に SP_ALTPLATFORM_INFO_V1 構造体を使用します。このバージョンは Windows 2000 で使用するためのものです。

USE_SP_ALTPLATFORM_INFO_V1 が 0 または未定義で、かつ _WIN32_WINNT が 0x501 に設定されている場合、セットアップは暗黙的に SP_ALTPLATFORM_INFO_V2 構造体を使用します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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 Structure
import 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: uint16
align(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