ホーム › Storage.FileSystem › CREATEFILE2_EXTENDED_PARAMETERS
CREATEFILE2_EXTENDED_PARAMETERS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | 本構造体のサイズ。バイト単位で指定する。 |
| dwFileAttributes | DWORD | 4 | +4 | +4 | ファイル属性を示すフラグ。FILE_ATTRIBUTE_*。 |
| dwFileFlags | DWORD | 4 | +8 | +8 | ファイル動作を制御するフラグ。FILE_FLAG_*。 |
| dwSecurityQosFlags | DWORD | 4 | +12 | +12 | セキュリティ品質(なりすましレベル等)を示すフラグ。SECURITY_*。 |
| lpSecurityAttributes | SECURITY_ATTRIBUTES* | 8/4 | +16 | +16 | セキュリティ属性へのポインタ。NULL可で既定の保護を使う。 |
| hTemplateFile | HANDLE | 8/4 | +24 | +20 | 属性をコピーするテンプレートファイルのハンドル。NULL可。 |
各言語での定義
#include <windows.h>
// CREATEFILE2_EXTENDED_PARAMETERS (x64 32 / x86 24 バイト)
typedef struct CREATEFILE2_EXTENDED_PARAMETERS {
DWORD dwSize;
DWORD dwFileAttributes;
DWORD dwFileFlags;
DWORD dwSecurityQosFlags;
SECURITY_ATTRIBUTES* lpSecurityAttributes;
HANDLE hTemplateFile;
} CREATEFILE2_EXTENDED_PARAMETERS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CREATEFILE2_EXTENDED_PARAMETERS
{
public uint dwSize;
public uint dwFileAttributes;
public uint dwFileFlags;
public uint dwSecurityQosFlags;
public IntPtr lpSecurityAttributes;
public IntPtr hTemplateFile;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CREATEFILE2_EXTENDED_PARAMETERS
Public dwSize As UInteger
Public dwFileAttributes As UInteger
Public dwFileFlags As UInteger
Public dwSecurityQosFlags As UInteger
Public lpSecurityAttributes As IntPtr
Public hTemplateFile As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class CREATEFILE2_EXTENDED_PARAMETERS(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("dwFileAttributes", wintypes.DWORD),
("dwFileFlags", wintypes.DWORD),
("dwSecurityQosFlags", wintypes.DWORD),
("lpSecurityAttributes", ctypes.c_void_p),
("hTemplateFile", ctypes.c_void_p),
]#[repr(C)]
pub struct CREATEFILE2_EXTENDED_PARAMETERS {
pub dwSize: u32,
pub dwFileAttributes: u32,
pub dwFileFlags: u32,
pub dwSecurityQosFlags: u32,
pub lpSecurityAttributes: *mut core::ffi::c_void,
pub hTemplateFile: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type CREATEFILE2_EXTENDED_PARAMETERS struct {
dwSize uint32
dwFileAttributes uint32
dwFileFlags uint32
dwSecurityQosFlags uint32
lpSecurityAttributes uintptr
hTemplateFile uintptr
}type
CREATEFILE2_EXTENDED_PARAMETERS = record
dwSize: DWORD;
dwFileAttributes: DWORD;
dwFileFlags: DWORD;
dwSecurityQosFlags: DWORD;
lpSecurityAttributes: Pointer;
hTemplateFile: Pointer;
end;const CREATEFILE2_EXTENDED_PARAMETERS = extern struct {
dwSize: u32,
dwFileAttributes: u32,
dwFileFlags: u32,
dwSecurityQosFlags: u32,
lpSecurityAttributes: ?*anyopaque,
hTemplateFile: ?*anyopaque,
};type
CREATEFILE2_EXTENDED_PARAMETERS {.bycopy.} = object
dwSize: uint32
dwFileAttributes: uint32
dwFileFlags: uint32
dwSecurityQosFlags: uint32
lpSecurityAttributes: pointer
hTemplateFile: pointerstruct CREATEFILE2_EXTENDED_PARAMETERS
{
uint dwSize;
uint dwFileAttributes;
uint dwFileFlags;
uint dwSecurityQosFlags;
void* lpSecurityAttributes;
void* hTemplateFile;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CREATEFILE2_EXTENDED_PARAMETERS サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFileAttributes : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFileFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwSecurityQosFlags : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpSecurityAttributes : SECURITY_ATTRIBUTES* (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; hTemplateFile : HANDLE (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CREATEFILE2_EXTENDED_PARAMETERS サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFileAttributes : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFileFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwSecurityQosFlags : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpSecurityAttributes : SECURITY_ATTRIBUTES* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; hTemplateFile : HANDLE (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CREATEFILE2_EXTENDED_PARAMETERS
#field int dwSize
#field int dwFileAttributes
#field int dwFileFlags
#field int dwSecurityQosFlags
#field intptr lpSecurityAttributes
#field intptr hTemplateFile
#endstruct
stdim st, CREATEFILE2_EXTENDED_PARAMETERS ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize