ホーム › System.Com › uCLSSPEC
uCLSSPEC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| tyspec | DWORD | 4 | +0 | +0 | クラス指定の種別を示す値。tagged_unionの解釈を決める。 |
| tagged_union | _tagged_union_e__Struct | 16 | +8 | +4 | tyspecに応じてCLSID/ファイル拡張子/MIME型等を切り替える共用体。 |
共用体: _tagged_union_e__Struct x64 16B / x86 16B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| clsid | GUID | 16 | +0 | +0 |
| pFileExt | LPWSTR | 8/4 | +0 | +0 |
| pMimeType | LPWSTR | 8/4 | +0 | +0 |
| pProgId | LPWSTR | 8/4 | +0 | +0 |
| pFileName | LPWSTR | 8/4 | +0 | +0 |
| ByName | _ByName_e__Struct | 8/4 | +0 | +0 |
| ByObjectId | _ByObjectId_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// uCLSSPEC (x64 24 / x86 20 バイト)
typedef struct uCLSSPEC {
DWORD tyspec;
_tagged_union_e__Struct tagged_union;
} uCLSSPEC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct uCLSSPEC
{
public uint tyspec;
public _tagged_union_e__Struct tagged_union;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure uCLSSPEC
Public tyspec As UInteger
Public tagged_union As _tagged_union_e__Struct
End Structureimport ctypes
from ctypes import wintypes
class uCLSSPEC(ctypes.Structure):
_fields_ = [
("tyspec", wintypes.DWORD),
("tagged_union", _tagged_union_e__Struct),
]#[repr(C)]
pub struct uCLSSPEC {
pub tyspec: u32,
pub tagged_union: _tagged_union_e__Struct,
}import "golang.org/x/sys/windows"
type uCLSSPEC struct {
tyspec uint32
tagged_union _tagged_union_e__Struct
}type
uCLSSPEC = record
tyspec: DWORD;
tagged_union: _tagged_union_e__Struct;
end;const uCLSSPEC = extern struct {
tyspec: u32,
tagged_union: _tagged_union_e__Struct,
};type
uCLSSPEC {.bycopy.} = object
tyspec: uint32
tagged_union: _tagged_union_e__Structstruct uCLSSPEC
{
uint tyspec;
_tagged_union_e__Struct tagged_union;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; uCLSSPEC サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; tyspec : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; tagged_union : _tagged_union_e__Struct (+4, 16byte) varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; uCLSSPEC サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; tyspec : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; tagged_union : _tagged_union_e__Struct (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global uCLSSPEC
#field int tyspec
#field byte tagged_union 16
#endstruct
stdim st, uCLSSPEC ; NSTRUCT 変数を確保
st->tyspec = 100
mes "tyspec=" + st->tyspec
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。