ホーム › System.Com › BINDINFO
BINDINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| szExtraInfo | LPWSTR | 8/4 | +8 | +4 | バインドに関する追加情報文字列。NULL可。 |
| stgmedData | STGMEDIUM | 24/12 | +16 | +8 | バインドに付随する媒体データ(STGMEDIUM)。 |
| grfBindInfoF | DWORD | 4 | +40 | +20 | BINDINFOの動作を制御するフラグ。 |
| dwBindVerb | DWORD | 4 | +44 | +24 | 実行するバインド動詞(BINDVERB_GET等)。 |
| szCustomVerb | LPWSTR | 8/4 | +48 | +28 | カスタム動詞文字列。dwBindVerbがCUSTOMのとき有効。 |
| cbstgmedData | DWORD | 4 | +56 | +32 | stgmedDataのデータバイト長。 |
| dwOptions | DWORD | 4 | +60 | +36 | バインドオプションを示す値。 |
| dwOptionsFlags | DWORD | 4 | +64 | +40 | 追加のオプションフラグ。 |
| dwCodePage | DWORD | 4 | +68 | +44 | バインドに用いるコードページ。 |
| securityAttributes | SECURITY_ATTRIBUTES | 24/12 | +72 | +48 | 生成プロセスに適用するセキュリティ属性。 |
| iid | GUID | 16 | +96 | +60 | 要求するインターフェイスのIID。 |
| pUnk | IUnknown* | 8/4 | +112 | +76 | 関連するオブジェクトのIUnknownへのポインタ。NULL可。 |
| dwReserved | DWORD | 4 | +120 | +80 | 予約済みフィールド。 |
各言語での定義
#include <windows.h>
// STGMEDIUM (x64 24 / x86 12 バイト)
typedef struct STGMEDIUM {
DWORD tymed;
_u_e__Union u;
IUnknown* pUnkForRelease;
} STGMEDIUM;
// SECURITY_ATTRIBUTES (x64 24 / x86 12 バイト)
typedef struct SECURITY_ATTRIBUTES {
DWORD nLength;
void* lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES;
// BINDINFO (x64 128 / x86 84 バイト)
typedef struct BINDINFO {
DWORD cbSize;
LPWSTR szExtraInfo;
STGMEDIUM stgmedData;
DWORD grfBindInfoF;
DWORD dwBindVerb;
LPWSTR szCustomVerb;
DWORD cbstgmedData;
DWORD dwOptions;
DWORD dwOptionsFlags;
DWORD dwCodePage;
SECURITY_ATTRIBUTES securityAttributes;
GUID iid;
IUnknown* pUnk;
DWORD dwReserved;
} BINDINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STGMEDIUM
{
public uint tymed;
public _u_e__Union u;
public IntPtr pUnkForRelease;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURITY_ATTRIBUTES
{
public uint nLength;
public IntPtr lpSecurityDescriptor;
[MarshalAs(UnmanagedType.Bool)] public bool bInheritHandle;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BINDINFO
{
public uint cbSize;
public IntPtr szExtraInfo;
public STGMEDIUM stgmedData;
public uint grfBindInfoF;
public uint dwBindVerb;
public IntPtr szCustomVerb;
public uint cbstgmedData;
public uint dwOptions;
public uint dwOptionsFlags;
public uint dwCodePage;
public SECURITY_ATTRIBUTES securityAttributes;
public Guid iid;
public IntPtr pUnk;
public uint dwReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STGMEDIUM
Public tymed As UInteger
Public u As _u_e__Union
Public pUnkForRelease As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECURITY_ATTRIBUTES
Public nLength As UInteger
Public lpSecurityDescriptor As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public bInheritHandle As Boolean
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BINDINFO
Public cbSize As UInteger
Public szExtraInfo As IntPtr
Public stgmedData As STGMEDIUM
Public grfBindInfoF As UInteger
Public dwBindVerb As UInteger
Public szCustomVerb As IntPtr
Public cbstgmedData As UInteger
Public dwOptions As UInteger
Public dwOptionsFlags As UInteger
Public dwCodePage As UInteger
Public securityAttributes As SECURITY_ATTRIBUTES
Public iid As Guid
Public pUnk As IntPtr
Public dwReserved As UInteger
End Structureimport ctypes
from ctypes import wintypes
class STGMEDIUM(ctypes.Structure):
_fields_ = [
("tymed", wintypes.DWORD),
("u", _u_e__Union),
("pUnkForRelease", ctypes.c_void_p),
]
class SECURITY_ATTRIBUTES(ctypes.Structure):
_fields_ = [
("nLength", wintypes.DWORD),
("lpSecurityDescriptor", ctypes.c_void_p),
("bInheritHandle", wintypes.BOOL),
]
class BINDINFO(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("szExtraInfo", ctypes.c_void_p),
("stgmedData", STGMEDIUM),
("grfBindInfoF", wintypes.DWORD),
("dwBindVerb", wintypes.DWORD),
("szCustomVerb", ctypes.c_void_p),
("cbstgmedData", wintypes.DWORD),
("dwOptions", wintypes.DWORD),
("dwOptionsFlags", wintypes.DWORD),
("dwCodePage", wintypes.DWORD),
("securityAttributes", SECURITY_ATTRIBUTES),
("iid", GUID),
("pUnk", ctypes.c_void_p),
("dwReserved", wintypes.DWORD),
]#[repr(C)]
pub struct STGMEDIUM {
pub tymed: u32,
pub u: _u_e__Union,
pub pUnkForRelease: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct SECURITY_ATTRIBUTES {
pub nLength: u32,
pub lpSecurityDescriptor: *mut core::ffi::c_void,
pub bInheritHandle: i32,
}
#[repr(C)]
pub struct BINDINFO {
pub cbSize: u32,
pub szExtraInfo: *mut core::ffi::c_void,
pub stgmedData: STGMEDIUM,
pub grfBindInfoF: u32,
pub dwBindVerb: u32,
pub szCustomVerb: *mut core::ffi::c_void,
pub cbstgmedData: u32,
pub dwOptions: u32,
pub dwOptionsFlags: u32,
pub dwCodePage: u32,
pub securityAttributes: SECURITY_ATTRIBUTES,
pub iid: GUID,
pub pUnk: *mut core::ffi::c_void,
pub dwReserved: u32,
}import "golang.org/x/sys/windows"
type STGMEDIUM struct {
tymed uint32
u _u_e__Union
pUnkForRelease uintptr
}
type SECURITY_ATTRIBUTES struct {
nLength uint32
lpSecurityDescriptor uintptr
bInheritHandle int32
}
type BINDINFO struct {
cbSize uint32
szExtraInfo uintptr
stgmedData STGMEDIUM
grfBindInfoF uint32
dwBindVerb uint32
szCustomVerb uintptr
cbstgmedData uint32
dwOptions uint32
dwOptionsFlags uint32
dwCodePage uint32
securityAttributes SECURITY_ATTRIBUTES
iid windows.GUID
pUnk uintptr
dwReserved uint32
}type
STGMEDIUM = record
tymed: DWORD;
u: _u_e__Union;
pUnkForRelease: Pointer;
end;
SECURITY_ATTRIBUTES = record
nLength: DWORD;
lpSecurityDescriptor: Pointer;
bInheritHandle: BOOL;
end;
BINDINFO = record
cbSize: DWORD;
szExtraInfo: Pointer;
stgmedData: STGMEDIUM;
grfBindInfoF: DWORD;
dwBindVerb: DWORD;
szCustomVerb: Pointer;
cbstgmedData: DWORD;
dwOptions: DWORD;
dwOptionsFlags: DWORD;
dwCodePage: DWORD;
securityAttributes: SECURITY_ATTRIBUTES;
iid: TGUID;
pUnk: Pointer;
dwReserved: DWORD;
end;const STGMEDIUM = extern struct {
tymed: u32,
u: _u_e__Union,
pUnkForRelease: ?*anyopaque,
};
const SECURITY_ATTRIBUTES = extern struct {
nLength: u32,
lpSecurityDescriptor: ?*anyopaque,
bInheritHandle: i32,
};
const BINDINFO = extern struct {
cbSize: u32,
szExtraInfo: ?*anyopaque,
stgmedData: STGMEDIUM,
grfBindInfoF: u32,
dwBindVerb: u32,
szCustomVerb: ?*anyopaque,
cbstgmedData: u32,
dwOptions: u32,
dwOptionsFlags: u32,
dwCodePage: u32,
securityAttributes: SECURITY_ATTRIBUTES,
iid: GUID,
pUnk: ?*anyopaque,
dwReserved: u32,
};type
STGMEDIUM {.bycopy.} = object
tymed: uint32
u: _u_e__Union
pUnkForRelease: pointer
SECURITY_ATTRIBUTES {.bycopy.} = object
nLength: uint32
lpSecurityDescriptor: pointer
bInheritHandle: int32
BINDINFO {.bycopy.} = object
cbSize: uint32
szExtraInfo: pointer
stgmedData: STGMEDIUM
grfBindInfoF: uint32
dwBindVerb: uint32
szCustomVerb: pointer
cbstgmedData: uint32
dwOptions: uint32
dwOptionsFlags: uint32
dwCodePage: uint32
securityAttributes: SECURITY_ATTRIBUTES
iid: GUID
pUnk: pointer
dwReserved: uint32struct STGMEDIUM
{
uint tymed;
_u_e__Union u;
void* pUnkForRelease;
}
struct SECURITY_ATTRIBUTES
{
uint nLength;
void* lpSecurityDescriptor;
int bInheritHandle;
}
struct BINDINFO
{
uint cbSize;
void* szExtraInfo;
STGMEDIUM stgmedData;
uint grfBindInfoF;
uint dwBindVerb;
void* szCustomVerb;
uint cbstgmedData;
uint dwOptions;
uint dwOptionsFlags;
uint dwCodePage;
SECURITY_ATTRIBUTES securityAttributes;
GUID iid;
void* pUnk;
uint dwReserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; BINDINFO サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szExtraInfo : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; stgmedData : STGMEDIUM (+8, 12byte) varptr(st)+8 を基点に操作(12byte:入れ子/配列)
; grfBindInfoF : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwBindVerb : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; szCustomVerb : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cbstgmedData : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwOptions : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwOptionsFlags : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwCodePage : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; securityAttributes : SECURITY_ATTRIBUTES (+48, 12byte) varptr(st)+48 を基点に操作(12byte:入れ子/配列)
; iid : GUID (+60, 16byte) varptr(st)+60 を基点に操作(16byte:入れ子/配列)
; pUnk : IUnknown* (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; dwReserved : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BINDINFO サイズ: 128 バイト(x64)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szExtraInfo : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; stgmedData : STGMEDIUM (+16, 24byte) varptr(st)+16 を基点に操作(24byte:入れ子/配列)
; grfBindInfoF : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwBindVerb : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; szCustomVerb : LPWSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; cbstgmedData : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; dwOptions : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; dwOptionsFlags : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; dwCodePage : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; securityAttributes : SECURITY_ATTRIBUTES (+72, 24byte) varptr(st)+72 を基点に操作(24byte:入れ子/配列)
; iid : GUID (+96, 16byte) varptr(st)+96 を基点に操作(16byte:入れ子/配列)
; pUnk : IUnknown* (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; dwReserved : DWORD (+120, 4byte) st.30 = 値 / 値 = st.30 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global STGMEDIUM
#field int tymed
#field byte u 8
#field intptr pUnkForRelease
#endstruct
#defstruct global SECURITY_ATTRIBUTES
#field int nLength
#field intptr lpSecurityDescriptor
#field bool bInheritHandle
#endstruct
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global BINDINFO
#field int cbSize
#field intptr szExtraInfo
#field STGMEDIUM stgmedData
#field int grfBindInfoF
#field int dwBindVerb
#field intptr szCustomVerb
#field int cbstgmedData
#field int dwOptions
#field int dwOptionsFlags
#field int dwCodePage
#field SECURITY_ATTRIBUTES securityAttributes
#field GUID iid
#field intptr pUnk
#field int dwReserved
#endstruct
stdim st, BINDINFO ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize