Win32 API 日本語リファレンス
ホームData.Xml.MsXml › XML_ERROR

XML_ERROR

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

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

フィールド

フィールドサイズx64x86説明
_nLineDWORD4+0+0エラーが発生した行番号。
_pchBufLPWSTR8/4+8+4エラー箇所周辺のテキストバッファへのポインタ(ワイド文字列)。
_cchBufDWORD4+16+8_pchBufバッファの文字数。
_ichDWORD4+20+12バッファ内でエラーが発生した文字位置。
_pszFoundLPWSTR8/4+24+16実際に検出されたトークンを示す文字列(ワイド文字列)。
_pszExpectedLPWSTR8/4+32+20本来期待されたトークンを示す文字列(ワイド文字列)。
_reserved1DWORD4+40+24予約フィールド。
_reserved2DWORD4+44+28予約フィールド。

各言語での定義

#include <windows.h>

// XML_ERROR  (x64 48 / x86 32 バイト)
typedef struct XML_ERROR {
    DWORD _nLine;
    LPWSTR _pchBuf;
    DWORD _cchBuf;
    DWORD _ich;
    LPWSTR _pszFound;
    LPWSTR _pszExpected;
    DWORD _reserved1;
    DWORD _reserved2;
} XML_ERROR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XML_ERROR
{
    public uint _nLine;
    public IntPtr _pchBuf;
    public uint _cchBuf;
    public uint _ich;
    public IntPtr _pszFound;
    public IntPtr _pszExpected;
    public uint _reserved1;
    public uint _reserved2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XML_ERROR
    Public _nLine As UInteger
    Public _pchBuf As IntPtr
    Public _cchBuf As UInteger
    Public _ich As UInteger
    Public _pszFound As IntPtr
    Public _pszExpected As IntPtr
    Public _reserved1 As UInteger
    Public _reserved2 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class XML_ERROR(ctypes.Structure):
    _fields_ = [
        ("_nLine", wintypes.DWORD),
        ("_pchBuf", ctypes.c_void_p),
        ("_cchBuf", wintypes.DWORD),
        ("_ich", wintypes.DWORD),
        ("_pszFound", ctypes.c_void_p),
        ("_pszExpected", ctypes.c_void_p),
        ("_reserved1", wintypes.DWORD),
        ("_reserved2", wintypes.DWORD),
    ]
#[repr(C)]
pub struct XML_ERROR {
    pub _nLine: u32,
    pub _pchBuf: *mut core::ffi::c_void,
    pub _cchBuf: u32,
    pub _ich: u32,
    pub _pszFound: *mut core::ffi::c_void,
    pub _pszExpected: *mut core::ffi::c_void,
    pub _reserved1: u32,
    pub _reserved2: u32,
}
import "golang.org/x/sys/windows"

type XML_ERROR struct {
	_nLine uint32
	_pchBuf uintptr
	_cchBuf uint32
	_ich uint32
	_pszFound uintptr
	_pszExpected uintptr
	_reserved1 uint32
	_reserved2 uint32
}
type
  XML_ERROR = record
    _nLine: DWORD;
    _pchBuf: Pointer;
    _cchBuf: DWORD;
    _ich: DWORD;
    _pszFound: Pointer;
    _pszExpected: Pointer;
    _reserved1: DWORD;
    _reserved2: DWORD;
  end;
const XML_ERROR = extern struct {
    _nLine: u32,
    _pchBuf: ?*anyopaque,
    _cchBuf: u32,
    _ich: u32,
    _pszFound: ?*anyopaque,
    _pszExpected: ?*anyopaque,
    _reserved1: u32,
    _reserved2: u32,
};
type
  XML_ERROR {.bycopy.} = object
    _nLine: uint32
    _pchBuf: pointer
    _cchBuf: uint32
    _ich: uint32
    _pszFound: pointer
    _pszExpected: pointer
    _reserved1: uint32
    _reserved2: uint32
struct XML_ERROR
{
    uint _nLine;
    void* _pchBuf;
    uint _cchBuf;
    uint _ich;
    void* _pszFound;
    void* _pszExpected;
    uint _reserved1;
    uint _reserved2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; XML_ERROR サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; _nLine : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; _pchBuf : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; _cchBuf : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; _ich : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; _pszFound : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; _pszExpected : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; _reserved1 : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; _reserved2 : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XML_ERROR サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; _nLine : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; _pchBuf : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; _cchBuf : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; _ich : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; _pszFound : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; _pszExpected : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; _reserved1 : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; _reserved2 : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XML_ERROR
    #field int _nLine
    #field intptr _pchBuf
    #field int _cchBuf
    #field int _ich
    #field intptr _pszFound
    #field intptr _pszExpected
    #field int _reserved1
    #field int _reserved2
#endstruct

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