Win32 API 日本語リファレンス
ホームStorage.FileSystem › FILE_INFO_3

FILE_INFO_3

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

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

フィールド

フィールドサイズx64x86説明
fi3_idDWORD4+0+0開かれているリソース(ファイル/デバイス/パイプ)の識別子。
fi3_permissionsFILE_INFO_FLAGS_PERMISSIONS4+4+4リソースに付与されたアクセス権ビットマスク(読取/書込等)。
fi3_num_locksDWORD4+8+8リソースに設定されているロックの数。
fi3_pathnameLPWSTR8/4+16+12開かれているリソースのパス名を指すUnicode文字列。
fi3_usernameLPWSTR8/4+24+16リソースを開いたユーザーの名前。

各言語での定義

#include <windows.h>

// FILE_INFO_3  (x64 32 / x86 20 バイト)
typedef struct FILE_INFO_3 {
    DWORD fi3_id;
    FILE_INFO_FLAGS_PERMISSIONS fi3_permissions;
    DWORD fi3_num_locks;
    LPWSTR fi3_pathname;
    LPWSTR fi3_username;
} FILE_INFO_3;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_INFO_3
{
    public uint fi3_id;
    public uint fi3_permissions;
    public uint fi3_num_locks;
    public IntPtr fi3_pathname;
    public IntPtr fi3_username;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_INFO_3
    Public fi3_id As UInteger
    Public fi3_permissions As UInteger
    Public fi3_num_locks As UInteger
    Public fi3_pathname As IntPtr
    Public fi3_username As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class FILE_INFO_3(ctypes.Structure):
    _fields_ = [
        ("fi3_id", wintypes.DWORD),
        ("fi3_permissions", wintypes.DWORD),
        ("fi3_num_locks", wintypes.DWORD),
        ("fi3_pathname", ctypes.c_void_p),
        ("fi3_username", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct FILE_INFO_3 {
    pub fi3_id: u32,
    pub fi3_permissions: u32,
    pub fi3_num_locks: u32,
    pub fi3_pathname: *mut core::ffi::c_void,
    pub fi3_username: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type FILE_INFO_3 struct {
	fi3_id uint32
	fi3_permissions uint32
	fi3_num_locks uint32
	fi3_pathname uintptr
	fi3_username uintptr
}
type
  FILE_INFO_3 = record
    fi3_id: DWORD;
    fi3_permissions: DWORD;
    fi3_num_locks: DWORD;
    fi3_pathname: Pointer;
    fi3_username: Pointer;
  end;
const FILE_INFO_3 = extern struct {
    fi3_id: u32,
    fi3_permissions: u32,
    fi3_num_locks: u32,
    fi3_pathname: ?*anyopaque,
    fi3_username: ?*anyopaque,
};
type
  FILE_INFO_3 {.bycopy.} = object
    fi3_id: uint32
    fi3_permissions: uint32
    fi3_num_locks: uint32
    fi3_pathname: pointer
    fi3_username: pointer
struct FILE_INFO_3
{
    uint fi3_id;
    uint fi3_permissions;
    uint fi3_num_locks;
    void* fi3_pathname;
    void* fi3_username;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FILE_INFO_3 サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; fi3_id : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fi3_permissions : FILE_INFO_FLAGS_PERMISSIONS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fi3_num_locks : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fi3_pathname : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; fi3_username : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILE_INFO_3 サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; fi3_id : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fi3_permissions : FILE_INFO_FLAGS_PERMISSIONS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fi3_num_locks : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fi3_pathname : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; fi3_username : LPWSTR (+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 FILE_INFO_3
    #field int fi3_id
    #field int fi3_permissions
    #field int fi3_num_locks
    #field intptr fi3_pathname
    #field intptr fi3_username
#endstruct

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