ホーム › System.SystemServices › PROCESS_MITIGATION_DEP_POLICY
PROCESS_MITIGATION_DEP_POLICY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Anonymous | _Anonymous_e__Union | 8/4 | +0 | +0 | DEP(データ実行防止)有効化やATLサンクエミュレーション等を制御するビットフィールドの無名共用体。 |
| Permanent | BOOLEAN | 1 | +8 | +4 | DEP設定を恒久的に固定し変更不可とするか否かを示す。 |
共用体: _Anonymous_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Flags | DWORD | 4 | +0 | +0 | |
| Anonymous | _Anonymous_e__Struct | 8/4 | +0 | +0 | DEP(データ実行防止)有効化やATLサンクエミュレーション等を制御するビットフィールドの無名共用体。 |
各言語での定義
#include <windows.h>
// PROCESS_MITIGATION_DEP_POLICY (x64 16 / x86 8 バイト)
typedef struct PROCESS_MITIGATION_DEP_POLICY {
_Anonymous_e__Union Anonymous;
BOOLEAN Permanent;
} PROCESS_MITIGATION_DEP_POLICY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PROCESS_MITIGATION_DEP_POLICY
{
public _Anonymous_e__Union Anonymous;
[MarshalAs(UnmanagedType.U1)] public bool Permanent;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PROCESS_MITIGATION_DEP_POLICY
Public Anonymous As _Anonymous_e__Union
<MarshalAs(UnmanagedType.U1)> Public Permanent As Boolean
End Structureimport ctypes
from ctypes import wintypes
class PROCESS_MITIGATION_DEP_POLICY(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
("Permanent", ctypes.c_byte),
]#[repr(C)]
pub struct PROCESS_MITIGATION_DEP_POLICY {
pub Anonymous: _Anonymous_e__Union,
pub Permanent: u8,
}import "golang.org/x/sys/windows"
type PROCESS_MITIGATION_DEP_POLICY struct {
Anonymous _Anonymous_e__Union
Permanent byte
}type
PROCESS_MITIGATION_DEP_POLICY = record
Anonymous: _Anonymous_e__Union;
Permanent: ByteBool;
end;const PROCESS_MITIGATION_DEP_POLICY = extern struct {
Anonymous: _Anonymous_e__Union,
Permanent: u8,
};type
PROCESS_MITIGATION_DEP_POLICY {.bycopy.} = object
Anonymous: _Anonymous_e__Union
Permanent: uint8struct PROCESS_MITIGATION_DEP_POLICY
{
_Anonymous_e__Union Anonymous;
ubyte Permanent;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PROCESS_MITIGATION_DEP_POLICY サイズ: 8 バイト(x86)
dim st, 2 ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; Anonymous : _Anonymous_e__Union (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; Permanent : BOOLEAN (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PROCESS_MITIGATION_DEP_POLICY サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Anonymous : _Anonymous_e__Union (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Permanent : BOOLEAN (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PROCESS_MITIGATION_DEP_POLICY
#field byte Anonymous 8
#field bool1 Permanent
#endstruct
stdim st, PROCESS_MITIGATION_DEP_POLICY ; NSTRUCT 変数を確保
st->Permanent = 100
mes "Permanent=" + st->Permanent
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。