SECURITY_QUALITY_OF_SERVICE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | この構造体のバイト数。sizeofを設定する。 |
| ImpersonationLevel | SECURITY_IMPERSONATION_LEVEL | 4 | +4 | +4 | 要求する偽装レベルを示す列挙値。 |
| ContextTrackingMode | BYTE | 1 | +8 | +8 | コンテキスト追跡モード。静的か動的かを示すバイト値。 |
| EffectiveOnly | BOOLEAN | 1 | +9 | +9 | 有効な特権/グループのみを偽装に反映するかを示す真偽値。 |
各言語での定義
#include <windows.h>
// SECURITY_QUALITY_OF_SERVICE (x64 12 / x86 12 バイト)
typedef struct SECURITY_QUALITY_OF_SERVICE {
DWORD Length;
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
BYTE ContextTrackingMode;
BOOLEAN EffectiveOnly;
} SECURITY_QUALITY_OF_SERVICE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURITY_QUALITY_OF_SERVICE
{
public uint Length;
public int ImpersonationLevel;
public byte ContextTrackingMode;
[MarshalAs(UnmanagedType.U1)] public bool EffectiveOnly;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECURITY_QUALITY_OF_SERVICE
Public Length As UInteger
Public ImpersonationLevel As Integer
Public ContextTrackingMode As Byte
<MarshalAs(UnmanagedType.U1)> Public EffectiveOnly As Boolean
End Structureimport ctypes
from ctypes import wintypes
class SECURITY_QUALITY_OF_SERVICE(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("ImpersonationLevel", ctypes.c_int),
("ContextTrackingMode", ctypes.c_ubyte),
("EffectiveOnly", ctypes.c_byte),
]#[repr(C)]
pub struct SECURITY_QUALITY_OF_SERVICE {
pub Length: u32,
pub ImpersonationLevel: i32,
pub ContextTrackingMode: u8,
pub EffectiveOnly: u8,
}import "golang.org/x/sys/windows"
type SECURITY_QUALITY_OF_SERVICE struct {
Length uint32
ImpersonationLevel int32
ContextTrackingMode byte
EffectiveOnly byte
}type
SECURITY_QUALITY_OF_SERVICE = record
Length: DWORD;
ImpersonationLevel: Integer;
ContextTrackingMode: Byte;
EffectiveOnly: ByteBool;
end;const SECURITY_QUALITY_OF_SERVICE = extern struct {
Length: u32,
ImpersonationLevel: i32,
ContextTrackingMode: u8,
EffectiveOnly: u8,
};type
SECURITY_QUALITY_OF_SERVICE {.bycopy.} = object
Length: uint32
ImpersonationLevel: int32
ContextTrackingMode: uint8
EffectiveOnly: uint8struct SECURITY_QUALITY_OF_SERVICE
{
uint Length;
int ImpersonationLevel;
ubyte ContextTrackingMode;
ubyte EffectiveOnly;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECURITY_QUALITY_OF_SERVICE サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ImpersonationLevel : SECURITY_IMPERSONATION_LEVEL (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ContextTrackingMode : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; EffectiveOnly : BOOLEAN (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SECURITY_QUALITY_OF_SERVICE
#field int Length
#field int ImpersonationLevel
#field byte ContextTrackingMode
#field bool1 EffectiveOnly
#endstruct
stdim st, SECURITY_QUALITY_OF_SERVICE ; NSTRUCT 変数を確保
st->Length = 100
mes "Length=" + st->Length