Win32 API 日本語リファレンス
ホームNetworking.DeliveryOptimization › DO_DOWNLOAD_RANGE

DO_DOWNLOAD_RANGE

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

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

フィールド

フィールドサイズx64x86説明
OffsetULONGLONG8+0+0ファイルからダウンロードするバイト範囲の先頭を示す、0 から始まるオフセットです。
LengthULONGLONG8+8+8範囲の長さ (バイト単位) です。長さに 0 バイトを指定しないでください。範囲がファイルの末尾まで続くことを示すには、DO_LENGTH_TO_EOF を指定します。

公式ドキュメント

DO_DOWNLOAD_RANGE 構造体は、ファイルからダウンロードするバイト範囲を 1 つ指定します。DO_DOWNLOAD_RANGE 構造体は DO_DOWNLOAD_RANGES_INFO 構造体に含められ、ダウンロードする範囲の配列を提供します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// DO_DOWNLOAD_RANGE  (x64 16 / x86 16 バイト)
typedef struct DO_DOWNLOAD_RANGE {
    ULONGLONG Offset;
    ULONGLONG Length;
} DO_DOWNLOAD_RANGE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DO_DOWNLOAD_RANGE
{
    public ulong Offset;
    public ulong Length;
}
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
import ctypes
from ctypes import wintypes

class DO_DOWNLOAD_RANGE(ctypes.Structure):
    _fields_ = [
        ("Offset", ctypes.c_ulonglong),
        ("Length", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct DO_DOWNLOAD_RANGE {
    pub Offset: u64,
    pub Length: u64,
}
import "golang.org/x/sys/windows"

type DO_DOWNLOAD_RANGE struct {
	Offset uint64
	Length uint64
}
type
  DO_DOWNLOAD_RANGE = record
    Offset: UInt64;
    Length: UInt64;
  end;
const DO_DOWNLOAD_RANGE = extern struct {
    Offset: u64,
    Length: u64,
};
type
  DO_DOWNLOAD_RANGE {.bycopy.} = object
    Offset: uint64
    Length: uint64
struct DO_DOWNLOAD_RANGE
{
    ulong Offset;
    ulong Length;
}

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_RANGE サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Offset : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Length : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DO_DOWNLOAD_RANGE
    #field int64 Offset
    #field int64 Length
#endstruct

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