⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tlp3ce.h

📁 基于windows ce环境下对smart card 基于pc/sc架构下驱动例程
💻 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:

	TLP3CE.h

Abstract:

	Driver header - Win CE Version

Revision History:


--*/

#ifndef __TLP3CE_H__ 
#define __TLP3CE_H__

/*
#define METHOD_BUFFERED                 0
#define FILE_ANY_ACCESS                 0
#define CTL_CODE( DeviceType, Function, Method, Access ) (                 \
    ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
	)
*/
#define SMCLIB_CE       1

#define SysCompareMemory( p1, p2, Len )			memcmp( p1,p2, Len )
#define SysCopyMemory( pDest, pSrc, Len )		RtlCopyMemory( pDest, pSrc, Len )
#define SysFillMemory( pDest, Value, Len )		RtlFillMemory( pDest, Len, Value )

#define MICROSECONDS_PER_MILLISECOND 1000

typedef  TCHAR * LPTSTR;

//#define DELAY_WRITE_PSCR_REG    1
//#define DELAY_TLP3_WAIT			5

#define TLP3_VENDOR_NAME            "Bull"
#define TLP3_PRODUCT_NAME           "SmarTLP3"
#define TLP_DEVKEY_SERIALPORT		"Port"

// values for READER_EXTENSION.d_uReaderState
#define STATE_INITING 1
#define STATE_CLOSED  2
#define STATE_OPENED  3
#define STATE_DEAD    4    // Power down
#define STATE_REMOVED 5    // Power down

const TCHAR szDriverName[];
//
// Prototypes
//
static BOOL 
AddDevice(PSMARTCARD_EXTENSION pDevice);

static BOOL 
RemoveDevice(PSMARTCARD_EXTENSION pDevice);

BOOL 
ValidateAndEnterDevice(PSMARTCARD_EXTENSION pDevice);

BOOL WINAPI
DllEntry(HINSTANCE DllInstance, INT Reason, LPVOID Reserved);

DWORD
SCR_Init( DWORD dwContext );

BOOL
SCR_Deinit( DWORD dwContext );

DWORD
SCR_Open( DWORD dwData,DWORD dwAccess,DWORD dwShareMode );

BOOL
SCR_Close( DWORD Handle );

BOOL
SCR_IOControl( 
    DWORD Handle,
    DWORD dwIoControlCode,
    PBYTE pInBuf,
    DWORD nInBufSize,
    PBYTE pOutBuf,
    DWORD nOutBufSize,
    PDWORD pBytesReturned
    );

DWORD 
SCR_Read(DWORD Handle, LPVOID pBuffer, DWORD dwNumBytes);

DWORD 
SCR_Write(DWORD Handle, LPCVOID pBuffer, DWORD dwNumBytes);

DWORD 
SCR_Seek(DWORD Handle, long lDistance, DWORD dwMoveMethod);


BOOL 
GetSerialPort(LPTSTR pSerialPort,LPTSTR ActiveKey);

DWORD
GetDeviceName( LPTSTR ActivePath, LPTSTR szDeviceName );

void
MakeFriendlyName(PSMARTCARD_EXTENSION SmartcardExtension, LPWSTR szFriendlyName);

PSMARTCARD_EXTENSION
TLP3LoadDevice( LPTSTR ActiveKey );


void
TLP3UnloadDevice(PSMARTCARD_EXTENSION SmartcardExtension);

BOOL 
TLP3CreateSerialPort(PSMARTCARD_EXTENSION smartcardExtension);

VOID 
TLP3CloseSerialPort(PSMARTCARD_EXTENSION smartcardExtension );

NTSTATUS
TLP3SerialIo( PSMARTCARD_EXTENSION SmartcardExtension  );

NTSTATUS
TLP3ConfigureSerialPort(  PSMARTCARD_EXTENSION SmartcardExtension  );

static DWORD CALLBACK 
TLP3SerialEvent(PVOID pData );


#define EnterDevice(pSCE) InterlockedIncrement(&(pSCE)->ReaderExtension->d_RefCount)
#define LeaveDevice(pSCE) InterlockedDecrement(&(pSCE)->ReaderExtension->d_RefCount)


#endif	// __TLP3CE_H__


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -