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

NDR64_CONFORMANT_STRING_FORMAT

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDR64_STRING_HEADER_FORMAT4+0+0文字列共通ヘッダ情報(NDR64_STRING_HEADER_FORMAT)。可変長文字列を表す。

各言語での定義

#include <windows.h>

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

// NDR64_STRING_HEADER_FORMAT  (x64 4 / x86 4 バイト)
typedef struct NDR64_STRING_HEADER_FORMAT {
    BYTE FormatCode;
    NDR64_STRING_FLAGS Flags;
    WORD ElementSize;
} NDR64_STRING_HEADER_FORMAT;

// NDR64_CONFORMANT_STRING_FORMAT  (x64 4 / x86 4 バイト)
typedef struct NDR64_CONFORMANT_STRING_FORMAT {
    NDR64_STRING_HEADER_FORMAT Header;
} NDR64_CONFORMANT_STRING_FORMAT;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDR64_STRING_HEADER_FORMAT
{
    public byte FormatCode;
    public NDR64_STRING_FLAGS Flags;
    public ushort ElementSize;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDR64_CONFORMANT_STRING_FORMAT
{
    public NDR64_STRING_HEADER_FORMAT Header;
}
Imports System.Runtime.InteropServices

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDR64_STRING_HEADER_FORMAT
    Public FormatCode As Byte
    Public Flags As NDR64_STRING_FLAGS
    Public ElementSize As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDR64_CONFORMANT_STRING_FORMAT
    Public Header As NDR64_STRING_HEADER_FORMAT
End Structure
import ctypes
from ctypes import wintypes

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

class NDR64_STRING_HEADER_FORMAT(ctypes.Structure):
    _fields_ = [
        ("FormatCode", ctypes.c_ubyte),
        ("Flags", NDR64_STRING_FLAGS),
        ("ElementSize", ctypes.c_ushort),
    ]

class NDR64_CONFORMANT_STRING_FORMAT(ctypes.Structure):
    _fields_ = [
        ("Header", NDR64_STRING_HEADER_FORMAT),
    ]
#[repr(C)]
pub struct NDR64_STRING_FLAGS {
    pub _bitfield: u8,
}

#[repr(C)]
pub struct NDR64_STRING_HEADER_FORMAT {
    pub FormatCode: u8,
    pub Flags: NDR64_STRING_FLAGS,
    pub ElementSize: u16,
}

#[repr(C)]
pub struct NDR64_CONFORMANT_STRING_FORMAT {
    pub Header: NDR64_STRING_HEADER_FORMAT,
}
import "golang.org/x/sys/windows"

type NDR64_STRING_FLAGS struct {
	_bitfield byte
}

type NDR64_STRING_HEADER_FORMAT struct {
	FormatCode byte
	Flags NDR64_STRING_FLAGS
	ElementSize uint16
}

type NDR64_CONFORMANT_STRING_FORMAT struct {
	Header NDR64_STRING_HEADER_FORMAT
}
type
  NDR64_STRING_FLAGS = record
    _bitfield: Byte;
  end;

  NDR64_STRING_HEADER_FORMAT = record
    FormatCode: Byte;
    Flags: NDR64_STRING_FLAGS;
    ElementSize: Word;
  end;

  NDR64_CONFORMANT_STRING_FORMAT = record
    Header: NDR64_STRING_HEADER_FORMAT;
  end;
const NDR64_STRING_FLAGS = extern struct {
    _bitfield: u8,
};

const NDR64_STRING_HEADER_FORMAT = extern struct {
    FormatCode: u8,
    Flags: NDR64_STRING_FLAGS,
    ElementSize: u16,
};

const NDR64_CONFORMANT_STRING_FORMAT = extern struct {
    Header: NDR64_STRING_HEADER_FORMAT,
};
type
  NDR64_STRING_FLAGS {.bycopy.} = object
    _bitfield: uint8

  NDR64_STRING_HEADER_FORMAT {.bycopy.} = object
    FormatCode: uint8
    Flags: NDR64_STRING_FLAGS
    ElementSize: uint16

  NDR64_CONFORMANT_STRING_FORMAT {.bycopy.} = object
    Header: NDR64_STRING_HEADER_FORMAT
struct NDR64_STRING_FLAGS
{
    ubyte _bitfield;
}

struct NDR64_STRING_HEADER_FORMAT
{
    ubyte FormatCode;
    NDR64_STRING_FLAGS Flags;
    ushort ElementSize;
}

struct NDR64_CONFORMANT_STRING_FORMAT
{
    NDR64_STRING_HEADER_FORMAT Header;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDR64_CONFORMANT_STRING_FORMAT サイズ: 4 バイト(x64)
dim st, 1    ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; Header : NDR64_STRING_HEADER_FORMAT (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NDR64_STRING_FLAGS
    #field byte _bitfield
#endstruct

#defstruct global NDR64_STRING_HEADER_FORMAT
    #field byte FormatCode
    #field NDR64_STRING_FLAGS Flags
    #field short ElementSize
#endstruct

#defstruct global NDR64_CONFORMANT_STRING_FORMAT
    #field NDR64_STRING_HEADER_FORMAT Header
#endstruct

stdim st, NDR64_CONFORMANT_STRING_FORMAT        ; NSTRUCT 変数を確保