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

VDS_PATH_POLICY

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

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

フィールド

フィールドサイズx64x86説明
pathIdVDS_PATH_ID16+0+0ポリシー対象のI/Oパスを識別するVDS_PATH_ID構造体。
bPrimaryPathBOOL4+16+16このパスがプライマリパスか否かを示すBOOL値。
ulWeightDWORD4+20+20ロードバランシング時のパスの重み付け値。

各言語での定義

#include <windows.h>

// VDS_PATH_ID  (x64 16 / x86 16 バイト)
typedef struct VDS_PATH_ID {
    ULONGLONG ullSourceId;
    ULONGLONG ullPathId;
} VDS_PATH_ID;

// VDS_PATH_POLICY  (x64 24 / x86 24 バイト)
typedef struct VDS_PATH_POLICY {
    VDS_PATH_ID pathId;
    BOOL bPrimaryPath;
    DWORD ulWeight;
} VDS_PATH_POLICY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_PATH_ID
{
    public ulong ullSourceId;
    public ulong ullPathId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_PATH_POLICY
{
    public VDS_PATH_ID pathId;
    [MarshalAs(UnmanagedType.Bool)] public bool bPrimaryPath;
    public uint ulWeight;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_PATH_ID
    Public ullSourceId As ULong
    Public ullPathId As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_PATH_POLICY
    Public pathId As VDS_PATH_ID
    <MarshalAs(UnmanagedType.Bool)> Public bPrimaryPath As Boolean
    Public ulWeight As UInteger
End Structure
import ctypes
from ctypes import wintypes

class VDS_PATH_ID(ctypes.Structure):
    _fields_ = [
        ("ullSourceId", ctypes.c_ulonglong),
        ("ullPathId", ctypes.c_ulonglong),
    ]

class VDS_PATH_POLICY(ctypes.Structure):
    _fields_ = [
        ("pathId", VDS_PATH_ID),
        ("bPrimaryPath", wintypes.BOOL),
        ("ulWeight", wintypes.DWORD),
    ]
#[repr(C)]
pub struct VDS_PATH_ID {
    pub ullSourceId: u64,
    pub ullPathId: u64,
}

#[repr(C)]
pub struct VDS_PATH_POLICY {
    pub pathId: VDS_PATH_ID,
    pub bPrimaryPath: i32,
    pub ulWeight: u32,
}
import "golang.org/x/sys/windows"

type VDS_PATH_ID struct {
	ullSourceId uint64
	ullPathId uint64
}

type VDS_PATH_POLICY struct {
	pathId VDS_PATH_ID
	bPrimaryPath int32
	ulWeight uint32
}
type
  VDS_PATH_ID = record
    ullSourceId: UInt64;
    ullPathId: UInt64;
  end;

  VDS_PATH_POLICY = record
    pathId: VDS_PATH_ID;
    bPrimaryPath: BOOL;
    ulWeight: DWORD;
  end;
const VDS_PATH_ID = extern struct {
    ullSourceId: u64,
    ullPathId: u64,
};

const VDS_PATH_POLICY = extern struct {
    pathId: VDS_PATH_ID,
    bPrimaryPath: i32,
    ulWeight: u32,
};
type
  VDS_PATH_ID {.bycopy.} = object
    ullSourceId: uint64
    ullPathId: uint64

  VDS_PATH_POLICY {.bycopy.} = object
    pathId: VDS_PATH_ID
    bPrimaryPath: int32
    ulWeight: uint32
struct VDS_PATH_ID
{
    ulong ullSourceId;
    ulong ullPathId;
}

struct VDS_PATH_POLICY
{
    VDS_PATH_ID pathId;
    int bPrimaryPath;
    uint ulWeight;
}

HSP用 定義

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

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

#defstruct global VDS_PATH_POLICY
    #field VDS_PATH_ID pathId
    #field bool bPrimaryPath
    #field int ulWeight
#endstruct

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