ホーム › Security.Cryptography › PIN_INFO
PIN_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwVersion | DWORD | 4 | +0 | +0 | PIN情報構造体のバージョン番号。 |
| PinType | SECRET_TYPE | 4 | +4 | +4 | PIN(シークレット)の種別を示す列挙値。 |
| PinPurpose | SECRET_PURPOSE | 4 | +8 | +8 | PINの用途を示す列挙値。 |
| dwChangePermission | DWORD | 4 | +12 | +12 | PIN変更を許可する主体を示すビットマスク。 |
| dwUnblockPermission | DWORD | 4 | +16 | +16 | PINブロック解除を許可する主体を示すビットマスク。 |
| PinCachePolicy | PIN_CACHE_POLICY | 12 | +20 | +20 | PINキャッシュポリシー構造体。 |
| dwFlags | DWORD | 4 | +32 | +32 | PINに関する動作フラグ。 |
各言語での定義
#include <windows.h>
// PIN_CACHE_POLICY (x64 12 / x86 12 バイト)
typedef struct PIN_CACHE_POLICY {
DWORD dwVersion;
PIN_CACHE_POLICY_TYPE PinCachePolicyType;
DWORD dwPinCachePolicyInfo;
} PIN_CACHE_POLICY;
// PIN_INFO (x64 36 / x86 36 バイト)
typedef struct PIN_INFO {
DWORD dwVersion;
SECRET_TYPE PinType;
SECRET_PURPOSE PinPurpose;
DWORD dwChangePermission;
DWORD dwUnblockPermission;
PIN_CACHE_POLICY PinCachePolicy;
DWORD dwFlags;
} PIN_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PIN_CACHE_POLICY
{
public uint dwVersion;
public int PinCachePolicyType;
public uint dwPinCachePolicyInfo;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PIN_INFO
{
public uint dwVersion;
public int PinType;
public int PinPurpose;
public uint dwChangePermission;
public uint dwUnblockPermission;
public PIN_CACHE_POLICY PinCachePolicy;
public uint dwFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PIN_CACHE_POLICY
Public dwVersion As UInteger
Public PinCachePolicyType As Integer
Public dwPinCachePolicyInfo As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PIN_INFO
Public dwVersion As UInteger
Public PinType As Integer
Public PinPurpose As Integer
Public dwChangePermission As UInteger
Public dwUnblockPermission As UInteger
Public PinCachePolicy As PIN_CACHE_POLICY
Public dwFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PIN_CACHE_POLICY(ctypes.Structure):
_fields_ = [
("dwVersion", wintypes.DWORD),
("PinCachePolicyType", ctypes.c_int),
("dwPinCachePolicyInfo", wintypes.DWORD),
]
class PIN_INFO(ctypes.Structure):
_fields_ = [
("dwVersion", wintypes.DWORD),
("PinType", ctypes.c_int),
("PinPurpose", ctypes.c_int),
("dwChangePermission", wintypes.DWORD),
("dwUnblockPermission", wintypes.DWORD),
("PinCachePolicy", PIN_CACHE_POLICY),
("dwFlags", wintypes.DWORD),
]#[repr(C)]
pub struct PIN_CACHE_POLICY {
pub dwVersion: u32,
pub PinCachePolicyType: i32,
pub dwPinCachePolicyInfo: u32,
}
#[repr(C)]
pub struct PIN_INFO {
pub dwVersion: u32,
pub PinType: i32,
pub PinPurpose: i32,
pub dwChangePermission: u32,
pub dwUnblockPermission: u32,
pub PinCachePolicy: PIN_CACHE_POLICY,
pub dwFlags: u32,
}import "golang.org/x/sys/windows"
type PIN_CACHE_POLICY struct {
dwVersion uint32
PinCachePolicyType int32
dwPinCachePolicyInfo uint32
}
type PIN_INFO struct {
dwVersion uint32
PinType int32
PinPurpose int32
dwChangePermission uint32
dwUnblockPermission uint32
PinCachePolicy PIN_CACHE_POLICY
dwFlags uint32
}type
PIN_CACHE_POLICY = record
dwVersion: DWORD;
PinCachePolicyType: Integer;
dwPinCachePolicyInfo: DWORD;
end;
PIN_INFO = record
dwVersion: DWORD;
PinType: Integer;
PinPurpose: Integer;
dwChangePermission: DWORD;
dwUnblockPermission: DWORD;
PinCachePolicy: PIN_CACHE_POLICY;
dwFlags: DWORD;
end;const PIN_CACHE_POLICY = extern struct {
dwVersion: u32,
PinCachePolicyType: i32,
dwPinCachePolicyInfo: u32,
};
const PIN_INFO = extern struct {
dwVersion: u32,
PinType: i32,
PinPurpose: i32,
dwChangePermission: u32,
dwUnblockPermission: u32,
PinCachePolicy: PIN_CACHE_POLICY,
dwFlags: u32,
};type
PIN_CACHE_POLICY {.bycopy.} = object
dwVersion: uint32
PinCachePolicyType: int32
dwPinCachePolicyInfo: uint32
PIN_INFO {.bycopy.} = object
dwVersion: uint32
PinType: int32
PinPurpose: int32
dwChangePermission: uint32
dwUnblockPermission: uint32
PinCachePolicy: PIN_CACHE_POLICY
dwFlags: uint32struct PIN_CACHE_POLICY
{
uint dwVersion;
int PinCachePolicyType;
uint dwPinCachePolicyInfo;
}
struct PIN_INFO
{
uint dwVersion;
int PinType;
int PinPurpose;
uint dwChangePermission;
uint dwUnblockPermission;
PIN_CACHE_POLICY PinCachePolicy;
uint dwFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PIN_INFO サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; PinType : SECRET_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PinPurpose : SECRET_PURPOSE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwChangePermission : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwUnblockPermission : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; PinCachePolicy : PIN_CACHE_POLICY (+20, 12byte) varptr(st)+20 を基点に操作(12byte:入れ子/配列)
; dwFlags : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PIN_CACHE_POLICY
#field int dwVersion
#field int PinCachePolicyType
#field int dwPinCachePolicyInfo
#endstruct
#defstruct global PIN_INFO
#field int dwVersion
#field int PinType
#field int PinPurpose
#field int dwChangePermission
#field int dwUnblockPermission
#field PIN_CACHE_POLICY PinCachePolicy
#field int dwFlags
#endstruct
stdim st, PIN_INFO ; NSTRUCT 変数を確保
st->dwVersion = 100
mes "dwVersion=" + st->dwVersion