ホーム › Devices.WebServicesOnDevices › WSD_THIS_DEVICE_METADATA
WSD_THIS_DEVICE_METADATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| FriendlyName | WSD_LOCALIZED_STRING_LIST* | 8/4 | +0 | +0 | デバイスのフレンドリ名(多言語文字列リスト)。 |
| FirmwareVersion | LPWSTR | 8/4 | +8 | +4 | デバイスのファームウェアバージョン文字列。 |
| SerialNumber | LPWSTR | 8/4 | +16 | +8 | デバイスのシリアル番号文字列。 |
| Any | WSDXML_ELEMENT* | 8/4 | +24 | +12 | 拡張用の任意XML要素へのポインタ。 |
各言語での定義
#include <windows.h>
// WSD_THIS_DEVICE_METADATA (x64 32 / x86 16 バイト)
typedef struct WSD_THIS_DEVICE_METADATA {
WSD_LOCALIZED_STRING_LIST* FriendlyName;
LPWSTR FirmwareVersion;
LPWSTR SerialNumber;
WSDXML_ELEMENT* Any;
} WSD_THIS_DEVICE_METADATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSD_THIS_DEVICE_METADATA
{
public IntPtr FriendlyName;
public IntPtr FirmwareVersion;
public IntPtr SerialNumber;
public IntPtr Any;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSD_THIS_DEVICE_METADATA
Public FriendlyName As IntPtr
Public FirmwareVersion As IntPtr
Public SerialNumber As IntPtr
Public Any As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class WSD_THIS_DEVICE_METADATA(ctypes.Structure):
_fields_ = [
("FriendlyName", ctypes.c_void_p),
("FirmwareVersion", ctypes.c_void_p),
("SerialNumber", ctypes.c_void_p),
("Any", ctypes.c_void_p),
]#[repr(C)]
pub struct WSD_THIS_DEVICE_METADATA {
pub FriendlyName: *mut core::ffi::c_void,
pub FirmwareVersion: *mut core::ffi::c_void,
pub SerialNumber: *mut core::ffi::c_void,
pub Any: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type WSD_THIS_DEVICE_METADATA struct {
FriendlyName uintptr
FirmwareVersion uintptr
SerialNumber uintptr
Any uintptr
}type
WSD_THIS_DEVICE_METADATA = record
FriendlyName: Pointer;
FirmwareVersion: Pointer;
SerialNumber: Pointer;
Any: Pointer;
end;const WSD_THIS_DEVICE_METADATA = extern struct {
FriendlyName: ?*anyopaque,
FirmwareVersion: ?*anyopaque,
SerialNumber: ?*anyopaque,
Any: ?*anyopaque,
};type
WSD_THIS_DEVICE_METADATA {.bycopy.} = object
FriendlyName: pointer
FirmwareVersion: pointer
SerialNumber: pointer
Any: pointerstruct WSD_THIS_DEVICE_METADATA
{
void* FriendlyName;
void* FirmwareVersion;
void* SerialNumber;
void* Any;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WSD_THIS_DEVICE_METADATA サイズ: 16 バイト(x86)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; FriendlyName : WSD_LOCALIZED_STRING_LIST* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; FirmwareVersion : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; SerialNumber : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Any : WSDXML_ELEMENT* (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WSD_THIS_DEVICE_METADATA サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; FriendlyName : WSD_LOCALIZED_STRING_LIST* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; FirmwareVersion : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; SerialNumber : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Any : WSDXML_ELEMENT* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WSD_THIS_DEVICE_METADATA
#field intptr FriendlyName
#field intptr FirmwareVersion
#field intptr SerialNumber
#field intptr Any
#endstruct
stdim st, WSD_THIS_DEVICE_METADATA ; NSTRUCT 変数を確保