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