Win32 API 日本語リファレンス
ホームSecurity.Cryptography › NCRYPT_SUPPORTED_LENGTHS

NCRYPT_SUPPORTED_LENGTHS

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

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

フィールド

フィールドサイズx64x86説明
dwMinLengthDWORD4+0+0サポートされる最小鍵長(ビット)。
dwMaxLengthDWORD4+4+4サポートされる最大鍵長(ビット)。
dwIncrementDWORD4+8+8鍵長の刻み幅(ビット)。0は任意長を示す。
dwDefaultLengthDWORD4+12+12既定の鍵長(ビット)。

各言語での定義

#include <windows.h>

// NCRYPT_SUPPORTED_LENGTHS  (x64 16 / x86 16 バイト)
typedef struct NCRYPT_SUPPORTED_LENGTHS {
    DWORD dwMinLength;
    DWORD dwMaxLength;
    DWORD dwIncrement;
    DWORD dwDefaultLength;
} NCRYPT_SUPPORTED_LENGTHS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NCRYPT_SUPPORTED_LENGTHS
{
    public uint dwMinLength;
    public uint dwMaxLength;
    public uint dwIncrement;
    public uint dwDefaultLength;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NCRYPT_SUPPORTED_LENGTHS
    Public dwMinLength As UInteger
    Public dwMaxLength As UInteger
    Public dwIncrement As UInteger
    Public dwDefaultLength As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NCRYPT_SUPPORTED_LENGTHS(ctypes.Structure):
    _fields_ = [
        ("dwMinLength", wintypes.DWORD),
        ("dwMaxLength", wintypes.DWORD),
        ("dwIncrement", wintypes.DWORD),
        ("dwDefaultLength", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NCRYPT_SUPPORTED_LENGTHS {
    pub dwMinLength: u32,
    pub dwMaxLength: u32,
    pub dwIncrement: u32,
    pub dwDefaultLength: u32,
}
import "golang.org/x/sys/windows"

type NCRYPT_SUPPORTED_LENGTHS struct {
	dwMinLength uint32
	dwMaxLength uint32
	dwIncrement uint32
	dwDefaultLength uint32
}
type
  NCRYPT_SUPPORTED_LENGTHS = record
    dwMinLength: DWORD;
    dwMaxLength: DWORD;
    dwIncrement: DWORD;
    dwDefaultLength: DWORD;
  end;
const NCRYPT_SUPPORTED_LENGTHS = extern struct {
    dwMinLength: u32,
    dwMaxLength: u32,
    dwIncrement: u32,
    dwDefaultLength: u32,
};
type
  NCRYPT_SUPPORTED_LENGTHS {.bycopy.} = object
    dwMinLength: uint32
    dwMaxLength: uint32
    dwIncrement: uint32
    dwDefaultLength: uint32
struct NCRYPT_SUPPORTED_LENGTHS
{
    uint dwMinLength;
    uint dwMaxLength;
    uint dwIncrement;
    uint dwDefaultLength;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NCRYPT_SUPPORTED_LENGTHS サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; dwMinLength : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwMaxLength : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwIncrement : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwDefaultLength : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NCRYPT_SUPPORTED_LENGTHS
    #field int dwMinLength
    #field int dwMaxLength
    #field int dwIncrement
    #field int dwDefaultLength
#endstruct

stdim st, NCRYPT_SUPPORTED_LENGTHS        ; NSTRUCT 変数を確保
st->dwMinLength = 100
mes "dwMinLength=" + st->dwMinLength