ホーム › Networking.DeliveryOptimization › DO_DOWNLOAD_RANGES_INFO
DO_DOWNLOAD_RANGES_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| RangeCount | DWORD | 4 | +0 | +0 | Ranges配列に含まれる範囲の数である。 |
| Ranges | DO_DOWNLOAD_RANGE | 16 | +8 | +8 | ダウンロード対象範囲DO_DOWNLOAD_RANGEの可変長配列である。 |
各言語での定義
#include <windows.h>
// DO_DOWNLOAD_RANGE (x64 16 / x86 16 バイト)
typedef struct DO_DOWNLOAD_RANGE {
ULONGLONG Offset;
ULONGLONG Length;
} DO_DOWNLOAD_RANGE;
// DO_DOWNLOAD_RANGES_INFO (x64 24 / x86 24 バイト)
typedef struct DO_DOWNLOAD_RANGES_INFO {
DWORD RangeCount;
DO_DOWNLOAD_RANGE Ranges[1];
} DO_DOWNLOAD_RANGES_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DO_DOWNLOAD_RANGE
{
public ulong Offset;
public ulong Length;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DO_DOWNLOAD_RANGES_INFO
{
public uint RangeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DO_DOWNLOAD_RANGE[] Ranges;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DO_DOWNLOAD_RANGE
Public Offset As ULong
Public Length As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DO_DOWNLOAD_RANGES_INFO
Public RangeCount As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Ranges() As DO_DOWNLOAD_RANGE
End Structureimport ctypes
from ctypes import wintypes
class DO_DOWNLOAD_RANGE(ctypes.Structure):
_fields_ = [
("Offset", ctypes.c_ulonglong),
("Length", ctypes.c_ulonglong),
]
class DO_DOWNLOAD_RANGES_INFO(ctypes.Structure):
_fields_ = [
("RangeCount", wintypes.DWORD),
("Ranges", DO_DOWNLOAD_RANGE * 1),
]#[repr(C)]
pub struct DO_DOWNLOAD_RANGE {
pub Offset: u64,
pub Length: u64,
}
#[repr(C)]
pub struct DO_DOWNLOAD_RANGES_INFO {
pub RangeCount: u32,
pub Ranges: [DO_DOWNLOAD_RANGE; 1],
}import "golang.org/x/sys/windows"
type DO_DOWNLOAD_RANGE struct {
Offset uint64
Length uint64
}
type DO_DOWNLOAD_RANGES_INFO struct {
RangeCount uint32
Ranges [1]DO_DOWNLOAD_RANGE
}type
DO_DOWNLOAD_RANGE = record
Offset: UInt64;
Length: UInt64;
end;
DO_DOWNLOAD_RANGES_INFO = record
RangeCount: DWORD;
Ranges: array[0..0] of DO_DOWNLOAD_RANGE;
end;const DO_DOWNLOAD_RANGE = extern struct {
Offset: u64,
Length: u64,
};
const DO_DOWNLOAD_RANGES_INFO = extern struct {
RangeCount: u32,
Ranges: [1]DO_DOWNLOAD_RANGE,
};type
DO_DOWNLOAD_RANGE {.bycopy.} = object
Offset: uint64
Length: uint64
DO_DOWNLOAD_RANGES_INFO {.bycopy.} = object
RangeCount: uint32
Ranges: array[1, DO_DOWNLOAD_RANGE]struct DO_DOWNLOAD_RANGE
{
ulong Offset;
ulong Length;
}
struct DO_DOWNLOAD_RANGES_INFO
{
uint RangeCount;
DO_DOWNLOAD_RANGE[1] Ranges;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DO_DOWNLOAD_RANGES_INFO サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; RangeCount : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Ranges : DO_DOWNLOAD_RANGE (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DO_DOWNLOAD_RANGE
#field int64 Offset
#field int64 Length
#endstruct
#defstruct global DO_DOWNLOAD_RANGES_INFO
#field int RangeCount
#field DO_DOWNLOAD_RANGE Ranges 1
#endstruct
stdim st, DO_DOWNLOAD_RANGES_INFO ; NSTRUCT 変数を確保
st->RangeCount = 100
mes "RangeCount=" + st->RangeCount