📄 bulltlp3.h
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
Module Name:
scrcp8t.h
Abstract:
smartcard TLP3 serial miniport defines and structures
Author:
Revision History:
--*/
#ifndef _BULLTLP3_
#define _BULLTLP3_
//#define DRIVER_NAME "BULLTLP3"
//#define SMARTCARD_POOL_TAG '3BCS'
//#include <ntddk.h>
//#include <ntddser.h>
//#include "smclib.h"
//#include "tlp3log.h"
//lbq add
#include <winioctl.h>
#define MAXIMUM_SERIAL_READERS 4
#define SMARTCARD_READ SCARD_CTL_CODE( 0x800)
#define SMARTCARD_WRITE SCARD_CTL_CODE( 0x801)
#define IOCTL_INIT_COMPLETE SCARD_CTL_CODE( 0x810 )
#define READ_INTERVAL_TIMEOUT_DEFAULT 1000
#define READ_TOTAL_TIMEOUT_CONSTANT_DEFAULT 3000
#define READ_INTERVAL_TIMEOUT_ATR 0
#define READ_TOTAL_TIMEOUT_CONSTANT_ATR 50
#define READER_CMD_POWER_DOWN 'O'
#define READER_CMD_COLD_RESET 'C'
#define READER_CMD_WARM_RESET 'W'
#ifndef REG_PATH_LEN
#define REG_PATH_LEN 256
#endif
typedef enum _READER_POWER_STATE {
PowerReaderUnspecified = 0,
PowerReaderWorking,
PowerReaderOff
} READER_POWER_STATE, *PREADER_POWER_STATE;
typedef struct _SERIAL_READER_CONFIG {
// Baud rate , line control, control char and etc.
DCB SerialControlBlock;
// read/write timeouts
COMMTIMEOUTS Timeouts;
// Event serial reader uses to signal insert/removal
ULONG SerialWaitMask;
} SERIAL_READER_CONFIG, *PSERIAL_READER_CONFIG;
/*
typedef struct _DEVICE_EXTENSION {
// Our smart card extension
SMARTCARD_EXTENSION SmartcardExtension;
// The current number of io-requests
LONG IoCount;
// Used to signal that the reader is able to process reqeusts
KEVENT ReaderStarted;
// Used to signal the the reader has been closed
KEVENT ReaderClosed;
// Used to signal that the connection to the serial driver has been closed
KEVENT SerialCloseDone;
ULONG DeviceInstance;
// The pnp device name of our smart card reader
UNICODE_STRING PnPDeviceName;
KSPIN_LOCK SpinLock;
// A worker thread that closes the serial driver
WORK_QUEUE_ITEM CloseSerial;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
*/
//
// Define the reader specific portion of the smart card extension
//
typedef struct _READER_EXTENSION {
// IoRequest to be send to serial driver
ULONG SerialIoControlCode;
// Variable used to receive the modem status
ULONG ModemStatus;
// Flag that indicates that the caller requests a power-down or a reset
BOOLEAN PowerRequest;
BOOLEAN ModemStatusChanged;
SERIAL_READER_CONFIG SerialConfigData;
// Current reader power state.
READER_POWER_STATE ReaderPowerState;
// following fields are specific to WinCE driver
LONG d_RefCount; // count the number of references to the device
// backgroud thread for track modem status change.
HANDLE hBackgroundThread;
DWORD dwThreadID;
UINT d_uReaderState; // state of device (STATE_OPENED, STATE_CLOSED, etc
HANDLE hSerialPort; // Serial Port Handle and its name.
TCHAR d_SerialPort[DEVNAME_LEN];
TCHAR d_ActivePath[REG_PATH_LEN]; // registry path to active device
} READER_EXTENSION, *PREADER_EXTENSION;
#define READER_EXTENSION(member) (SmartcardExtension->ReaderExtension->member)
//
// Prototypes
//
NTSTATUS
TLP3ReaderPower( PSMARTCARD_EXTENSION SmartcardExtension );
NTSTATUS
TLP3SetProtocol( PSMARTCARD_EXTENSION SmartcardExtension );
NTSTATUS
TLP3TransmitT0( PSMARTCARD_EXTENSION SmartcardExtension );
NTSTATUS
TLP3Transmit( PSMARTCARD_EXTENSION SmartcardExtension );
NTSTATUS
TLP3CardTracking( PSMARTCARD_EXTENSION SmartcardExtension );
NTSTATUS
TLP3VendorIoctl( PSMARTCARD_EXTENSION SmartcardExtension );
#define ETX 0x03 /* End character */
#define STAR_ACK 0x60 /* Acknowledge */
#define STAR_NACK 0xE0 /* No acknowledge */
/* error no define */
#define SUC 0
#define ERR -1
#define ICC_LRC_ERR -11
#define ICC_DATAPACK_ERR -12
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -