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

RESTRICTION

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

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

フィールド

フィールドサイズx64x86説明
rtDWORD4+0+0検索条件の種類を示す値(RTAND/RTOR/RTCONTENT 等)。res の解釈を決める。
weightDWORD4+4+4この条件のランクへの寄与度(重み)。
res_URes72/56+8+8条件種別に応じた具体的な条件データを保持する共用体。

共用体: _URes x64 72B / x86 56B

フィールドサイズx64x86
arNODERESTRICTION24/12+0+0
orRestrictionNODERESTRICTION24/12+0+0
pxrNODERESTRICTION24/12+0+0
vrVECTORRESTRICTION32/16+0+0
nrNOTRESTRICTION8/4+0+0
crCONTENTRESTRICTION48/36+0+0
nlrNATLANGUAGERESTRICTION48/32+0+0
prPROPERTYRESTRICTION72/56+0+0

各言語での定義

#include <windows.h>

// RESTRICTION  (x64 80 / x86 64 バイト)
typedef struct RESTRICTION {
    DWORD rt;
    DWORD weight;
    _URes res;
} RESTRICTION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RESTRICTION
{
    public uint rt;
    public uint weight;
    public _URes res;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RESTRICTION
    Public rt As UInteger
    Public weight As UInteger
    Public res As _URes
End Structure
import ctypes
from ctypes import wintypes

class RESTRICTION(ctypes.Structure):
    _fields_ = [
        ("rt", wintypes.DWORD),
        ("weight", wintypes.DWORD),
        ("res", _URes),
    ]
#[repr(C)]
pub struct RESTRICTION {
    pub rt: u32,
    pub weight: u32,
    pub res: _URes,
}
import "golang.org/x/sys/windows"

type RESTRICTION struct {
	rt uint32
	weight uint32
	res _URes
}
type
  RESTRICTION = record
    rt: DWORD;
    weight: DWORD;
    res: _URes;
  end;
const RESTRICTION = extern struct {
    rt: u32,
    weight: u32,
    res: _URes,
};
type
  RESTRICTION {.bycopy.} = object
    rt: uint32
    weight: uint32
    res: _URes
struct RESTRICTION
{
    uint rt;
    uint weight;
    _URes res;
}

HSP用 定義

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

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

stdim st, RESTRICTION        ; NSTRUCT 変数を確保
st->rt = 100
mes "rt=" + st->rt
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。