ホーム › System.GroupPolicy › POLICYSETTINGSTATUSINFO
POLICYSETTINGSTATUSINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| szKey | LPWSTR | 8/4 | +0 | +0 | このメンバーは省略可能です。NULL の場合、システムが値を生成します。 |
| szEventSource | LPWSTR | 8/4 | +8 | +4 | ログエントリを生成したソース(アプリケーション、サービス、ドライバー、サブシステム)の名前を指定する文字列へのポインター。 |
| szEventLogName | LPWSTR | 8/4 | +16 | +8 | イベントログの名前を指定する文字列へのポインター。 |
| dwEventID | DWORD | 4 | +24 | +12 | イベントログのメッセージ ID を指定します。 |
| dwErrorCode | DWORD | 4 | +28 | +16 | ポリシー設定の適用中に発生したエラーを示す システム エラー コードです。 |
| status | SETTINGSTATUS | 4 | +32 | +20 | ポリシー設定の状態を指定します。このメンバーには、次のいずれかの値を指定できます。 RSOPUnspecifiedクライアント側拡張は、このポリシー設定の状態を定義していません。 RSOPAppliedポリシー設定は正常に適用されました。 RSOPIgnoredポリシー設定は無視され、システムは適用を試みませんでした。 RSOPFailedポリシー設定の適用に失敗しました。失敗の詳細は、構造体の他のメンバーによって示されます。 RSOPSubsettingFailedポリシー設定は正常に適用されましたが、子設定を適用しようとした際にエラーが発生しました。 |
| timeLogged | SYSTEMTIME | 16 | +36 | +24 | ソースがイベントを生成した時刻を示す SYSTEMTIME 構造体を指定します。 |
公式ドキュメント
POLICYSETTINGSTATUSINFO 構造体は、ポリシー設定イベントに関する情報を提供します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// SYSTEMTIME (x64 16 / x86 16 バイト)
typedef struct SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
// POLICYSETTINGSTATUSINFO (x64 56 / x86 40 バイト)
typedef struct POLICYSETTINGSTATUSINFO {
LPWSTR szKey;
LPWSTR szEventSource;
LPWSTR szEventLogName;
DWORD dwEventID;
DWORD dwErrorCode;
SETTINGSTATUS status;
SYSTEMTIME timeLogged;
} POLICYSETTINGSTATUSINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POLICYSETTINGSTATUSINFO
{
public IntPtr szKey;
public IntPtr szEventSource;
public IntPtr szEventLogName;
public uint dwEventID;
public uint dwErrorCode;
public int status;
public SYSTEMTIME timeLogged;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEMTIME
Public wYear As UShort
Public wMonth As UShort
Public wDayOfWeek As UShort
Public wDay As UShort
Public wHour As UShort
Public wMinute As UShort
Public wSecond As UShort
Public wMilliseconds As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POLICYSETTINGSTATUSINFO
Public szKey As IntPtr
Public szEventSource As IntPtr
Public szEventLogName As IntPtr
Public dwEventID As UInteger
Public dwErrorCode As UInteger
Public status As Integer
Public timeLogged As SYSTEMTIME
End Structureimport ctypes
from ctypes import wintypes
class SYSTEMTIME(ctypes.Structure):
_fields_ = [
("wYear", ctypes.c_ushort),
("wMonth", ctypes.c_ushort),
("wDayOfWeek", ctypes.c_ushort),
("wDay", ctypes.c_ushort),
("wHour", ctypes.c_ushort),
("wMinute", ctypes.c_ushort),
("wSecond", ctypes.c_ushort),
("wMilliseconds", ctypes.c_ushort),
]
class POLICYSETTINGSTATUSINFO(ctypes.Structure):
_fields_ = [
("szKey", ctypes.c_void_p),
("szEventSource", ctypes.c_void_p),
("szEventLogName", ctypes.c_void_p),
("dwEventID", wintypes.DWORD),
("dwErrorCode", wintypes.DWORD),
("status", ctypes.c_int),
("timeLogged", SYSTEMTIME),
]#[repr(C)]
pub struct SYSTEMTIME {
pub wYear: u16,
pub wMonth: u16,
pub wDayOfWeek: u16,
pub wDay: u16,
pub wHour: u16,
pub wMinute: u16,
pub wSecond: u16,
pub wMilliseconds: u16,
}
#[repr(C)]
pub struct POLICYSETTINGSTATUSINFO {
pub szKey: *mut core::ffi::c_void,
pub szEventSource: *mut core::ffi::c_void,
pub szEventLogName: *mut core::ffi::c_void,
pub dwEventID: u32,
pub dwErrorCode: u32,
pub status: i32,
pub timeLogged: SYSTEMTIME,
}import "golang.org/x/sys/windows"
type SYSTEMTIME struct {
wYear uint16
wMonth uint16
wDayOfWeek uint16
wDay uint16
wHour uint16
wMinute uint16
wSecond uint16
wMilliseconds uint16
}
type POLICYSETTINGSTATUSINFO struct {
szKey uintptr
szEventSource uintptr
szEventLogName uintptr
dwEventID uint32
dwErrorCode uint32
status int32
timeLogged SYSTEMTIME
}type
SYSTEMTIME = record
wYear: Word;
wMonth: Word;
wDayOfWeek: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
wSecond: Word;
wMilliseconds: Word;
end;
POLICYSETTINGSTATUSINFO = record
szKey: Pointer;
szEventSource: Pointer;
szEventLogName: Pointer;
dwEventID: DWORD;
dwErrorCode: DWORD;
status: Integer;
timeLogged: SYSTEMTIME;
end;const SYSTEMTIME = extern struct {
wYear: u16,
wMonth: u16,
wDayOfWeek: u16,
wDay: u16,
wHour: u16,
wMinute: u16,
wSecond: u16,
wMilliseconds: u16,
};
const POLICYSETTINGSTATUSINFO = extern struct {
szKey: ?*anyopaque,
szEventSource: ?*anyopaque,
szEventLogName: ?*anyopaque,
dwEventID: u32,
dwErrorCode: u32,
status: i32,
timeLogged: SYSTEMTIME,
};type
SYSTEMTIME {.bycopy.} = object
wYear: uint16
wMonth: uint16
wDayOfWeek: uint16
wDay: uint16
wHour: uint16
wMinute: uint16
wSecond: uint16
wMilliseconds: uint16
POLICYSETTINGSTATUSINFO {.bycopy.} = object
szKey: pointer
szEventSource: pointer
szEventLogName: pointer
dwEventID: uint32
dwErrorCode: uint32
status: int32
timeLogged: SYSTEMTIMEstruct SYSTEMTIME
{
ushort wYear;
ushort wMonth;
ushort wDayOfWeek;
ushort wDay;
ushort wHour;
ushort wMinute;
ushort wSecond;
ushort wMilliseconds;
}
struct POLICYSETTINGSTATUSINFO
{
void* szKey;
void* szEventSource;
void* szEventLogName;
uint dwEventID;
uint dwErrorCode;
int status;
SYSTEMTIME timeLogged;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; POLICYSETTINGSTATUSINFO サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; szKey : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szEventSource : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; szEventLogName : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwEventID : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwErrorCode : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; status : SETTINGSTATUS (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; timeLogged : SYSTEMTIME (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; POLICYSETTINGSTATUSINFO サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; szKey : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; szEventSource : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; szEventLogName : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwEventID : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwErrorCode : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; status : SETTINGSTATUS (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; timeLogged : SYSTEMTIME (+36, 16byte) varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SYSTEMTIME
#field short wYear
#field short wMonth
#field short wDayOfWeek
#field short wDay
#field short wHour
#field short wMinute
#field short wSecond
#field short wMilliseconds
#endstruct
#defstruct global POLICYSETTINGSTATUSINFO
#field intptr szKey
#field intptr szEventSource
#field intptr szEventLogName
#field int dwEventID
#field int dwErrorCode
#field int status
#field SYSTEMTIME timeLogged
#endstruct
stdim st, POLICYSETTINGSTATUSINFO ; NSTRUCT 変数を確保
st->dwEventID = 100
mes "dwEventID=" + st->dwEventID