ホーム › Storage.FileSystem › COPYFILE2_MESSAGE
COPYFILE2_MESSAGE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Type | COPYFILE2_MESSAGE_TYPE | 4 | +0 | +0 | コールバックメッセージの種類(進捗/エラー/開始等のCOPYFILE2_MESSAGE_TYPE)。 |
| dwPadding | DWORD | 4 | +4 | +4 | アラインメント調整用のパディング。 |
| Info | _Info_e__Union | 8/4 | +8 | +8 | メッセージ種類に応じた詳細情報を保持する共用体。 |
共用体: _Info_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ChunkStarted | _ChunkStarted_e__Struct | 8/4 | +0 | +0 |
| ChunkFinished | _ChunkFinished_e__Struct | 8/4 | +0 | +0 |
| StreamStarted | _StreamStarted_e__Struct | 8/4 | +0 | +0 |
| StreamFinished | _StreamFinished_e__Struct | 8/4 | +0 | +0 |
| PollContinue | _PollContinue_e__Struct | 8/4 | +0 | +0 |
| Error | _Error_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// COPYFILE2_MESSAGE (x64 16 / x86 12 バイト)
typedef struct COPYFILE2_MESSAGE {
COPYFILE2_MESSAGE_TYPE Type;
DWORD dwPadding;
_Info_e__Union Info;
} COPYFILE2_MESSAGE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COPYFILE2_MESSAGE
{
public int Type;
public uint dwPadding;
public _Info_e__Union Info;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COPYFILE2_MESSAGE
Public Type As Integer
Public dwPadding As UInteger
Public Info As _Info_e__Union
End Structureimport ctypes
from ctypes import wintypes
class COPYFILE2_MESSAGE(ctypes.Structure):
_fields_ = [
("Type", ctypes.c_int),
("dwPadding", wintypes.DWORD),
("Info", _Info_e__Union),
]#[repr(C)]
pub struct COPYFILE2_MESSAGE {
pub Type: i32,
pub dwPadding: u32,
pub Info: _Info_e__Union,
}import "golang.org/x/sys/windows"
type COPYFILE2_MESSAGE struct {
Type int32
dwPadding uint32
Info _Info_e__Union
}type
COPYFILE2_MESSAGE = record
Type: Integer;
dwPadding: DWORD;
Info: _Info_e__Union;
end;const COPYFILE2_MESSAGE = extern struct {
Type: i32,
dwPadding: u32,
Info: _Info_e__Union,
};type
COPYFILE2_MESSAGE {.bycopy.} = object
Type: int32
dwPadding: uint32
Info: _Info_e__Unionstruct COPYFILE2_MESSAGE
{
int Type;
uint dwPadding;
_Info_e__Union Info;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; COPYFILE2_MESSAGE サイズ: 12 バイト(x86)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Type : COPYFILE2_MESSAGE_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwPadding : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Info : _Info_e__Union (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COPYFILE2_MESSAGE サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Type : COPYFILE2_MESSAGE_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwPadding : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Info : _Info_e__Union (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global COPYFILE2_MESSAGE
#field int Type
#field int dwPadding
#field byte Info 8
#endstruct
stdim st, COPYFILE2_MESSAGE ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。