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

CLFS_LOG_NAME_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
NameLengthInBytesWORD2+0+0ログ名のバイト長。
NameWCHAR2+2+2ログ名を格納するUnicode文字配列。

各言語での定義

#include <windows.h>

// CLFS_LOG_NAME_INFORMATION  (x64 4 / x86 4 バイト)
typedef struct CLFS_LOG_NAME_INFORMATION {
    WORD NameLengthInBytes;
    WCHAR Name[1];
} CLFS_LOG_NAME_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLFS_LOG_NAME_INFORMATION
{
    public ushort NameLengthInBytes;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string Name;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLFS_LOG_NAME_INFORMATION
    Public NameLengthInBytes As UShort
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public Name As String
End Structure
import ctypes
from ctypes import wintypes

class CLFS_LOG_NAME_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("NameLengthInBytes", ctypes.c_ushort),
        ("Name", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct CLFS_LOG_NAME_INFORMATION {
    pub NameLengthInBytes: u16,
    pub Name: [u16; 1],
}
import "golang.org/x/sys/windows"

type CLFS_LOG_NAME_INFORMATION struct {
	NameLengthInBytes uint16
	Name [1]uint16
}
type
  CLFS_LOG_NAME_INFORMATION = record
    NameLengthInBytes: Word;
    Name: array[0..0] of WideChar;
  end;
const CLFS_LOG_NAME_INFORMATION = extern struct {
    NameLengthInBytes: u16,
    Name: [1]u16,
};
type
  CLFS_LOG_NAME_INFORMATION {.bycopy.} = object
    NameLengthInBytes: uint16
    Name: array[1, uint16]
struct CLFS_LOG_NAME_INFORMATION
{
    ushort NameLengthInBytes;
    wchar[1] Name;
}

HSP用 定義

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

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

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