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

PDH_LOG_SERVICE_QUERY_INFO_W

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイトサイズである。
dwFlagsDWORD4+4+4ログサービス問い合わせの動作フラグである。
dwLogQuotaDWORD4+8+8ログファイルの最大サイズ(クォータ)である。
szLogFileCaptionLPWSTR8/4+16+12ログファイルのキャプション文字列(ワイド)である。
szDefaultDirLPWSTR8/4+24+16ログの既定ディレクトリ(ワイド)である。
szBaseFileNameLPWSTR8/4+32+20ログのベースファイル名(ワイド)である。
dwFileTypeDWORD4+40+24ログファイルの種別である。
dwReservedDWORD4+44+28予約フィールドである。0となる。
Anonymous_Anonymous_e__Union8/4+48+32ログ種別に応じた追加情報(PDL/カウンタ数等)を保持する共用体である。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
Anonymous1_Anonymous1_e__Struct8/4+0+0
Anonymous2_Anonymous2_e__Struct8/4+0+0

各言語での定義

#include <windows.h>

// PDH_LOG_SERVICE_QUERY_INFO_W  (x64 56 / x86 36 バイト)
typedef struct PDH_LOG_SERVICE_QUERY_INFO_W {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwLogQuota;
    LPWSTR szLogFileCaption;
    LPWSTR szDefaultDir;
    LPWSTR szBaseFileName;
    DWORD dwFileType;
    DWORD dwReserved;
    _Anonymous_e__Union Anonymous;
} PDH_LOG_SERVICE_QUERY_INFO_W;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PDH_LOG_SERVICE_QUERY_INFO_W
{
    public uint dwSize;
    public uint dwFlags;
    public uint dwLogQuota;
    public IntPtr szLogFileCaption;
    public IntPtr szDefaultDir;
    public IntPtr szBaseFileName;
    public uint dwFileType;
    public uint dwReserved;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PDH_LOG_SERVICE_QUERY_INFO_W
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public dwLogQuota As UInteger
    Public szLogFileCaption As IntPtr
    Public szDefaultDir As IntPtr
    Public szBaseFileName As IntPtr
    Public dwFileType As UInteger
    Public dwReserved As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class PDH_LOG_SERVICE_QUERY_INFO_W(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwLogQuota", wintypes.DWORD),
        ("szLogFileCaption", ctypes.c_void_p),
        ("szDefaultDir", ctypes.c_void_p),
        ("szBaseFileName", ctypes.c_void_p),
        ("dwFileType", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct PDH_LOG_SERVICE_QUERY_INFO_W {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub dwLogQuota: u32,
    pub szLogFileCaption: *mut core::ffi::c_void,
    pub szDefaultDir: *mut core::ffi::c_void,
    pub szBaseFileName: *mut core::ffi::c_void,
    pub dwFileType: u32,
    pub dwReserved: u32,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type PDH_LOG_SERVICE_QUERY_INFO_W struct {
	dwSize uint32
	dwFlags uint32
	dwLogQuota uint32
	szLogFileCaption uintptr
	szDefaultDir uintptr
	szBaseFileName uintptr
	dwFileType uint32
	dwReserved uint32
	Anonymous _Anonymous_e__Union
}
type
  PDH_LOG_SERVICE_QUERY_INFO_W = record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwLogQuota: DWORD;
    szLogFileCaption: Pointer;
    szDefaultDir: Pointer;
    szBaseFileName: Pointer;
    dwFileType: DWORD;
    dwReserved: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;
const PDH_LOG_SERVICE_QUERY_INFO_W = extern struct {
    dwSize: u32,
    dwFlags: u32,
    dwLogQuota: u32,
    szLogFileCaption: ?*anyopaque,
    szDefaultDir: ?*anyopaque,
    szBaseFileName: ?*anyopaque,
    dwFileType: u32,
    dwReserved: u32,
    Anonymous: _Anonymous_e__Union,
};
type
  PDH_LOG_SERVICE_QUERY_INFO_W {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    dwLogQuota: uint32
    szLogFileCaption: pointer
    szDefaultDir: pointer
    szBaseFileName: pointer
    dwFileType: uint32
    dwReserved: uint32
    Anonymous: _Anonymous_e__Union
struct PDH_LOG_SERVICE_QUERY_INFO_W
{
    uint dwSize;
    uint dwFlags;
    uint dwLogQuota;
    void* szLogFileCaption;
    void* szDefaultDir;
    void* szBaseFileName;
    uint dwFileType;
    uint dwReserved;
    _Anonymous_e__Union Anonymous;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PDH_LOG_SERVICE_QUERY_INFO_W サイズ: 36 バイト(x86)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwLogQuota : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; szLogFileCaption : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; szDefaultDir : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; szBaseFileName : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwFileType : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwReserved : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PDH_LOG_SERVICE_QUERY_INFO_W サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwLogQuota : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; szLogFileCaption : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; szDefaultDir : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; szBaseFileName : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; dwFileType : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwReserved : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PDH_LOG_SERVICE_QUERY_INFO_W
    #field int dwSize
    #field int dwFlags
    #field int dwLogQuota
    #field intptr szLogFileCaption
    #field intptr szDefaultDir
    #field intptr szBaseFileName
    #field int dwFileType
    #field int dwReserved
    #field byte Anonymous 8
#endstruct

stdim st, PDH_LOG_SERVICE_QUERY_INFO_W        ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。