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

READER_SEL_REQUEST

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

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

フィールド

フィールドサイズx64x86説明
dwShareModeDWORD4+0+0カードへの共有アクセスモード。
dwPreferredProtocolsDWORD4+4+4優先する通信プロトコルのビットマスク。
MatchTypeREADER_SEL_REQUEST_MATCH_TYPE4+8+8リーダー/カードの照合方式を示す列挙値。
Anonymous_Anonymous_e__Union8/4+16+12照合方式に応じた照合条件を保持する無名共用体。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
ReaderAndContainerParameter_ReaderAndContainerParameter_e__Struct8/4+0+0
SerialNumberParameter_SerialNumberParameter_e__Struct8/4+0+0

各言語での定義

#include <windows.h>

// READER_SEL_REQUEST  (x64 24 / x86 16 バイト)
typedef struct READER_SEL_REQUEST {
    DWORD dwShareMode;
    DWORD dwPreferredProtocols;
    READER_SEL_REQUEST_MATCH_TYPE MatchType;
    _Anonymous_e__Union Anonymous;
} READER_SEL_REQUEST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct READER_SEL_REQUEST
{
    public uint dwShareMode;
    public uint dwPreferredProtocols;
    public int MatchType;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure READER_SEL_REQUEST
    Public dwShareMode As UInteger
    Public dwPreferredProtocols As UInteger
    Public MatchType As Integer
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class READER_SEL_REQUEST(ctypes.Structure):
    _fields_ = [
        ("dwShareMode", wintypes.DWORD),
        ("dwPreferredProtocols", wintypes.DWORD),
        ("MatchType", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct READER_SEL_REQUEST {
    pub dwShareMode: u32,
    pub dwPreferredProtocols: u32,
    pub MatchType: i32,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type READER_SEL_REQUEST struct {
	dwShareMode uint32
	dwPreferredProtocols uint32
	MatchType int32
	Anonymous _Anonymous_e__Union
}
type
  READER_SEL_REQUEST = record
    dwShareMode: DWORD;
    dwPreferredProtocols: DWORD;
    MatchType: Integer;
    Anonymous: _Anonymous_e__Union;
  end;
const READER_SEL_REQUEST = extern struct {
    dwShareMode: u32,
    dwPreferredProtocols: u32,
    MatchType: i32,
    Anonymous: _Anonymous_e__Union,
};
type
  READER_SEL_REQUEST {.bycopy.} = object
    dwShareMode: uint32
    dwPreferredProtocols: uint32
    MatchType: int32
    Anonymous: _Anonymous_e__Union
struct READER_SEL_REQUEST
{
    uint dwShareMode;
    uint dwPreferredProtocols;
    int MatchType;
    _Anonymous_e__Union Anonymous;
}

HSP用 定義

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

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

stdim st, READER_SEL_REQUEST        ; NSTRUCT 変数を確保
st->dwShareMode = 100
mes "dwShareMode=" + st->dwShareMode
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。