ホーム › Security.Cryptography › SCHANNEL_ALG
SCHANNEL_ALG
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwUse | DWORD | 4 | +0 | +0 | アルゴリズムの用途(暗号化/鍵交換/ハッシュ等)を示す値。 |
| Algid | ALG_ID | 4 | +4 | +4 | アルゴリズム識別子(ALG_ID)。 |
| cBits | DWORD | 4 | +8 | +8 | 鍵またはハッシュのビット長。 |
| dwFlags | DWORD | 4 | +12 | +12 | アルゴリズムの扱いを制御するフラグ。 |
| dwReserved | DWORD | 4 | +16 | +16 | 予約済みフィールド。 |
各言語での定義
#include <windows.h>
// SCHANNEL_ALG (x64 20 / x86 20 バイト)
typedef struct SCHANNEL_ALG {
DWORD dwUse;
ALG_ID Algid;
DWORD cBits;
DWORD dwFlags;
DWORD dwReserved;
} SCHANNEL_ALG;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCHANNEL_ALG
{
public uint dwUse;
public uint Algid;
public uint cBits;
public uint dwFlags;
public uint dwReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCHANNEL_ALG
Public dwUse As UInteger
Public Algid As UInteger
Public cBits As UInteger
Public dwFlags As UInteger
Public dwReserved As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SCHANNEL_ALG(ctypes.Structure):
_fields_ = [
("dwUse", wintypes.DWORD),
("Algid", wintypes.DWORD),
("cBits", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("dwReserved", wintypes.DWORD),
]#[repr(C)]
pub struct SCHANNEL_ALG {
pub dwUse: u32,
pub Algid: u32,
pub cBits: u32,
pub dwFlags: u32,
pub dwReserved: u32,
}import "golang.org/x/sys/windows"
type SCHANNEL_ALG struct {
dwUse uint32
Algid uint32
cBits uint32
dwFlags uint32
dwReserved uint32
}type
SCHANNEL_ALG = record
dwUse: DWORD;
Algid: DWORD;
cBits: DWORD;
dwFlags: DWORD;
dwReserved: DWORD;
end;const SCHANNEL_ALG = extern struct {
dwUse: u32,
Algid: u32,
cBits: u32,
dwFlags: u32,
dwReserved: u32,
};type
SCHANNEL_ALG {.bycopy.} = object
dwUse: uint32
Algid: uint32
cBits: uint32
dwFlags: uint32
dwReserved: uint32struct SCHANNEL_ALG
{
uint dwUse;
uint Algid;
uint cBits;
uint dwFlags;
uint dwReserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCHANNEL_ALG サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dwUse : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Algid : ALG_ID (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cBits : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwFlags : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwReserved : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SCHANNEL_ALG
#field int dwUse
#field int Algid
#field int cBits
#field int dwFlags
#field int dwReserved
#endstruct
stdim st, SCHANNEL_ALG ; NSTRUCT 変数を確保
st->dwUse = 100
mes "dwUse=" + st->dwUse