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

HANG_INFO

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

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

フィールド

フィールドサイズx64x86説明
fAppHangMonitorEnabledBOOL4+0+0アプリのハング監視が有効かを示すフラグ。
fTerminateOnHangBOOL4+4+4ハング検出時にプロセスを終了するかを示すフラグ。
DumpTypeDUMPTYPE4+8+8ハング時に生成するダンプの種類を示すDUMPTYPE。
dwHangTimeoutDWORD4+12+12ハングと判定するまでのタイムアウト時間(ミリ秒)。
dwDumpCountDWORD4+16+16生成するダンプの最大個数。
dwInfoMsgCountDWORD4+20+20出力する情報メッセージの個数。

各言語での定義

#include <windows.h>

// HANG_INFO  (x64 24 / x86 24 バイト)
typedef struct HANG_INFO {
    BOOL fAppHangMonitorEnabled;
    BOOL fTerminateOnHang;
    DUMPTYPE DumpType;
    DWORD dwHangTimeout;
    DWORD dwDumpCount;
    DWORD dwInfoMsgCount;
} HANG_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HANG_INFO
{
    [MarshalAs(UnmanagedType.Bool)] public bool fAppHangMonitorEnabled;
    [MarshalAs(UnmanagedType.Bool)] public bool fTerminateOnHang;
    public int DumpType;
    public uint dwHangTimeout;
    public uint dwDumpCount;
    public uint dwInfoMsgCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HANG_INFO
    <MarshalAs(UnmanagedType.Bool)> Public fAppHangMonitorEnabled As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fTerminateOnHang As Boolean
    Public DumpType As Integer
    Public dwHangTimeout As UInteger
    Public dwDumpCount As UInteger
    Public dwInfoMsgCount As UInteger
End Structure
import ctypes
from ctypes import wintypes

class HANG_INFO(ctypes.Structure):
    _fields_ = [
        ("fAppHangMonitorEnabled", wintypes.BOOL),
        ("fTerminateOnHang", wintypes.BOOL),
        ("DumpType", ctypes.c_int),
        ("dwHangTimeout", wintypes.DWORD),
        ("dwDumpCount", wintypes.DWORD),
        ("dwInfoMsgCount", wintypes.DWORD),
    ]
#[repr(C)]
pub struct HANG_INFO {
    pub fAppHangMonitorEnabled: i32,
    pub fTerminateOnHang: i32,
    pub DumpType: i32,
    pub dwHangTimeout: u32,
    pub dwDumpCount: u32,
    pub dwInfoMsgCount: u32,
}
import "golang.org/x/sys/windows"

type HANG_INFO struct {
	fAppHangMonitorEnabled int32
	fTerminateOnHang int32
	DumpType int32
	dwHangTimeout uint32
	dwDumpCount uint32
	dwInfoMsgCount uint32
}
type
  HANG_INFO = record
    fAppHangMonitorEnabled: BOOL;
    fTerminateOnHang: BOOL;
    DumpType: Integer;
    dwHangTimeout: DWORD;
    dwDumpCount: DWORD;
    dwInfoMsgCount: DWORD;
  end;
const HANG_INFO = extern struct {
    fAppHangMonitorEnabled: i32,
    fTerminateOnHang: i32,
    DumpType: i32,
    dwHangTimeout: u32,
    dwDumpCount: u32,
    dwInfoMsgCount: u32,
};
type
  HANG_INFO {.bycopy.} = object
    fAppHangMonitorEnabled: int32
    fTerminateOnHang: int32
    DumpType: int32
    dwHangTimeout: uint32
    dwDumpCount: uint32
    dwInfoMsgCount: uint32
struct HANG_INFO
{
    int fAppHangMonitorEnabled;
    int fTerminateOnHang;
    int DumpType;
    uint dwHangTimeout;
    uint dwDumpCount;
    uint dwInfoMsgCount;
}

HSP用 定義

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

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

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