ホーム › System.SystemInformation › GROUP_AFFINITY32
GROUP_AFFINITY32
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Mask | DWORD | 4 | +0 | +0 | グループ内の論理プロセッサを表す 32 ビットアフィニティマスク。 |
| Group | WORD | 2 | +4 | +4 | プロセッサグループの番号。 |
| Reserved | WORD | 6 | +6 | +6 | 予約済みフィールド。0 を設定する。 |
各言語での定義
#include <windows.h>
// GROUP_AFFINITY32 (x64 12 / x86 12 バイト)
typedef struct GROUP_AFFINITY32 {
DWORD Mask;
WORD Group;
WORD Reserved[3];
} GROUP_AFFINITY32;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GROUP_AFFINITY32
{
public uint Mask;
public ushort Group;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public ushort[] Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GROUP_AFFINITY32
Public Mask As UInteger
Public Group As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved() As UShort
End Structureimport ctypes
from ctypes import wintypes
class GROUP_AFFINITY32(ctypes.Structure):
_fields_ = [
("Mask", wintypes.DWORD),
("Group", ctypes.c_ushort),
("Reserved", ctypes.c_ushort * 3),
]#[repr(C)]
pub struct GROUP_AFFINITY32 {
pub Mask: u32,
pub Group: u16,
pub Reserved: [u16; 3],
}import "golang.org/x/sys/windows"
type GROUP_AFFINITY32 struct {
Mask uint32
Group uint16
Reserved [3]uint16
}type
GROUP_AFFINITY32 = record
Mask: DWORD;
Group: Word;
Reserved: array[0..2] of Word;
end;const GROUP_AFFINITY32 = extern struct {
Mask: u32,
Group: u16,
Reserved: [3]u16,
};type
GROUP_AFFINITY32 {.bycopy.} = object
Mask: uint32
Group: uint16
Reserved: array[3, uint16]struct GROUP_AFFINITY32
{
uint Mask;
ushort Group;
ushort[3] Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GROUP_AFFINITY32 サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Mask : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Group : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; Reserved : WORD (+6, 6byte) varptr(st)+6 を基点に操作(6byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GROUP_AFFINITY32
#field int Mask
#field short Group
#field short Reserved 3
#endstruct
stdim st, GROUP_AFFINITY32 ; NSTRUCT 変数を確保
st->Mask = 100
mes "Mask=" + st->Mask