ホーム › System.DataExchange › CONVCONTEXT
CONVCONTEXT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cb | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| wFlags | DWORD | 4 | +4 | +4 | 会話コンテキストのフラグ。 |
| wCountryID | DWORD | 4 | +8 | +8 | 国コードID。地域設定を表す。 |
| iCodePage | INT | 4 | +12 | +12 | データのコードページ。 |
| dwLangID | DWORD | 4 | +16 | +16 | 言語ID。 |
| dwSecurity | DWORD | 4 | +20 | +20 | プライベートなセキュリティ識別値。 |
| qos | SECURITY_QUALITY_OF_SERVICE | 12 | +24 | +24 | サービス品質(SECURITY_QUALITY_OF_SERVICE)のセキュリティ設定。 |
各言語での定義
#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;
// CONVCONTEXT (x64 36 / x86 36 バイト)
typedef struct CONVCONTEXT {
DWORD cb;
DWORD wFlags;
DWORD wCountryID;
INT iCodePage;
DWORD dwLangID;
DWORD dwSecurity;
SECURITY_QUALITY_OF_SERVICE qos;
} CONVCONTEXT;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONVCONTEXT
{
public uint cb;
public uint wFlags;
public uint wCountryID;
public int iCodePage;
public uint dwLangID;
public uint dwSecurity;
public SECURITY_QUALITY_OF_SERVICE qos;
}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 Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CONVCONTEXT
Public cb As UInteger
Public wFlags As UInteger
Public wCountryID As UInteger
Public iCodePage As Integer
Public dwLangID As UInteger
Public dwSecurity As UInteger
Public qos As SECURITY_QUALITY_OF_SERVICE
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),
]
class CONVCONTEXT(ctypes.Structure):
_fields_ = [
("cb", wintypes.DWORD),
("wFlags", wintypes.DWORD),
("wCountryID", wintypes.DWORD),
("iCodePage", ctypes.c_int),
("dwLangID", wintypes.DWORD),
("dwSecurity", wintypes.DWORD),
("qos", SECURITY_QUALITY_OF_SERVICE),
]#[repr(C)]
pub struct SECURITY_QUALITY_OF_SERVICE {
pub Length: u32,
pub ImpersonationLevel: i32,
pub ContextTrackingMode: u8,
pub EffectiveOnly: u8,
}
#[repr(C)]
pub struct CONVCONTEXT {
pub cb: u32,
pub wFlags: u32,
pub wCountryID: u32,
pub iCodePage: i32,
pub dwLangID: u32,
pub dwSecurity: u32,
pub qos: SECURITY_QUALITY_OF_SERVICE,
}import "golang.org/x/sys/windows"
type SECURITY_QUALITY_OF_SERVICE struct {
Length uint32
ImpersonationLevel int32
ContextTrackingMode byte
EffectiveOnly byte
}
type CONVCONTEXT struct {
cb uint32
wFlags uint32
wCountryID uint32
iCodePage int32
dwLangID uint32
dwSecurity uint32
qos SECURITY_QUALITY_OF_SERVICE
}type
SECURITY_QUALITY_OF_SERVICE = record
Length: DWORD;
ImpersonationLevel: Integer;
ContextTrackingMode: Byte;
EffectiveOnly: ByteBool;
end;
CONVCONTEXT = record
cb: DWORD;
wFlags: DWORD;
wCountryID: DWORD;
iCodePage: Integer;
dwLangID: DWORD;
dwSecurity: DWORD;
qos: SECURITY_QUALITY_OF_SERVICE;
end;const SECURITY_QUALITY_OF_SERVICE = extern struct {
Length: u32,
ImpersonationLevel: i32,
ContextTrackingMode: u8,
EffectiveOnly: u8,
};
const CONVCONTEXT = extern struct {
cb: u32,
wFlags: u32,
wCountryID: u32,
iCodePage: i32,
dwLangID: u32,
dwSecurity: u32,
qos: SECURITY_QUALITY_OF_SERVICE,
};type
SECURITY_QUALITY_OF_SERVICE {.bycopy.} = object
Length: uint32
ImpersonationLevel: int32
ContextTrackingMode: uint8
EffectiveOnly: uint8
CONVCONTEXT {.bycopy.} = object
cb: uint32
wFlags: uint32
wCountryID: uint32
iCodePage: int32
dwLangID: uint32
dwSecurity: uint32
qos: SECURITY_QUALITY_OF_SERVICEstruct SECURITY_QUALITY_OF_SERVICE
{
uint Length;
int ImpersonationLevel;
ubyte ContextTrackingMode;
ubyte EffectiveOnly;
}
struct CONVCONTEXT
{
uint cb;
uint wFlags;
uint wCountryID;
int iCodePage;
uint dwLangID;
uint dwSecurity;
SECURITY_QUALITY_OF_SERVICE qos;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONVCONTEXT サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; cb : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; wFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; wCountryID : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; iCodePage : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwLangID : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwSecurity : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; qos : SECURITY_QUALITY_OF_SERVICE (+24, 12byte) varptr(st)+24 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SECURITY_QUALITY_OF_SERVICE
#field int Length
#field int ImpersonationLevel
#field byte ContextTrackingMode
#field bool1 EffectiveOnly
#endstruct
#defstruct global CONVCONTEXT
#field int cb
#field int wFlags
#field int wCountryID
#field int iCodePage
#field int dwLangID
#field int dwSecurity
#field SECURITY_QUALITY_OF_SERVICE qos
#endstruct
stdim st, CONVCONTEXT ; NSTRUCT 変数を確保
st->cb = 100
mes "cb=" + st->cb