ホーム › System.RemoteDesktop › pluginResource2FileAssociation
pluginResource2FileAssociation
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| extName | WCHAR | 512 | +0 | +0 | 関連付けられるファイル拡張子の名前。 |
| primaryHandler | BYTE | 1 | +512 | +512 | この拡張子の主ハンドラかどうかを示すフラグ。 |
| pceIconSize | DWORD | 4 | +516 | +516 | アイコンデータのサイズ。バイト数で表す。 |
| iconContents | BYTE* | 8/4 | +520 | +520 | アイコン画像データへのポインタ。 |
各言語での定義
#include <windows.h>
// pluginResource2FileAssociation (x64 528 / x86 524 バイト)
typedef struct pluginResource2FileAssociation {
WCHAR extName[256];
BYTE primaryHandler;
DWORD pceIconSize;
BYTE* iconContents;
} pluginResource2FileAssociation;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct pluginResource2FileAssociation
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string extName;
public byte primaryHandler;
public uint pceIconSize;
public IntPtr iconContents;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure pluginResource2FileAssociation
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public extName As String
Public primaryHandler As Byte
Public pceIconSize As UInteger
Public iconContents As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class pluginResource2FileAssociation(ctypes.Structure):
_fields_ = [
("extName", ctypes.c_wchar * 256),
("primaryHandler", ctypes.c_ubyte),
("pceIconSize", wintypes.DWORD),
("iconContents", ctypes.c_void_p),
]#[repr(C)]
pub struct pluginResource2FileAssociation {
pub extName: [u16; 256],
pub primaryHandler: u8,
pub pceIconSize: u32,
pub iconContents: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type pluginResource2FileAssociation struct {
extName [256]uint16
primaryHandler byte
pceIconSize uint32
iconContents uintptr
}type
pluginResource2FileAssociation = record
extName: array[0..255] of WideChar;
primaryHandler: Byte;
pceIconSize: DWORD;
iconContents: Pointer;
end;const pluginResource2FileAssociation = extern struct {
extName: [256]u16,
primaryHandler: u8,
pceIconSize: u32,
iconContents: ?*anyopaque,
};type
pluginResource2FileAssociation {.bycopy.} = object
extName: array[256, uint16]
primaryHandler: uint8
pceIconSize: uint32
iconContents: pointerstruct pluginResource2FileAssociation
{
wchar[256] extName;
ubyte primaryHandler;
uint pceIconSize;
void* iconContents;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; pluginResource2FileAssociation サイズ: 524 バイト(x86)
dim st, 131 ; 4byte整数×131(構造体サイズ 524 / 4 切り上げ)
; extName : WCHAR (+0, 512byte) varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; primaryHandler : BYTE (+512, 1byte) poke st,512,値 / 値 = peek(st,512)
; pceIconSize : DWORD (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; iconContents : BYTE* (+520, 4byte) st.130 = 値 / 値 = st.130 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; pluginResource2FileAssociation サイズ: 528 バイト(x64)
dim st, 132 ; 4byte整数×132(構造体サイズ 528 / 4 切り上げ)
; extName : WCHAR (+0, 512byte) varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; primaryHandler : BYTE (+512, 1byte) poke st,512,値 / 値 = peek(st,512)
; pceIconSize : DWORD (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; iconContents : BYTE* (+520, 8byte) qpoke st,520,値 / qpeek(st,520) ※IronHSPのみ。3.7/3.8は lpoke st,520,下位 : lpoke st,524,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global pluginResource2FileAssociation
#field wchar extName 256
#field byte primaryHandler
#field int pceIconSize
#field intptr iconContents
#endstruct
stdim st, pluginResource2FileAssociation ; NSTRUCT 変数を確保
st->primaryHandler = 100
mes "primaryHandler=" + st->primaryHandler