Win32 API 日本語リファレンス
ホームSystem.Ioctl › SI_COPYFILE

SI_COPYFILE

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

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

フィールド

フィールドサイズx64x86説明
SourceFileNameLengthDWORD4+0+0コピー元ファイル名の長さ(バイト)。
DestinationFileNameLengthDWORD4+4+4コピー先ファイル名の長さ(バイト)。
FlagsDWORD4+8+8コピー動作を制御するフラグ。COPY_FILE_SI_*等を指定する。
FileNameBufferWCHAR2+12+12コピー元・先のファイル名を連結したWCHARバッファの先頭。

各言語での定義

#include <windows.h>

// SI_COPYFILE  (x64 16 / x86 16 バイト)
typedef struct SI_COPYFILE {
    DWORD SourceFileNameLength;
    DWORD DestinationFileNameLength;
    DWORD Flags;
    WCHAR FileNameBuffer[1];
} SI_COPYFILE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SI_COPYFILE
{
    public uint SourceFileNameLength;
    public uint DestinationFileNameLength;
    public uint Flags;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string FileNameBuffer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SI_COPYFILE
    Public SourceFileNameLength As UInteger
    Public DestinationFileNameLength As UInteger
    Public Flags As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public FileNameBuffer As String
End Structure
import ctypes
from ctypes import wintypes

class SI_COPYFILE(ctypes.Structure):
    _fields_ = [
        ("SourceFileNameLength", wintypes.DWORD),
        ("DestinationFileNameLength", wintypes.DWORD),
        ("Flags", wintypes.DWORD),
        ("FileNameBuffer", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct SI_COPYFILE {
    pub SourceFileNameLength: u32,
    pub DestinationFileNameLength: u32,
    pub Flags: u32,
    pub FileNameBuffer: [u16; 1],
}
import "golang.org/x/sys/windows"

type SI_COPYFILE struct {
	SourceFileNameLength uint32
	DestinationFileNameLength uint32
	Flags uint32
	FileNameBuffer [1]uint16
}
type
  SI_COPYFILE = record
    SourceFileNameLength: DWORD;
    DestinationFileNameLength: DWORD;
    Flags: DWORD;
    FileNameBuffer: array[0..0] of WideChar;
  end;
const SI_COPYFILE = extern struct {
    SourceFileNameLength: u32,
    DestinationFileNameLength: u32,
    Flags: u32,
    FileNameBuffer: [1]u16,
};
type
  SI_COPYFILE {.bycopy.} = object
    SourceFileNameLength: uint32
    DestinationFileNameLength: uint32
    Flags: uint32
    FileNameBuffer: array[1, uint16]
struct SI_COPYFILE
{
    uint SourceFileNameLength;
    uint DestinationFileNameLength;
    uint Flags;
    wchar[1] FileNameBuffer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SI_COPYFILE サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; SourceFileNameLength : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DestinationFileNameLength : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Flags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; FileNameBuffer : WCHAR (+12, 2byte)  varptr(st)+12 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SI_COPYFILE
    #field int SourceFileNameLength
    #field int DestinationFileNameLength
    #field int Flags
    #field wchar FileNameBuffer 1
#endstruct

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