ホーム › Networking.DeliveryOptimization › DO_DOWNLOAD_STATUS
DO_DOWNLOAD_STATUS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| BytesTotal | ULONGLONG | 8 | +0 | +0 | ダウンロード対象の総バイト数である。不明時は0となる場合がある。 |
| BytesTransferred | ULONGLONG | 8 | +8 | +8 | これまでに転送済みのバイト数である。 |
| State | DODownloadState | 4 | +16 | +16 | ダウンロードの状態を示すDODownloadState列挙値である。 |
| Error | HRESULT | 4 | +20 | +20 | ダウンロードのエラーを示すHRESULTである。成功時はS_OK。 |
| ExtendedError | HRESULT | 4 | +24 | +24 | 詳細な拡張エラー情報を示すHRESULTである。 |
各言語での定義
#include <windows.h>
// DO_DOWNLOAD_STATUS (x64 32 / x86 32 バイト)
typedef struct DO_DOWNLOAD_STATUS {
ULONGLONG BytesTotal;
ULONGLONG BytesTransferred;
DODownloadState State;
HRESULT Error;
HRESULT ExtendedError;
} DO_DOWNLOAD_STATUS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DO_DOWNLOAD_STATUS
{
public ulong BytesTotal;
public ulong BytesTransferred;
public int State;
public int Error;
public int ExtendedError;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DO_DOWNLOAD_STATUS
Public BytesTotal As ULong
Public BytesTransferred As ULong
Public State As Integer
Public Error As Integer
Public ExtendedError As Integer
End Structureimport ctypes
from ctypes import wintypes
class DO_DOWNLOAD_STATUS(ctypes.Structure):
_fields_ = [
("BytesTotal", ctypes.c_ulonglong),
("BytesTransferred", ctypes.c_ulonglong),
("State", ctypes.c_int),
("Error", ctypes.c_int),
("ExtendedError", ctypes.c_int),
]#[repr(C)]
pub struct DO_DOWNLOAD_STATUS {
pub BytesTotal: u64,
pub BytesTransferred: u64,
pub State: i32,
pub Error: i32,
pub ExtendedError: i32,
}import "golang.org/x/sys/windows"
type DO_DOWNLOAD_STATUS struct {
BytesTotal uint64
BytesTransferred uint64
State int32
Error int32
ExtendedError int32
}type
DO_DOWNLOAD_STATUS = record
BytesTotal: UInt64;
BytesTransferred: UInt64;
State: Integer;
Error: Integer;
ExtendedError: Integer;
end;const DO_DOWNLOAD_STATUS = extern struct {
BytesTotal: u64,
BytesTransferred: u64,
State: i32,
Error: i32,
ExtendedError: i32,
};type
DO_DOWNLOAD_STATUS {.bycopy.} = object
BytesTotal: uint64
BytesTransferred: uint64
State: int32
Error: int32
ExtendedError: int32struct DO_DOWNLOAD_STATUS
{
ulong BytesTotal;
ulong BytesTransferred;
int State;
int Error;
int ExtendedError;
}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_STATUS サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; BytesTotal : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; BytesTransferred : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; State : DODownloadState (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Error : HRESULT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ExtendedError : HRESULT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DO_DOWNLOAD_STATUS
#field int64 BytesTotal
#field int64 BytesTransferred
#field int State
#field int Error
#field int ExtendedError
#endstruct
stdim st, DO_DOWNLOAD_STATUS ; NSTRUCT 変数を確保
st->BytesTotal = 100
mes "BytesTotal=" + st->BytesTotal