Win32 API 日本語リファレンス
ホームNetworkManagement.NetworkDiagnosticsFramework › HypothesisResult

HypothesisResult

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

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

フィールド

フィールドサイズx64x86説明
hypothesisHYPOTHESIS32/16+0+0検証対象となった仮説を表すHYPOTHESIS構造体。
pathStatusDIAGNOSIS_STATUS4+32+16当該パスの診断結果を示すDIAGNOSIS_STATUS列挙値。

各言語での定義

#include <windows.h>

// HYPOTHESIS  (x64 32 / x86 16 バイト)
typedef struct HYPOTHESIS {
    LPWSTR pwszClassName;
    LPWSTR pwszDescription;
    DWORD celt;
    HELPER_ATTRIBUTE* rgAttributes;
} HYPOTHESIS;

// HypothesisResult  (x64 40 / x86 20 バイト)
typedef struct HypothesisResult {
    HYPOTHESIS hypothesis;
    DIAGNOSIS_STATUS pathStatus;
} HypothesisResult;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HYPOTHESIS
{
    public IntPtr pwszClassName;
    public IntPtr pwszDescription;
    public uint celt;
    public IntPtr rgAttributes;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HypothesisResult
{
    public HYPOTHESIS hypothesis;
    public int pathStatus;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HYPOTHESIS
    Public pwszClassName As IntPtr
    Public pwszDescription As IntPtr
    Public celt As UInteger
    Public rgAttributes As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HypothesisResult
    Public hypothesis As HYPOTHESIS
    Public pathStatus As Integer
End Structure
import ctypes
from ctypes import wintypes

class HYPOTHESIS(ctypes.Structure):
    _fields_ = [
        ("pwszClassName", ctypes.c_void_p),
        ("pwszDescription", ctypes.c_void_p),
        ("celt", wintypes.DWORD),
        ("rgAttributes", ctypes.c_void_p),
    ]

class HypothesisResult(ctypes.Structure):
    _fields_ = [
        ("hypothesis", HYPOTHESIS),
        ("pathStatus", ctypes.c_int),
    ]
#[repr(C)]
pub struct HYPOTHESIS {
    pub pwszClassName: *mut core::ffi::c_void,
    pub pwszDescription: *mut core::ffi::c_void,
    pub celt: u32,
    pub rgAttributes: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct HypothesisResult {
    pub hypothesis: HYPOTHESIS,
    pub pathStatus: i32,
}
import "golang.org/x/sys/windows"

type HYPOTHESIS struct {
	pwszClassName uintptr
	pwszDescription uintptr
	celt uint32
	rgAttributes uintptr
}

type HypothesisResult struct {
	hypothesis HYPOTHESIS
	pathStatus int32
}
type
  HYPOTHESIS = record
    pwszClassName: Pointer;
    pwszDescription: Pointer;
    celt: DWORD;
    rgAttributes: Pointer;
  end;

  HypothesisResult = record
    hypothesis: HYPOTHESIS;
    pathStatus: Integer;
  end;
const HYPOTHESIS = extern struct {
    pwszClassName: ?*anyopaque,
    pwszDescription: ?*anyopaque,
    celt: u32,
    rgAttributes: ?*anyopaque,
};

const HypothesisResult = extern struct {
    hypothesis: HYPOTHESIS,
    pathStatus: i32,
};
type
  HYPOTHESIS {.bycopy.} = object
    pwszClassName: pointer
    pwszDescription: pointer
    celt: uint32
    rgAttributes: pointer

  HypothesisResult {.bycopy.} = object
    hypothesis: HYPOTHESIS
    pathStatus: int32
struct HYPOTHESIS
{
    void* pwszClassName;
    void* pwszDescription;
    uint celt;
    void* rgAttributes;
}

struct HypothesisResult
{
    HYPOTHESIS hypothesis;
    int pathStatus;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; HypothesisResult サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; hypothesis : HYPOTHESIS (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; pathStatus : DIAGNOSIS_STATUS (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HypothesisResult サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; hypothesis : HYPOTHESIS (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; pathStatus : DIAGNOSIS_STATUS (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global HYPOTHESIS
    #field intptr pwszClassName
    #field intptr pwszDescription
    #field int celt
    #field intptr rgAttributes
#endstruct

#defstruct global HypothesisResult
    #field HYPOTHESIS hypothesis
    #field int pathStatus
#endstruct

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