Win32 API 日本語リファレンス
ホームDevices.Fax › _ERROR_INFOW

_ERROR_INFOW

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

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

フィールド

フィールドサイズx64x86
dwSizeDWORD4+0+0
dwGenericErrorDWORD4+4+4
dwVendorErrorDWORD4+8+8
szExtendedErrorTextWCHAR510+12+12

各言語での定義

#include <windows.h>

// _ERROR_INFOW  (x64 524 / x86 524 バイト)
typedef struct _ERROR_INFOW {
    DWORD dwSize;
    DWORD dwGenericError;
    DWORD dwVendorError;
    WCHAR szExtendedErrorText[255];
} _ERROR_INFOW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct _ERROR_INFOW
{
    public uint dwSize;
    public uint dwGenericError;
    public uint dwVendorError;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)] public string szExtendedErrorText;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure _ERROR_INFOW
    Public dwSize As UInteger
    Public dwGenericError As UInteger
    Public dwVendorError As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=255)> Public szExtendedErrorText As String
End Structure
import ctypes
from ctypes import wintypes

class _ERROR_INFOW(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwGenericError", wintypes.DWORD),
        ("dwVendorError", wintypes.DWORD),
        ("szExtendedErrorText", ctypes.c_wchar * 255),
    ]
#[repr(C)]
pub struct _ERROR_INFOW {
    pub dwSize: u32,
    pub dwGenericError: u32,
    pub dwVendorError: u32,
    pub szExtendedErrorText: [u16; 255],
}
import "golang.org/x/sys/windows"

type _ERROR_INFOW struct {
	dwSize uint32
	dwGenericError uint32
	dwVendorError uint32
	szExtendedErrorText [255]uint16
}
type
  _ERROR_INFOW = record
    dwSize: DWORD;
    dwGenericError: DWORD;
    dwVendorError: DWORD;
    szExtendedErrorText: array[0..254] of WideChar;
  end;
const _ERROR_INFOW = extern struct {
    dwSize: u32,
    dwGenericError: u32,
    dwVendorError: u32,
    szExtendedErrorText: [255]u16,
};
type
  _ERROR_INFOW {.bycopy.} = object
    dwSize: uint32
    dwGenericError: uint32
    dwVendorError: uint32
    szExtendedErrorText: array[255, uint16]
struct _ERROR_INFOW
{
    uint dwSize;
    uint dwGenericError;
    uint dwVendorError;
    wchar[255] szExtendedErrorText;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; _ERROR_INFOW サイズ: 524 バイト(x64)
dim st, 131    ; 4byte整数×131(構造体サイズ 524 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwGenericError : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwVendorError : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; szExtendedErrorText : WCHAR (+12, 510byte)  varptr(st)+12 を基点に操作(510byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global _ERROR_INFOW
    #field int dwSize
    #field int dwGenericError
    #field int dwVendorError
    #field wchar szExtendedErrorText 255
#endstruct

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