FreeRDP
smartcard_main.c File Reference
#include <winpr/crt.h>
#include <winpr/smartcard.h>
#include <winpr/environment.h>
#include <freerdp/channels/rdpdr.h>
#include "smartcard_main.h"

Macros

#define CAST_FROM_DEVICE(device)   cast_device_from(device, __FUNCTION__, __FILE__, __LINE__)
 
#define DeviceServiceEntry   smartcard_DeviceServiceEntry
 

Functions

static SMARTCARD_DEVICE * cast_device_from (DEVICE *device, const char *fkt, const char *file, int line)
 
static DWORD WINAPI smartcard_context_thread (LPVOID arg)
 
SMARTCARD_CONTEXT * smartcard_context_new (SMARTCARD_DEVICE *smartcard, SCARDCONTEXT hContext)
 
void smartcard_context_free (void *pCtx)
 
static void smartcard_release_all_contexts (SMARTCARD_DEVICE *smartcard)
 
static UINT smartcard_free_ (SMARTCARD_DEVICE *smartcard)
 
static UINT smartcard_free (DEVICE *device)
 
static UINT smartcard_init (DEVICE *device)
 
static UINT smartcard_complete_irp (SMARTCARD_DEVICE *smartcard, IRP *irp)
 
static UINT smartcard_process_irp (SMARTCARD_DEVICE *smartcard, IRP *irp)
 
static DWORD WINAPI smartcard_thread_func (LPVOID arg)
 
static UINT smartcard_irp_request (DEVICE *device, IRP *irp)
 
UINT DeviceServiceEntry (PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
 

Variables

static SMARTCARD_DEVICE * sSmartcard = NULL
 

Macro Definition Documentation

#define CAST_FROM_DEVICE (   device)    cast_device_from(device, __FUNCTION__, __FILE__, __LINE__)

FreeRDP: A Remote Desktop Protocol Implementation Smartcard Device Service Virtual Channel

Copyright 2011 O.S. Systems Software Ltda. Copyright 2011 Eduardo Fiss Beloni belon.nosp@m.i@os.nosp@m.syste.nosp@m.ms.c.nosp@m.om.br Copyright 2011 Anthony Tong atong.nosp@m.@tru.nosp@m.stedc.nosp@m.s.co.nosp@m.m Copyright 2015 Thincast Technologies GmbH Copyright 2015 DI (FH) Martin Haimberger marti.nosp@m.n.ha.nosp@m.imber.nosp@m.ger@.nosp@m.thinc.nosp@m.ast..nosp@m.com Copyright 2016 David PHAM-VAN d.pha.nosp@m.mvan.nosp@m.@inuv.nosp@m.ika..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

#define DeviceServiceEntry   smartcard_DeviceServiceEntry

Function Documentation

static SMARTCARD_DEVICE* cast_device_from ( DEVICE *  device,
const char *  fkt,
const char *  file,
int  line 
)
static
UINT DeviceServiceEntry ( PDEVICE_SERVICE_ENTRY_POINTS  pEntryPoints)

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

static UINT smartcard_complete_irp ( SMARTCARD_DEVICE *  smartcard,
IRP *  irp 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

void smartcard_context_free ( void pCtx)

Here is the call graph for this function:

Here is the caller graph for this function:

SMARTCARD_CONTEXT* smartcard_context_new ( SMARTCARD_DEVICE *  smartcard,
SCARDCONTEXT  hContext 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD WINAPI smartcard_context_thread ( LPVOID  arg)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT smartcard_free ( DEVICE *  device)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Calling smartcard_release_all_contexts to unblock all operations waiting for transactions to unlock.

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT smartcard_free_ ( SMARTCARD_DEVICE *  smartcard)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT smartcard_init ( DEVICE *  device)
static

Initialization occurs when the protocol server sends a device announce message. At that time, we need to cancel all outstanding IRPs. Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT smartcard_irp_request ( DEVICE *  device,
IRP *  irp 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT smartcard_process_irp ( SMARTCARD_DEVICE *  smartcard,
IRP *  irp 
)
static

Multiple threads and SCardGetStatusChange: http://musclecard.996296.n3.nabble.com/Multiple-threads-and-SCardGetStatusChange-td4430.html Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static void smartcard_release_all_contexts ( SMARTCARD_DEVICE *  smartcard)
static

On protocol termination, the following actions are performed: For each context in rgSCardContextList, SCardCancel is called causing all SCardGetStatusChange calls to be processed. After that, SCardReleaseContext is called on each context and the context MUST be removed from rgSCardContextList.

Call SCardCancel on existing contexts, unblocking all outstanding SCardGetStatusChange calls.

Call SCardReleaseContext on remaining contexts and remove them from rgSCardContextList.

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD WINAPI smartcard_thread_func ( LPVOID  arg)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

SMARTCARD_DEVICE* sSmartcard = NULL
static