Win32 API 日本語リファレンス
ホームSystem.Rpc › NDR64_REPEAT_FORMAT

NDR64_REPEAT_FORMAT

構造体
サイズx64: 16 バイト / x86: 16 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
FormatCodeBYTE1+0+0繰り返しポインタレイアウトを示すフォーマットコード。
FlagsNDR64_POINTER_REPEAT_FLAGS1+1+1繰り返しポインタの属性フラグ(NDR64_POINTER_REPEAT_FLAGS)。
ReservedWORD2+2+2予約フィールド(WORD)。将来の拡張用。
IncrementDWORD4+4+4各繰り返し要素間のバイト増分(ストライド)。
OffsetToArrayDWORD4+8+8配列先頭への相対オフセット(バイト数)。
NumberOfPointersDWORD4+12+12各要素内に含まれるポインタの個数。

各言語での定義

#include <windows.h>

// NDR64_POINTER_REPEAT_FLAGS  (x64 1 / x86 1 バイト)
typedef struct NDR64_POINTER_REPEAT_FLAGS {
    BYTE _bitfield;
} NDR64_POINTER_REPEAT_FLAGS;

// NDR64_REPEAT_FORMAT  (x64 16 / x86 16 バイト)
typedef struct NDR64_REPEAT_FORMAT {
    BYTE FormatCode;
    NDR64_POINTER_REPEAT_FLAGS Flags;
    WORD Reserved;
    DWORD Increment;
    DWORD OffsetToArray;
    DWORD NumberOfPointers;
} NDR64_REPEAT_FORMAT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDR64_POINTER_REPEAT_FLAGS
{
    public byte _bitfield;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDR64_REPEAT_FORMAT
{
    public byte FormatCode;
    public NDR64_POINTER_REPEAT_FLAGS Flags;
    public ushort Reserved;
    public uint Increment;
    public uint OffsetToArray;
    public uint NumberOfPointers;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDR64_POINTER_REPEAT_FLAGS
    Public _bitfield As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDR64_REPEAT_FORMAT
    Public FormatCode As Byte
    Public Flags As NDR64_POINTER_REPEAT_FLAGS
    Public Reserved As UShort
    Public Increment As UInteger
    Public OffsetToArray As UInteger
    Public NumberOfPointers As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NDR64_POINTER_REPEAT_FLAGS(ctypes.Structure):
    _fields_ = [
        ("_bitfield", ctypes.c_ubyte),
    ]

class NDR64_REPEAT_FORMAT(ctypes.Structure):
    _fields_ = [
        ("FormatCode", ctypes.c_ubyte),
        ("Flags", NDR64_POINTER_REPEAT_FLAGS),
        ("Reserved", ctypes.c_ushort),
        ("Increment", wintypes.DWORD),
        ("OffsetToArray", wintypes.DWORD),
        ("NumberOfPointers", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NDR64_POINTER_REPEAT_FLAGS {
    pub _bitfield: u8,
}

#[repr(C)]
pub struct NDR64_REPEAT_FORMAT {
    pub FormatCode: u8,
    pub Flags: NDR64_POINTER_REPEAT_FLAGS,
    pub Reserved: u16,
    pub Increment: u32,
    pub OffsetToArray: u32,
    pub NumberOfPointers: u32,
}
import "golang.org/x/sys/windows"

type NDR64_POINTER_REPEAT_FLAGS struct {
	_bitfield byte
}

type NDR64_REPEAT_FORMAT struct {
	FormatCode byte
	Flags NDR64_POINTER_REPEAT_FLAGS
	Reserved uint16
	Increment uint32
	OffsetToArray uint32
	NumberOfPointers uint32
}
type
  NDR64_POINTER_REPEAT_FLAGS = record
    _bitfield: Byte;
  end;

  NDR64_REPEAT_FORMAT = record
    FormatCode: Byte;
    Flags: NDR64_POINTER_REPEAT_FLAGS;
    Reserved: Word;
    Increment: DWORD;
    OffsetToArray: DWORD;
    NumberOfPointers: DWORD;
  end;
const NDR64_POINTER_REPEAT_FLAGS = extern struct {
    _bitfield: u8,
};

const NDR64_REPEAT_FORMAT = extern struct {
    FormatCode: u8,
    Flags: NDR64_POINTER_REPEAT_FLAGS,
    Reserved: u16,
    Increment: u32,
    OffsetToArray: u32,
    NumberOfPointers: u32,
};
type
  NDR64_POINTER_REPEAT_FLAGS {.bycopy.} = object
    _bitfield: uint8

  NDR64_REPEAT_FORMAT {.bycopy.} = object
    FormatCode: uint8
    Flags: NDR64_POINTER_REPEAT_FLAGS
    Reserved: uint16
    Increment: uint32
    OffsetToArray: uint32
    NumberOfPointers: uint32
struct NDR64_POINTER_REPEAT_FLAGS
{
    ubyte _bitfield;
}

struct NDR64_REPEAT_FORMAT
{
    ubyte FormatCode;
    NDR64_POINTER_REPEAT_FLAGS Flags;
    ushort Reserved;
    uint Increment;
    uint OffsetToArray;
    uint NumberOfPointers;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDR64_REPEAT_FORMAT サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; FormatCode : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; Flags : NDR64_POINTER_REPEAT_FLAGS (+1, 1byte)  varptr(st)+1 を基点に操作(1byte:入れ子/配列)
; Reserved : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; Increment : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; OffsetToArray : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; NumberOfPointers : 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_POINTER_REPEAT_FLAGS
    #field byte _bitfield
#endstruct

#defstruct global NDR64_REPEAT_FORMAT
    #field byte FormatCode
    #field NDR64_POINTER_REPEAT_FLAGS Flags
    #field short Reserved
    #field int Increment
    #field int OffsetToArray
    #field int NumberOfPointers
#endstruct

stdim st, NDR64_REPEAT_FORMAT        ; NSTRUCT 変数を確保
st->FormatCode = 100
mes "FormatCode=" + st->FormatCode