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

JOBOBJECT_SECURITY_LIMIT_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
SecurityLimitFlagsJOB_OBJECT_SECURITY4+0+0適用するセキュリティ制限を示すJOB_OBJECT_SECURITYフラグ。
JobTokenHANDLE8/4+8+4ジョブ内プロセスに強制適用するアクセストークンのハンドル。
SidsToDisableTOKEN_GROUPS*8/4+16+8無効化するSIDを列挙したTOKEN_GROUPSへのポインター。
PrivilegesToDeleteTOKEN_PRIVILEGES*8/4+24+12削除する特権を列挙したTOKEN_PRIVILEGESへのポインター。
RestrictedSidsTOKEN_GROUPS*8/4+32+16制限付きSIDを列挙したTOKEN_GROUPSへのポインター。

各言語での定義

#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 Structure
import 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: pointer
struct 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