ホーム › System.RemoteDesktop › WTS_VALIDATION_INFORMATIONW
WTS_VALIDATION_INFORMATIONW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ProductInfo | PRODUCT_INFOW | 520 | +0 | +0 | 製品情報(会社名・製品ID)を含む構造体(Unicode)。 |
| License | BYTE | 16384 | +520 | +520 | ライセンスデータの本体。バイト配列。 |
| LicenseLength | DWORD | 4 | +16904 | +16904 | ライセンスデータの長さ。バイト数で表す。 |
| HardwareID | BYTE | 20 | +16908 | +16908 | ハードウェア識別子データ。バイト配列。 |
| HardwareIDLength | DWORD | 4 | +16928 | +16928 | ハードウェア識別子データの長さ。バイト数で表す。 |
各言語での定義
#include <windows.h>
// PRODUCT_INFOW (x64 520 / x86 520 バイト)
typedef struct PRODUCT_INFOW {
WCHAR CompanyName[256];
WCHAR ProductID[4];
} PRODUCT_INFOW;
// WTS_VALIDATION_INFORMATIONW (x64 16932 / x86 16932 バイト)
typedef struct WTS_VALIDATION_INFORMATIONW {
PRODUCT_INFOW ProductInfo;
BYTE License[16384];
DWORD LicenseLength;
BYTE HardwareID[20];
DWORD HardwareIDLength;
} WTS_VALIDATION_INFORMATIONW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRODUCT_INFOW
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string CompanyName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] public string ProductID;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_VALIDATION_INFORMATIONW
{
public PRODUCT_INFOW ProductInfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16384)] public byte[] License;
public uint LicenseLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] HardwareID;
public uint HardwareIDLength;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRODUCT_INFOW
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public CompanyName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=4)> Public ProductID As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_VALIDATION_INFORMATIONW
Public ProductInfo As PRODUCT_INFOW
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16384)> Public License() As Byte
Public LicenseLength As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> Public HardwareID() As Byte
Public HardwareIDLength As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PRODUCT_INFOW(ctypes.Structure):
_fields_ = [
("CompanyName", ctypes.c_wchar * 256),
("ProductID", ctypes.c_wchar * 4),
]
class WTS_VALIDATION_INFORMATIONW(ctypes.Structure):
_fields_ = [
("ProductInfo", PRODUCT_INFOW),
("License", ctypes.c_ubyte * 16384),
("LicenseLength", wintypes.DWORD),
("HardwareID", ctypes.c_ubyte * 20),
("HardwareIDLength", wintypes.DWORD),
]#[repr(C)]
pub struct PRODUCT_INFOW {
pub CompanyName: [u16; 256],
pub ProductID: [u16; 4],
}
#[repr(C)]
pub struct WTS_VALIDATION_INFORMATIONW {
pub ProductInfo: PRODUCT_INFOW,
pub License: [u8; 16384],
pub LicenseLength: u32,
pub HardwareID: [u8; 20],
pub HardwareIDLength: u32,
}import "golang.org/x/sys/windows"
type PRODUCT_INFOW struct {
CompanyName [256]uint16
ProductID [4]uint16
}
type WTS_VALIDATION_INFORMATIONW struct {
ProductInfo PRODUCT_INFOW
License [16384]byte
LicenseLength uint32
HardwareID [20]byte
HardwareIDLength uint32
}type
PRODUCT_INFOW = record
CompanyName: array[0..255] of WideChar;
ProductID: array[0..3] of WideChar;
end;
WTS_VALIDATION_INFORMATIONW = record
ProductInfo: PRODUCT_INFOW;
License: array[0..16383] of Byte;
LicenseLength: DWORD;
HardwareID: array[0..19] of Byte;
HardwareIDLength: DWORD;
end;const PRODUCT_INFOW = extern struct {
CompanyName: [256]u16,
ProductID: [4]u16,
};
const WTS_VALIDATION_INFORMATIONW = extern struct {
ProductInfo: PRODUCT_INFOW,
License: [16384]u8,
LicenseLength: u32,
HardwareID: [20]u8,
HardwareIDLength: u32,
};type
PRODUCT_INFOW {.bycopy.} = object
CompanyName: array[256, uint16]
ProductID: array[4, uint16]
WTS_VALIDATION_INFORMATIONW {.bycopy.} = object
ProductInfo: PRODUCT_INFOW
License: array[16384, uint8]
LicenseLength: uint32
HardwareID: array[20, uint8]
HardwareIDLength: uint32struct PRODUCT_INFOW
{
wchar[256] CompanyName;
wchar[4] ProductID;
}
struct WTS_VALIDATION_INFORMATIONW
{
PRODUCT_INFOW ProductInfo;
ubyte[16384] License;
uint LicenseLength;
ubyte[20] HardwareID;
uint HardwareIDLength;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTS_VALIDATION_INFORMATIONW サイズ: 16932 バイト(x64)
dim st, 4233 ; 4byte整数×4233(構造体サイズ 16932 / 4 切り上げ)
; ProductInfo : PRODUCT_INFOW (+0, 520byte) varptr(st)+0 を基点に操作(520byte:入れ子/配列)
; License : BYTE (+520, 16384byte) varptr(st)+520 を基点に操作(16384byte:入れ子/配列)
; LicenseLength : DWORD (+16904, 4byte) st.4226 = 値 / 値 = st.4226 (lpoke/lpeek も可)
; HardwareID : BYTE (+16908, 20byte) varptr(st)+16908 を基点に操作(20byte:入れ子/配列)
; HardwareIDLength : DWORD (+16928, 4byte) st.4232 = 値 / 値 = st.4232 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PRODUCT_INFOW
#field wchar CompanyName 256
#field wchar ProductID 4
#endstruct
#defstruct global WTS_VALIDATION_INFORMATIONW
#field PRODUCT_INFOW ProductInfo
#field byte License 16384
#field int LicenseLength
#field byte HardwareID 20
#field int HardwareIDLength
#endstruct
stdim st, WTS_VALIDATION_INFORMATIONW ; NSTRUCT 変数を確保
st->LicenseLength = 100
mes "LicenseLength=" + st->LicenseLength