ホーム › System.Search › SSVARIANT
SSVARIANT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| vt | WORD | 2 | +0 | +0 | 格納されている値の型を示すタグ。 |
| dwReserved1 | DWORD | 4 | +4 | +4 | 予約済みフィールド。 |
| dwReserved2 | DWORD | 4 | +8 | +8 | 予約済みフィールド。 |
| Anonymous | _Anonymous_e__Union | 24 | +16 | +16 | vt が示す型に応じた実際の値を保持する無名共用体。 |
共用体: _Anonymous_e__Union x64 24B / x86 24B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| bTinyIntVal | BYTE | 1 | +0 | +0 |
| sShortIntVal | SHORT | 2 | +0 | +0 |
| lIntVal | INT | 4 | +0 | +0 |
| llBigIntVal | LONGLONG | 8 | +0 | +0 |
| fltRealVal | FLOAT | 4 | +0 | +0 |
| dblFloatVal | DOUBLE | 8 | +0 | +0 |
| cyMoneyVal | CY | 8 | +0 | +0 |
| NCharVal | _NCharVal | 8/4 | +0 | +0 |
| CharVal | _CharVal | 8/4 | +0 | +0 |
| fBitVal | VARIANT_BOOL | 2 | +0 | +0 |
| rgbGuidVal | BYTE | 16 | +0 | +0 |
| numNumericVal | DB_NUMERIC | 19 | +0 | +0 |
| BinaryVal | _BinaryVal | 8/4 | +0 | +0 |
| tsDateTimeVal | DBTIMESTAMP | 16 | +0 | +0 |
| UnknownType | _UnknownType | 8/4 | +0 | +0 |
| BLOBType | _BLOBType | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// SSVARIANT (x64 40 / x86 40 バイト)
typedef struct SSVARIANT {
WORD vt;
DWORD dwReserved1;
DWORD dwReserved2;
_Anonymous_e__Union Anonymous;
} SSVARIANT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SSVARIANT
{
public ushort vt;
public uint dwReserved1;
public uint dwReserved2;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SSVARIANT
Public vt As UShort
Public dwReserved1 As UInteger
Public dwReserved2 As UInteger
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class SSVARIANT(ctypes.Structure):
_fields_ = [
("vt", ctypes.c_ushort),
("dwReserved1", wintypes.DWORD),
("dwReserved2", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct SSVARIANT {
pub vt: u16,
pub dwReserved1: u32,
pub dwReserved2: u32,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type SSVARIANT struct {
vt uint16
dwReserved1 uint32
dwReserved2 uint32
Anonymous _Anonymous_e__Union
}type
SSVARIANT = record
vt: Word;
dwReserved1: DWORD;
dwReserved2: DWORD;
Anonymous: _Anonymous_e__Union;
end;const SSVARIANT = extern struct {
vt: u16,
dwReserved1: u32,
dwReserved2: u32,
Anonymous: _Anonymous_e__Union,
};type
SSVARIANT {.bycopy.} = object
vt: uint16
dwReserved1: uint32
dwReserved2: uint32
Anonymous: _Anonymous_e__Unionstruct SSVARIANT
{
ushort vt;
uint dwReserved1;
uint dwReserved2;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SSVARIANT サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; vt : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; dwReserved1 : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwReserved2 : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+16, 24byte) varptr(st)+16 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SSVARIANT
#field short vt
#field int dwReserved1
#field int dwReserved2
#field byte Anonymous 24
#endstruct
stdim st, SSVARIANT ; NSTRUCT 変数を確保
st->vt = 100
mes "vt=" + st->vt
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。