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

SERVICE_FAILURE_ACTIONSA

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

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

フィールド

フィールドサイズx64x86説明
dwResetPeriodDWORD4+0+0障害カウンターをリセットするまでの期間。秒単位。INFINITE 指定可。
lpRebootMsgLPSTR8/4+8+4コンピューター再起動時に送信するブロードキャストメッセージ(ANSI)。NULL 可。
lpCommandLPSTR8/4+16+8障害時に実行するコマンドライン(ANSI)。NULL 可。
cActionsDWORD4+24+12lpsaActions 配列に含まれる処理の数。
lpsaActionsSC_ACTION*8/4+32+16障害回数ごとに実行する SC_ACTION 配列へのポインター。

各言語での定義

#include <windows.h>

// SERVICE_FAILURE_ACTIONSA  (x64 40 / x86 20 バイト)
typedef struct SERVICE_FAILURE_ACTIONSA {
    DWORD dwResetPeriod;
    LPSTR lpRebootMsg;
    LPSTR lpCommand;
    DWORD cActions;
    SC_ACTION* lpsaActions;
} SERVICE_FAILURE_ACTIONSA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SERVICE_FAILURE_ACTIONSA
{
    public uint dwResetPeriod;
    public IntPtr lpRebootMsg;
    public IntPtr lpCommand;
    public uint cActions;
    public IntPtr lpsaActions;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SERVICE_FAILURE_ACTIONSA
    Public dwResetPeriod As UInteger
    Public lpRebootMsg As IntPtr
    Public lpCommand As IntPtr
    Public cActions As UInteger
    Public lpsaActions As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SERVICE_FAILURE_ACTIONSA(ctypes.Structure):
    _fields_ = [
        ("dwResetPeriod", wintypes.DWORD),
        ("lpRebootMsg", ctypes.c_void_p),
        ("lpCommand", ctypes.c_void_p),
        ("cActions", wintypes.DWORD),
        ("lpsaActions", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SERVICE_FAILURE_ACTIONSA {
    pub dwResetPeriod: u32,
    pub lpRebootMsg: *mut core::ffi::c_void,
    pub lpCommand: *mut core::ffi::c_void,
    pub cActions: u32,
    pub lpsaActions: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SERVICE_FAILURE_ACTIONSA struct {
	dwResetPeriod uint32
	lpRebootMsg uintptr
	lpCommand uintptr
	cActions uint32
	lpsaActions uintptr
}
type
  SERVICE_FAILURE_ACTIONSA = record
    dwResetPeriod: DWORD;
    lpRebootMsg: Pointer;
    lpCommand: Pointer;
    cActions: DWORD;
    lpsaActions: Pointer;
  end;
const SERVICE_FAILURE_ACTIONSA = extern struct {
    dwResetPeriod: u32,
    lpRebootMsg: ?*anyopaque,
    lpCommand: ?*anyopaque,
    cActions: u32,
    lpsaActions: ?*anyopaque,
};
type
  SERVICE_FAILURE_ACTIONSA {.bycopy.} = object
    dwResetPeriod: uint32
    lpRebootMsg: pointer
    lpCommand: pointer
    cActions: uint32
    lpsaActions: pointer
struct SERVICE_FAILURE_ACTIONSA
{
    uint dwResetPeriod;
    void* lpRebootMsg;
    void* lpCommand;
    uint cActions;
    void* lpsaActions;
}

HSP用 定義

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

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

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