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

SHRINK_VOLUME_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
ShrinkRequestTypeSHRINK_VOLUME_REQUEST_TYPES4+0+0縮小要求の種別(準備/コミット/中止)を示す列挙値。
FlagsULONGLONG8+8+8縮小操作に関するフラグ。
NewNumberOfSectorsLONGLONG8+16+16縮小後のボリュームの新しいセクタ数。

各言語での定義

#include <windows.h>

// SHRINK_VOLUME_INFORMATION  (x64 24 / x86 24 バイト)
typedef struct SHRINK_VOLUME_INFORMATION {
    SHRINK_VOLUME_REQUEST_TYPES ShrinkRequestType;
    ULONGLONG Flags;
    LONGLONG NewNumberOfSectors;
} SHRINK_VOLUME_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHRINK_VOLUME_INFORMATION
{
    public int ShrinkRequestType;
    public ulong Flags;
    public long NewNumberOfSectors;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SHRINK_VOLUME_INFORMATION
    Public ShrinkRequestType As Integer
    Public Flags As ULong
    Public NewNumberOfSectors As Long
End Structure
import ctypes
from ctypes import wintypes

class SHRINK_VOLUME_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("ShrinkRequestType", ctypes.c_int),
        ("Flags", ctypes.c_ulonglong),
        ("NewNumberOfSectors", ctypes.c_longlong),
    ]
#[repr(C)]
pub struct SHRINK_VOLUME_INFORMATION {
    pub ShrinkRequestType: i32,
    pub Flags: u64,
    pub NewNumberOfSectors: i64,
}
import "golang.org/x/sys/windows"

type SHRINK_VOLUME_INFORMATION struct {
	ShrinkRequestType int32
	Flags uint64
	NewNumberOfSectors int64
}
type
  SHRINK_VOLUME_INFORMATION = record
    ShrinkRequestType: Integer;
    Flags: UInt64;
    NewNumberOfSectors: Int64;
  end;
const SHRINK_VOLUME_INFORMATION = extern struct {
    ShrinkRequestType: i32,
    Flags: u64,
    NewNumberOfSectors: i64,
};
type
  SHRINK_VOLUME_INFORMATION {.bycopy.} = object
    ShrinkRequestType: int32
    Flags: uint64
    NewNumberOfSectors: int64
struct SHRINK_VOLUME_INFORMATION
{
    int ShrinkRequestType;
    ulong Flags;
    long NewNumberOfSectors;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SHRINK_VOLUME_INFORMATION サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; ShrinkRequestType : SHRINK_VOLUME_REQUEST_TYPES (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Flags : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; NewNumberOfSectors : LONGLONG (+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 SHRINK_VOLUME_INFORMATION
    #field int ShrinkRequestType
    #field int64 Flags
    #field int64 NewNumberOfSectors
#endstruct

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