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