ホーム › System.Rpc › NDR64_PARAM_FORMAT
NDR64_PARAM_FORMAT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Type | void* | 8/4 | +0 | +0 | パラメータの型記述へのポインタ。NDR64フォーマット内の型を指す。 |
| Attributes | NDR64_PARAM_FLAGS | 2 | +8 | +4 | パラメータ属性フラグ(NDR64_PARAM_FLAGS)。方向や転送特性を表す。 |
| Reserved | WORD | 2 | +10 | +6 | 予約フィールド(WORD)。将来の拡張用。 |
| StackOffset | DWORD | 4 | +12 | +8 | スタックフレーム内でのパラメータのオフセット(バイト数)。 |
各言語での定義
#include <windows.h>
// NDR64_PARAM_FLAGS (x64 2 / x86 2 バイト)
typedef struct NDR64_PARAM_FLAGS {
WORD _bitfield;
} NDR64_PARAM_FLAGS;
// NDR64_PARAM_FORMAT (x64 16 / x86 12 バイト)
typedef struct NDR64_PARAM_FORMAT {
void* Type;
NDR64_PARAM_FLAGS Attributes;
WORD Reserved;
DWORD StackOffset;
} NDR64_PARAM_FORMAT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDR64_PARAM_FLAGS
{
public ushort _bitfield;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDR64_PARAM_FORMAT
{
public IntPtr Type;
public NDR64_PARAM_FLAGS Attributes;
public ushort Reserved;
public uint StackOffset;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDR64_PARAM_FLAGS
Public _bitfield As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDR64_PARAM_FORMAT
Public Type As IntPtr
Public Attributes As NDR64_PARAM_FLAGS
Public Reserved As UShort
Public StackOffset As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NDR64_PARAM_FLAGS(ctypes.Structure):
_fields_ = [
("_bitfield", ctypes.c_ushort),
]
class NDR64_PARAM_FORMAT(ctypes.Structure):
_fields_ = [
("Type", ctypes.c_void_p),
("Attributes", NDR64_PARAM_FLAGS),
("Reserved", ctypes.c_ushort),
("StackOffset", wintypes.DWORD),
]#[repr(C)]
pub struct NDR64_PARAM_FLAGS {
pub _bitfield: u16,
}
#[repr(C)]
pub struct NDR64_PARAM_FORMAT {
pub Type: *mut core::ffi::c_void,
pub Attributes: NDR64_PARAM_FLAGS,
pub Reserved: u16,
pub StackOffset: u32,
}import "golang.org/x/sys/windows"
type NDR64_PARAM_FLAGS struct {
_bitfield uint16
}
type NDR64_PARAM_FORMAT struct {
Type uintptr
Attributes NDR64_PARAM_FLAGS
Reserved uint16
StackOffset uint32
}type
NDR64_PARAM_FLAGS = record
_bitfield: Word;
end;
NDR64_PARAM_FORMAT = record
Type: Pointer;
Attributes: NDR64_PARAM_FLAGS;
Reserved: Word;
StackOffset: DWORD;
end;const NDR64_PARAM_FLAGS = extern struct {
_bitfield: u16,
};
const NDR64_PARAM_FORMAT = extern struct {
Type: ?*anyopaque,
Attributes: NDR64_PARAM_FLAGS,
Reserved: u16,
StackOffset: u32,
};type
NDR64_PARAM_FLAGS {.bycopy.} = object
_bitfield: uint16
NDR64_PARAM_FORMAT {.bycopy.} = object
Type: pointer
Attributes: NDR64_PARAM_FLAGS
Reserved: uint16
StackOffset: uint32struct NDR64_PARAM_FLAGS
{
ushort _bitfield;
}
struct NDR64_PARAM_FORMAT
{
void* Type;
NDR64_PARAM_FLAGS Attributes;
ushort Reserved;
uint StackOffset;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NDR64_PARAM_FORMAT サイズ: 12 バイト(x86)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Type : void* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Attributes : NDR64_PARAM_FLAGS (+4, 2byte) varptr(st)+4 を基点に操作(2byte:入れ子/配列)
; Reserved : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; StackOffset : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDR64_PARAM_FORMAT サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Type : void* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Attributes : NDR64_PARAM_FLAGS (+8, 2byte) varptr(st)+8 を基点に操作(2byte:入れ子/配列)
; Reserved : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; StackOffset : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NDR64_PARAM_FLAGS
#field short _bitfield
#endstruct
#defstruct global NDR64_PARAM_FORMAT
#field intptr Type
#field NDR64_PARAM_FLAGS Attributes
#field short Reserved
#field int StackOffset
#endstruct
stdim st, NDR64_PARAM_FORMAT ; NSTRUCT 変数を確保
st->Reserved = 100
mes "Reserved=" + st->Reserved