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

BIN_RESULTS

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

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

フィールド

フィールドサイズx64x86説明
NumberOfBinsDWORD4+0+0BinCounts配列に含まれるビンの数。
BinCountsBIN_COUNT24+8+8BIN_COUNTの可変長配列。先頭要素。

各言語での定義

#include <windows.h>

// BIN_RANGE  (x64 16 / x86 16 バイト)
typedef struct BIN_RANGE {
    LONGLONG StartValue;
    LONGLONG Length;
} BIN_RANGE;

// BIN_COUNT  (x64 24 / x86 24 バイト)
typedef struct BIN_COUNT {
    BIN_RANGE BinRange;
    DWORD BinCount;
} BIN_COUNT;

// BIN_RESULTS  (x64 32 / x86 32 バイト)
typedef struct BIN_RESULTS {
    DWORD NumberOfBins;
    BIN_COUNT BinCounts[1];
} BIN_RESULTS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BIN_RANGE
{
    public long StartValue;
    public long Length;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BIN_COUNT
{
    public BIN_RANGE BinRange;
    public uint BinCount;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BIN_RESULTS
{
    public uint NumberOfBins;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public BIN_COUNT[] BinCounts;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BIN_RANGE
    Public StartValue As Long
    Public Length As Long
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BIN_COUNT
    Public BinRange As BIN_RANGE
    Public BinCount As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BIN_RESULTS
    Public NumberOfBins As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public BinCounts() As BIN_COUNT
End Structure
import ctypes
from ctypes import wintypes

class BIN_RANGE(ctypes.Structure):
    _fields_ = [
        ("StartValue", ctypes.c_longlong),
        ("Length", ctypes.c_longlong),
    ]

class BIN_COUNT(ctypes.Structure):
    _fields_ = [
        ("BinRange", BIN_RANGE),
        ("BinCount", wintypes.DWORD),
    ]

class BIN_RESULTS(ctypes.Structure):
    _fields_ = [
        ("NumberOfBins", wintypes.DWORD),
        ("BinCounts", BIN_COUNT * 1),
    ]
#[repr(C)]
pub struct BIN_RANGE {
    pub StartValue: i64,
    pub Length: i64,
}

#[repr(C)]
pub struct BIN_COUNT {
    pub BinRange: BIN_RANGE,
    pub BinCount: u32,
}

#[repr(C)]
pub struct BIN_RESULTS {
    pub NumberOfBins: u32,
    pub BinCounts: [BIN_COUNT; 1],
}
import "golang.org/x/sys/windows"

type BIN_RANGE struct {
	StartValue int64
	Length int64
}

type BIN_COUNT struct {
	BinRange BIN_RANGE
	BinCount uint32
}

type BIN_RESULTS struct {
	NumberOfBins uint32
	BinCounts [1]BIN_COUNT
}
type
  BIN_RANGE = record
    StartValue: Int64;
    Length: Int64;
  end;

  BIN_COUNT = record
    BinRange: BIN_RANGE;
    BinCount: DWORD;
  end;

  BIN_RESULTS = record
    NumberOfBins: DWORD;
    BinCounts: array[0..0] of BIN_COUNT;
  end;
const BIN_RANGE = extern struct {
    StartValue: i64,
    Length: i64,
};

const BIN_COUNT = extern struct {
    BinRange: BIN_RANGE,
    BinCount: u32,
};

const BIN_RESULTS = extern struct {
    NumberOfBins: u32,
    BinCounts: [1]BIN_COUNT,
};
type
  BIN_RANGE {.bycopy.} = object
    StartValue: int64
    Length: int64

  BIN_COUNT {.bycopy.} = object
    BinRange: BIN_RANGE
    BinCount: uint32

  BIN_RESULTS {.bycopy.} = object
    NumberOfBins: uint32
    BinCounts: array[1, BIN_COUNT]
struct BIN_RANGE
{
    long StartValue;
    long Length;
}

struct BIN_COUNT
{
    BIN_RANGE BinRange;
    uint BinCount;
}

struct BIN_RESULTS
{
    uint NumberOfBins;
    BIN_COUNT[1] BinCounts;
}

HSP用 定義

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

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

#defstruct global BIN_COUNT
    #field BIN_RANGE BinRange
    #field int BinCount
#endstruct

#defstruct global BIN_RESULTS
    #field int NumberOfBins
    #field BIN_COUNT BinCounts 1
#endstruct

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