Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SP_FILE_COPY_PARAMS_W

SP_FILE_COPY_PARAMS_W

構造体
サイズx64: 88 バイト / x86: 48 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のバイト単位サイズ。呼び出し前に設定する。
QueueHandlevoid*8/4+4+4コピー操作を登録するファイルキューのハンドル。
SourceRootPathLPWSTR8/4+12+8コピー元のルートパス(Unicode)。メディアの基点を示す。
SourcePathLPWSTR8/4+20+12ルート以下のコピー元サブパス(Unicode)。NULL可。
SourceFilenameLPWSTR8/4+28+16コピー元ファイル名(Unicode)。
SourceDescriptionLPWSTR8/4+36+20コピー元メディアの説明文字列(Unicode)。NULL可。
SourceTagfileLPWSTR8/4+44+24メディア識別用タグファイル名(Unicode)。NULL可。
TargetDirectoryLPWSTR8/4+52+28コピー先ディレクトリ(Unicode)。
TargetFilenameLPWSTR8/4+60+32コピー先ファイル名(Unicode)。NULLなら元名を使用。
CopyStyleDWORD4+68+36コピー動作を制御するフラグ群(SP_COPY_*)。
LayoutInfvoid*8/4+72+40ソースレイアウト情報を持つINFのハンドル。NULL可。
SecurityDescriptorLPWSTR8/4+80+44コピー先に適用するセキュリティ記述子文字列(Unicode)。NULL可。

各言語での定義

#include <windows.h>

// SP_FILE_COPY_PARAMS_W  (x64 88 / x86 48 バイト)
#pragma pack(push, 1)
typedef struct SP_FILE_COPY_PARAMS_W {
    DWORD cbSize;
    void* QueueHandle;
    LPWSTR SourceRootPath;
    LPWSTR SourcePath;
    LPWSTR SourceFilename;
    LPWSTR SourceDescription;
    LPWSTR SourceTagfile;
    LPWSTR TargetDirectory;
    LPWSTR TargetFilename;
    DWORD CopyStyle;
    void* LayoutInf;
    LPWSTR SecurityDescriptor;
} SP_FILE_COPY_PARAMS_W;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SP_FILE_COPY_PARAMS_W
{
    public uint cbSize;
    public IntPtr QueueHandle;
    public IntPtr SourceRootPath;
    public IntPtr SourcePath;
    public IntPtr SourceFilename;
    public IntPtr SourceDescription;
    public IntPtr SourceTagfile;
    public IntPtr TargetDirectory;
    public IntPtr TargetFilename;
    public uint CopyStyle;
    public IntPtr LayoutInf;
    public IntPtr SecurityDescriptor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SP_FILE_COPY_PARAMS_W
    Public cbSize As UInteger
    Public QueueHandle As IntPtr
    Public SourceRootPath As IntPtr
    Public SourcePath As IntPtr
    Public SourceFilename As IntPtr
    Public SourceDescription As IntPtr
    Public SourceTagfile As IntPtr
    Public TargetDirectory As IntPtr
    Public TargetFilename As IntPtr
    Public CopyStyle As UInteger
    Public LayoutInf As IntPtr
    Public SecurityDescriptor As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SP_FILE_COPY_PARAMS_W(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("QueueHandle", ctypes.c_void_p),
        ("SourceRootPath", ctypes.c_void_p),
        ("SourcePath", ctypes.c_void_p),
        ("SourceFilename", ctypes.c_void_p),
        ("SourceDescription", ctypes.c_void_p),
        ("SourceTagfile", ctypes.c_void_p),
        ("TargetDirectory", ctypes.c_void_p),
        ("TargetFilename", ctypes.c_void_p),
        ("CopyStyle", wintypes.DWORD),
        ("LayoutInf", ctypes.c_void_p),
        ("SecurityDescriptor", ctypes.c_void_p),
    ]
#[repr(C, packed(1))]
pub struct SP_FILE_COPY_PARAMS_W {
    pub cbSize: u32,
    pub QueueHandle: *mut core::ffi::c_void,
    pub SourceRootPath: *mut core::ffi::c_void,
    pub SourcePath: *mut core::ffi::c_void,
    pub SourceFilename: *mut core::ffi::c_void,
    pub SourceDescription: *mut core::ffi::c_void,
    pub SourceTagfile: *mut core::ffi::c_void,
    pub TargetDirectory: *mut core::ffi::c_void,
    pub TargetFilename: *mut core::ffi::c_void,
    pub CopyStyle: u32,
    pub LayoutInf: *mut core::ffi::c_void,
    pub SecurityDescriptor: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SP_FILE_COPY_PARAMS_W struct {
	cbSize uint32
	QueueHandle uintptr
	SourceRootPath uintptr
	SourcePath uintptr
	SourceFilename uintptr
	SourceDescription uintptr
	SourceTagfile uintptr
	TargetDirectory uintptr
	TargetFilename uintptr
	CopyStyle uint32
	LayoutInf uintptr
	SecurityDescriptor uintptr
}
type
  SP_FILE_COPY_PARAMS_W = packed record
    cbSize: DWORD;
    QueueHandle: Pointer;
    SourceRootPath: Pointer;
    SourcePath: Pointer;
    SourceFilename: Pointer;
    SourceDescription: Pointer;
    SourceTagfile: Pointer;
    TargetDirectory: Pointer;
    TargetFilename: Pointer;
    CopyStyle: DWORD;
    LayoutInf: Pointer;
    SecurityDescriptor: Pointer;
  end;
const SP_FILE_COPY_PARAMS_W = extern struct {
    cbSize: u32,
    QueueHandle: ?*anyopaque,
    SourceRootPath: ?*anyopaque,
    SourcePath: ?*anyopaque,
    SourceFilename: ?*anyopaque,
    SourceDescription: ?*anyopaque,
    SourceTagfile: ?*anyopaque,
    TargetDirectory: ?*anyopaque,
    TargetFilename: ?*anyopaque,
    CopyStyle: u32,
    LayoutInf: ?*anyopaque,
    SecurityDescriptor: ?*anyopaque,
};
type
  SP_FILE_COPY_PARAMS_W {.packed.} = object
    cbSize: uint32
    QueueHandle: pointer
    SourceRootPath: pointer
    SourcePath: pointer
    SourceFilename: pointer
    SourceDescription: pointer
    SourceTagfile: pointer
    TargetDirectory: pointer
    TargetFilename: pointer
    CopyStyle: uint32
    LayoutInf: pointer
    SecurityDescriptor: pointer
align(1)
struct SP_FILE_COPY_PARAMS_W
{
    uint cbSize;
    void* QueueHandle;
    void* SourceRootPath;
    void* SourcePath;
    void* SourceFilename;
    void* SourceDescription;
    void* SourceTagfile;
    void* TargetDirectory;
    void* TargetFilename;
    uint CopyStyle;
    void* LayoutInf;
    void* SecurityDescriptor;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SP_FILE_COPY_PARAMS_W サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; QueueHandle : void* (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; SourceRootPath : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; SourcePath : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; SourceFilename : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; SourceDescription : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; SourceTagfile : LPWSTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; TargetDirectory : LPWSTR (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; TargetFilename : LPWSTR (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; CopyStyle : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; LayoutInf : void* (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; SecurityDescriptor : LPWSTR (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SP_FILE_COPY_PARAMS_W サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; QueueHandle : void* (+4, 8byte)  qpoke st,4,値 / qpeek(st,4)  ※IronHSPのみ。3.7/3.8は lpoke st,4,下位 : lpoke st,8,上位
; SourceRootPath : LPWSTR (+12, 8byte)  qpoke st,12,値 / qpeek(st,12)  ※IronHSPのみ。3.7/3.8は lpoke st,12,下位 : lpoke st,16,上位
; SourcePath : LPWSTR (+20, 8byte)  qpoke st,20,値 / qpeek(st,20)  ※IronHSPのみ。3.7/3.8は lpoke st,20,下位 : lpoke st,24,上位
; SourceFilename : LPWSTR (+28, 8byte)  qpoke st,28,値 / qpeek(st,28)  ※IronHSPのみ。3.7/3.8は lpoke st,28,下位 : lpoke st,32,上位
; SourceDescription : LPWSTR (+36, 8byte)  qpoke st,36,値 / qpeek(st,36)  ※IronHSPのみ。3.7/3.8は lpoke st,36,下位 : lpoke st,40,上位
; SourceTagfile : LPWSTR (+44, 8byte)  qpoke st,44,値 / qpeek(st,44)  ※IronHSPのみ。3.7/3.8は lpoke st,44,下位 : lpoke st,48,上位
; TargetDirectory : LPWSTR (+52, 8byte)  qpoke st,52,値 / qpeek(st,52)  ※IronHSPのみ。3.7/3.8は lpoke st,52,下位 : lpoke st,56,上位
; TargetFilename : LPWSTR (+60, 8byte)  qpoke st,60,値 / qpeek(st,60)  ※IronHSPのみ。3.7/3.8は lpoke st,60,下位 : lpoke st,64,上位
; CopyStyle : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; LayoutInf : void* (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; SecurityDescriptor : LPWSTR (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SP_FILE_COPY_PARAMS_W, pack=1
    #field int cbSize
    #field intptr QueueHandle
    #field intptr SourceRootPath
    #field intptr SourcePath
    #field intptr SourceFilename
    #field intptr SourceDescription
    #field intptr SourceTagfile
    #field intptr TargetDirectory
    #field intptr TargetFilename
    #field int CopyStyle
    #field intptr LayoutInf
    #field intptr SecurityDescriptor
#endstruct

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