ホーム › System.Rpc › NDR64_BOGUS_ARRAY_HEADER_FORMAT
NDR64_BOGUS_ARRAY_HEADER_FORMAT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| FormatCode | BYTE | 1 | +0 | +0 | 複雑(bogus)配列を示すフォーマットコード。ポインタ等を要素に含む。 |
| Alignment | BYTE | 1 | +1 | +1 | 配列のアライメント(バイト数)。 |
| Flags | NDR64_ARRAY_FLAGS | 1 | +2 | +2 | 配列の属性フラグ(NDR64_ARRAY_FLAGS)。 |
| NumberDims | BYTE | 1 | +3 | +3 | 配列の次元数。 |
| NumberElements | DWORD | 4 | +4 | +4 | 配列の総要素数。 |
| Element | void* | 8/4 | +8 | +8 | 配列要素の型記述へのポインタ。 |
各言語での定義
#include <windows.h>
// NDR64_ARRAY_FLAGS (x64 1 / x86 1 バイト)
typedef struct NDR64_ARRAY_FLAGS {
BYTE _bitfield;
} NDR64_ARRAY_FLAGS;
// NDR64_BOGUS_ARRAY_HEADER_FORMAT (x64 16 / x86 12 バイト)
typedef struct NDR64_BOGUS_ARRAY_HEADER_FORMAT {
BYTE FormatCode;
BYTE Alignment;
NDR64_ARRAY_FLAGS Flags;
BYTE NumberDims;
DWORD NumberElements;
void* Element;
} NDR64_BOGUS_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_BOGUS_ARRAY_HEADER_FORMAT
{
public byte FormatCode;
public byte Alignment;
public NDR64_ARRAY_FLAGS Flags;
public byte NumberDims;
public uint NumberElements;
public IntPtr Element;
}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_BOGUS_ARRAY_HEADER_FORMAT
Public FormatCode As Byte
Public Alignment As Byte
Public Flags As NDR64_ARRAY_FLAGS
Public NumberDims As Byte
Public NumberElements As UInteger
Public Element As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class NDR64_ARRAY_FLAGS(ctypes.Structure):
_fields_ = [
("_bitfield", ctypes.c_ubyte),
]
class NDR64_BOGUS_ARRAY_HEADER_FORMAT(ctypes.Structure):
_fields_ = [
("FormatCode", ctypes.c_ubyte),
("Alignment", ctypes.c_ubyte),
("Flags", NDR64_ARRAY_FLAGS),
("NumberDims", ctypes.c_ubyte),
("NumberElements", wintypes.DWORD),
("Element", ctypes.c_void_p),
]#[repr(C)]
pub struct NDR64_ARRAY_FLAGS {
pub _bitfield: u8,
}
#[repr(C)]
pub struct NDR64_BOGUS_ARRAY_HEADER_FORMAT {
pub FormatCode: u8,
pub Alignment: u8,
pub Flags: NDR64_ARRAY_FLAGS,
pub NumberDims: u8,
pub NumberElements: u32,
pub Element: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type NDR64_ARRAY_FLAGS struct {
_bitfield byte
}
type NDR64_BOGUS_ARRAY_HEADER_FORMAT struct {
FormatCode byte
Alignment byte
Flags NDR64_ARRAY_FLAGS
NumberDims byte
NumberElements uint32
Element uintptr
}type
NDR64_ARRAY_FLAGS = record
_bitfield: Byte;
end;
NDR64_BOGUS_ARRAY_HEADER_FORMAT = record
FormatCode: Byte;
Alignment: Byte;
Flags: NDR64_ARRAY_FLAGS;
NumberDims: Byte;
NumberElements: DWORD;
Element: Pointer;
end;const NDR64_ARRAY_FLAGS = extern struct {
_bitfield: u8,
};
const NDR64_BOGUS_ARRAY_HEADER_FORMAT = extern struct {
FormatCode: u8,
Alignment: u8,
Flags: NDR64_ARRAY_FLAGS,
NumberDims: u8,
NumberElements: u32,
Element: ?*anyopaque,
};type
NDR64_ARRAY_FLAGS {.bycopy.} = object
_bitfield: uint8
NDR64_BOGUS_ARRAY_HEADER_FORMAT {.bycopy.} = object
FormatCode: uint8
Alignment: uint8
Flags: NDR64_ARRAY_FLAGS
NumberDims: uint8
NumberElements: uint32
Element: pointerstruct NDR64_ARRAY_FLAGS
{
ubyte _bitfield;
}
struct NDR64_BOGUS_ARRAY_HEADER_FORMAT
{
ubyte FormatCode;
ubyte Alignment;
NDR64_ARRAY_FLAGS Flags;
ubyte NumberDims;
uint NumberElements;
void* Element;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NDR64_BOGUS_ARRAY_HEADER_FORMAT サイズ: 12 バイト(x86)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 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:入れ子/配列)
; NumberDims : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; NumberElements : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Element : void* (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDR64_BOGUS_ARRAY_HEADER_FORMAT サイズ: 16 バイト(x64)
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:入れ子/配列)
; NumberDims : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; NumberElements : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Element : void* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※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_BOGUS_ARRAY_HEADER_FORMAT
#field byte FormatCode
#field byte Alignment
#field NDR64_ARRAY_FLAGS Flags
#field byte NumberDims
#field int NumberElements
#field intptr Element
#endstruct
stdim st, NDR64_BOGUS_ARRAY_HEADER_FORMAT ; NSTRUCT 変数を確保
st->FormatCode = 100
mes "FormatCode=" + st->FormatCode