Win32 API 日本語リファレンス
ホームNetworkManagement.NetManagement › AE_CLOSEFILE

AE_CLOSEFILE

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

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

フィールド

フィールドサイズx64x86説明
ae_cf_compnameDWORD4+0+0ファイルを閉じたコンピューター名へのオフセットを示す。
ae_cf_usernameDWORD4+4+4ファイルを閉じたユーザー名へのオフセットを示す。
ae_cf_resnameDWORD4+8+8閉じられたリソース(ファイル)名へのオフセットを示す。
ae_cf_fileidDWORD4+12+12閉じられたファイルのファイルIDを示す。
ae_cf_durationDWORD4+16+16ファイルが開かれていた継続時間を秒単位で示す。
ae_cf_reasonDWORD4+20+20ファイルが閉じられた理由を示すコード。

各言語での定義

#include <windows.h>

// AE_CLOSEFILE  (x64 24 / x86 24 バイト)
typedef struct AE_CLOSEFILE {
    DWORD ae_cf_compname;
    DWORD ae_cf_username;
    DWORD ae_cf_resname;
    DWORD ae_cf_fileid;
    DWORD ae_cf_duration;
    DWORD ae_cf_reason;
} AE_CLOSEFILE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AE_CLOSEFILE
{
    public uint ae_cf_compname;
    public uint ae_cf_username;
    public uint ae_cf_resname;
    public uint ae_cf_fileid;
    public uint ae_cf_duration;
    public uint ae_cf_reason;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AE_CLOSEFILE
    Public ae_cf_compname As UInteger
    Public ae_cf_username As UInteger
    Public ae_cf_resname As UInteger
    Public ae_cf_fileid As UInteger
    Public ae_cf_duration As UInteger
    Public ae_cf_reason As UInteger
End Structure
import ctypes
from ctypes import wintypes

class AE_CLOSEFILE(ctypes.Structure):
    _fields_ = [
        ("ae_cf_compname", wintypes.DWORD),
        ("ae_cf_username", wintypes.DWORD),
        ("ae_cf_resname", wintypes.DWORD),
        ("ae_cf_fileid", wintypes.DWORD),
        ("ae_cf_duration", wintypes.DWORD),
        ("ae_cf_reason", wintypes.DWORD),
    ]
#[repr(C)]
pub struct AE_CLOSEFILE {
    pub ae_cf_compname: u32,
    pub ae_cf_username: u32,
    pub ae_cf_resname: u32,
    pub ae_cf_fileid: u32,
    pub ae_cf_duration: u32,
    pub ae_cf_reason: u32,
}
import "golang.org/x/sys/windows"

type AE_CLOSEFILE struct {
	ae_cf_compname uint32
	ae_cf_username uint32
	ae_cf_resname uint32
	ae_cf_fileid uint32
	ae_cf_duration uint32
	ae_cf_reason uint32
}
type
  AE_CLOSEFILE = record
    ae_cf_compname: DWORD;
    ae_cf_username: DWORD;
    ae_cf_resname: DWORD;
    ae_cf_fileid: DWORD;
    ae_cf_duration: DWORD;
    ae_cf_reason: DWORD;
  end;
const AE_CLOSEFILE = extern struct {
    ae_cf_compname: u32,
    ae_cf_username: u32,
    ae_cf_resname: u32,
    ae_cf_fileid: u32,
    ae_cf_duration: u32,
    ae_cf_reason: u32,
};
type
  AE_CLOSEFILE {.bycopy.} = object
    ae_cf_compname: uint32
    ae_cf_username: uint32
    ae_cf_resname: uint32
    ae_cf_fileid: uint32
    ae_cf_duration: uint32
    ae_cf_reason: uint32
struct AE_CLOSEFILE
{
    uint ae_cf_compname;
    uint ae_cf_username;
    uint ae_cf_resname;
    uint ae_cf_fileid;
    uint ae_cf_duration;
    uint ae_cf_reason;
}

HSP用 定義

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

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

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