JOBOBJECT_SECURITY_LIMIT_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SecurityLimitFlags | JOB_OBJECT_SECURITY | 4 | +0 | +0 | ジョブに対するセキュリティ制限です。このメンバーには、以下の値の 1 つ以上を指定できます。
| ||||||||||
| JobToken | HANDLE | 8/4 | +8 | +4 | ユーザーを表すプライマリ トークンへのハンドルです。このハンドルには TOKEN_ASSIGN_PRIMARY アクセス権が必要です。 トークンが CreateRestrictedToken で作成された場合、ジョブ内のすべてのプロセスはそのトークン、またはさらに制限されたトークンに限定されます。それ以外の場合、呼び出し元には SE_ASSIGNPRIMARYTOKEN_NAME 特権が必要です。 | ||||||||||
| SidsToDisable | TOKEN_GROUPS* | 8/4 | +16 | +8 | SecurityLimitFlags が JOB_OBJECT_SECURITY_FILTER_TOKENS の場合に、アクセス チェックで無効化する SID を指定する TOKEN_GROUPS 構造体へのポインターです。 無効化する SID がない場合、このメンバーは NULL にできます。 | ||||||||||
| PrivilegesToDelete | TOKEN_PRIVILEGES* | 8/4 | +24 | +12 | SecurityLimitFlags が JOB_OBJECT_SECURITY_FILTER_TOKENS の場合に、トークンから削除する特権を指定する TOKEN_PRIVILEGES 構造体へのポインターです。 削除する特権がない場合、このメンバーは NULL にできます。 | ||||||||||
| RestrictedSids | TOKEN_GROUPS* | 8/4 | +32 | +16 | SecurityLimitFlags が JOB_OBJECT_SECURITY_FILTER_TOKENS の場合に、アクセス トークンに追加される拒否専用 SID を指定する TOKEN_GROUPS 構造体へのポインターです。 拒否専用 SID を指定しない場合、このメンバーは NULL にできます。 |
公式ドキュメント
[JOBOBJECT_SECURITY_LIMIT_INFORMATION は、「要件」セクションに記載されたオペレーティング システムで使用できます。この構造体のサポートは Windows Vista 以降で削除されました。詳細については「解説」を参照してください。]
ジョブ オブジェクトのセキュリティ制限を格納します。
解説(Remarks)
ジョブ内のプロセスにセキュリティ制限を設定した後は、それを取り消すことはできません。
Windows Vista 以降では、SetInformationJobObject を使用してジョブ オブジェクトに対してセキュリティ制限を設定するのではなく、ジョブ オブジェクトに関連付けられた各プロセスに対して個別にセキュリティ制限を設定する必要があります。詳細については、Process Security and Access Rights を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// JOBOBJECT_SECURITY_LIMIT_INFORMATION (x64 40 / x86 20 バイト)
typedef struct JOBOBJECT_SECURITY_LIMIT_INFORMATION {
JOB_OBJECT_SECURITY SecurityLimitFlags;
HANDLE JobToken;
TOKEN_GROUPS* SidsToDisable;
TOKEN_PRIVILEGES* PrivilegesToDelete;
TOKEN_GROUPS* RestrictedSids;
} JOBOBJECT_SECURITY_LIMIT_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct JOBOBJECT_SECURITY_LIMIT_INFORMATION
{
public uint SecurityLimitFlags;
public IntPtr JobToken;
public IntPtr SidsToDisable;
public IntPtr PrivilegesToDelete;
public IntPtr RestrictedSids;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure JOBOBJECT_SECURITY_LIMIT_INFORMATION
Public SecurityLimitFlags As UInteger
Public JobToken As IntPtr
Public SidsToDisable As IntPtr
Public PrivilegesToDelete As IntPtr
Public RestrictedSids As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class JOBOBJECT_SECURITY_LIMIT_INFORMATION(ctypes.Structure):
_fields_ = [
("SecurityLimitFlags", wintypes.DWORD),
("JobToken", ctypes.c_void_p),
("SidsToDisable", ctypes.c_void_p),
("PrivilegesToDelete", ctypes.c_void_p),
("RestrictedSids", ctypes.c_void_p),
]#[repr(C)]
pub struct JOBOBJECT_SECURITY_LIMIT_INFORMATION {
pub SecurityLimitFlags: u32,
pub JobToken: *mut core::ffi::c_void,
pub SidsToDisable: *mut core::ffi::c_void,
pub PrivilegesToDelete: *mut core::ffi::c_void,
pub RestrictedSids: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type JOBOBJECT_SECURITY_LIMIT_INFORMATION struct {
SecurityLimitFlags uint32
JobToken uintptr
SidsToDisable uintptr
PrivilegesToDelete uintptr
RestrictedSids uintptr
}type
JOBOBJECT_SECURITY_LIMIT_INFORMATION = record
SecurityLimitFlags: DWORD;
JobToken: Pointer;
SidsToDisable: Pointer;
PrivilegesToDelete: Pointer;
RestrictedSids: Pointer;
end;const JOBOBJECT_SECURITY_LIMIT_INFORMATION = extern struct {
SecurityLimitFlags: u32,
JobToken: ?*anyopaque,
SidsToDisable: ?*anyopaque,
PrivilegesToDelete: ?*anyopaque,
RestrictedSids: ?*anyopaque,
};type
JOBOBJECT_SECURITY_LIMIT_INFORMATION {.bycopy.} = object
SecurityLimitFlags: uint32
JobToken: pointer
SidsToDisable: pointer
PrivilegesToDelete: pointer
RestrictedSids: pointerstruct JOBOBJECT_SECURITY_LIMIT_INFORMATION
{
uint SecurityLimitFlags;
void* JobToken;
void* SidsToDisable;
void* PrivilegesToDelete;
void* RestrictedSids;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; JOBOBJECT_SECURITY_LIMIT_INFORMATION サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; SecurityLimitFlags : JOB_OBJECT_SECURITY (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; JobToken : HANDLE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; SidsToDisable : TOKEN_GROUPS* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; PrivilegesToDelete : TOKEN_PRIVILEGES* (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; RestrictedSids : TOKEN_GROUPS* (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; JOBOBJECT_SECURITY_LIMIT_INFORMATION サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; SecurityLimitFlags : JOB_OBJECT_SECURITY (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; JobToken : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; SidsToDisable : TOKEN_GROUPS* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; PrivilegesToDelete : TOKEN_PRIVILEGES* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; RestrictedSids : TOKEN_GROUPS* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global JOBOBJECT_SECURITY_LIMIT_INFORMATION
#field int SecurityLimitFlags
#field intptr JobToken
#field intptr SidsToDisable
#field intptr PrivilegesToDelete
#field intptr RestrictedSids
#endstruct
stdim st, JOBOBJECT_SECURITY_LIMIT_INFORMATION ; NSTRUCT 変数を確保
st->SecurityLimitFlags = 100
mes "SecurityLimitFlags=" + st->SecurityLimitFlags