Win32 API 日本語リファレンス
ホームStorage.IscsiDisc › HYBRID_DEMOTE_BY_SIZE

HYBRID_DEMOTE_BY_SIZE

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0この構造体のバージョン番号。
SizeDWORD4+4+4この構造体のバイトサイズ。
SourcePriorityBYTE1+8+8降格元の優先度レベル。
TargetPriorityBYTE1+9+9降格先の優先度レベル。
Reserved0WORD2+10+10予約フィールド。0を設定する。
Reserved1DWORD4+12+12予約フィールド。0を設定する。
LbaCountULONGLONG8+16+16降格対象とする論理ブロック数。

各言語での定義

#include <windows.h>

// HYBRID_DEMOTE_BY_SIZE  (x64 24 / x86 24 バイト)
typedef struct HYBRID_DEMOTE_BY_SIZE {
    DWORD Version;
    DWORD Size;
    BYTE SourcePriority;
    BYTE TargetPriority;
    WORD Reserved0;
    DWORD Reserved1;
    ULONGLONG LbaCount;
} HYBRID_DEMOTE_BY_SIZE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HYBRID_DEMOTE_BY_SIZE
{
    public uint Version;
    public uint Size;
    public byte SourcePriority;
    public byte TargetPriority;
    public ushort Reserved0;
    public uint Reserved1;
    public ulong LbaCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HYBRID_DEMOTE_BY_SIZE
    Public Version As UInteger
    Public Size As UInteger
    Public SourcePriority As Byte
    Public TargetPriority As Byte
    Public Reserved0 As UShort
    Public Reserved1 As UInteger
    Public LbaCount As ULong
End Structure
import ctypes
from ctypes import wintypes

class HYBRID_DEMOTE_BY_SIZE(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("SourcePriority", ctypes.c_ubyte),
        ("TargetPriority", ctypes.c_ubyte),
        ("Reserved0", ctypes.c_ushort),
        ("Reserved1", wintypes.DWORD),
        ("LbaCount", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct HYBRID_DEMOTE_BY_SIZE {
    pub Version: u32,
    pub Size: u32,
    pub SourcePriority: u8,
    pub TargetPriority: u8,
    pub Reserved0: u16,
    pub Reserved1: u32,
    pub LbaCount: u64,
}
import "golang.org/x/sys/windows"

type HYBRID_DEMOTE_BY_SIZE struct {
	Version uint32
	Size uint32
	SourcePriority byte
	TargetPriority byte
	Reserved0 uint16
	Reserved1 uint32
	LbaCount uint64
}
type
  HYBRID_DEMOTE_BY_SIZE = record
    Version: DWORD;
    Size: DWORD;
    SourcePriority: Byte;
    TargetPriority: Byte;
    Reserved0: Word;
    Reserved1: DWORD;
    LbaCount: UInt64;
  end;
const HYBRID_DEMOTE_BY_SIZE = extern struct {
    Version: u32,
    Size: u32,
    SourcePriority: u8,
    TargetPriority: u8,
    Reserved0: u16,
    Reserved1: u32,
    LbaCount: u64,
};
type
  HYBRID_DEMOTE_BY_SIZE {.bycopy.} = object
    Version: uint32
    Size: uint32
    SourcePriority: uint8
    TargetPriority: uint8
    Reserved0: uint16
    Reserved1: uint32
    LbaCount: uint64
struct HYBRID_DEMOTE_BY_SIZE
{
    uint Version;
    uint Size;
    ubyte SourcePriority;
    ubyte TargetPriority;
    ushort Reserved0;
    uint Reserved1;
    ulong LbaCount;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HYBRID_DEMOTE_BY_SIZE サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; SourcePriority : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; TargetPriority : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; Reserved0 : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; Reserved1 : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; LbaCount : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HYBRID_DEMOTE_BY_SIZE
    #field int Version
    #field int Size
    #field byte SourcePriority
    #field byte TargetPriority
    #field short Reserved0
    #field int Reserved1
    #field int64 LbaCount
#endstruct

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