SECURITY_QUALITY_OF_SERVICE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で指定します。 |
| ImpersonationLevel | SECURITY_IMPERSONATION_LEVEL | 4 | +4 | +4 | クライアントに関してサーバーへ与えられる情報と、サーバーがクライアントをどのように表現または偽装できるかを指定します。セキュリティ偽装レベルは、サーバープロセスがクライアントプロセスの代わりに動作できる度合いを制御します。このメンバーは SECURITY_IMPERSONATION_LEVEL 列挙型の値です。 |
| ContextTrackingMode | BYTE | 1 | +8 | +8 | サーバーにクライアントのセキュリティコンテキストのスナップショットを与えるか (静的トラッキングと呼ばれます)、クライアントのセキュリティコンテキストの変更を追跡して継続的に更新するか (動的トラッキングと呼ばれます) を指定します。SECURITY_STATIC_TRACKING 値は静的トラッキングを、SECURITY_DYNAMIC_TRACKING 値は動的トラッキングを指定します。すべての通信メカニズムが動的トラッキングをサポートしているわけではなく、サポートしていないものは既定で静的トラッキングになります。 |
| EffectiveOnly | BOOLEAN | 1 | +9 | +9 | クライアントのセキュリティコンテキストに含まれる特権およびグループを、サーバーが有効化または無効化できるかどうかを指定します。 |
公式ドキュメント
SECURITY_QUALITY_OF_SERVICE データ構造体は、クライアントの偽装をサポートするために使用される情報を格納します。クライアントはサーバーへの接続時にこの情報を指定できます。この情報によって、サーバーがクライアントを偽装できるかどうか、また偽装できる場合はどの程度まで偽装できるかが決まります。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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>
// 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