FreeRDP
smartcard_main.c File Reference
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/smartcard.h>
#include <winpr/environment.h>
#include <freerdp/freerdp.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/channels/scard.h>
#include <freerdp/utils/smartcard_call.h>
#include <freerdp/utils/smartcard_operations.h>
#include <freerdp/utils/rdpdr_utils.h>
#include "smartcard_main.h"

Macros

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

Functions

static void smartcard_context_free (void *pCtx)
 
static UINT smartcard_complete_irp (SMARTCARD_DEVICE *smartcard, IRP *irp, BOOL *handled)
 
static SMARTCARD_DEVICEcast_device_from (DEVICE *device, const char *fkt, const char *file, size_t line)
 
static DWORD WINAPI smartcard_context_thread (LPVOID arg)
 
static void smartcard_operation_queue_free (void *obj)
 
static void * smartcard_context_new (void *smartcard, SCARDCONTEXT hContext)
 
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_process_irp (SMARTCARD_DEVICE *smartcard, IRP *irp, BOOL *handled)
 
static DWORD WINAPI smartcard_thread_func (LPVOID arg)
 
static UINT smartcard_irp_request (DEVICE *device, IRP *irp)
 
static void smartcard_free_irp (void *obj)
 
UINT DeviceServiceEntry (PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
 

Variables

static SMARTCARD_DEVICEsSmartcard = NULL
 

Macro Definition Documentation

◆ CAST_FROM_DEVICE

#define CAST_FROM_DEVICE (   device)    cast_device_from(device, __func__, __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.

◆ DeviceServiceEntry

#define DeviceServiceEntry   smartcard_DeviceServiceEntry

Function Documentation

◆ cast_device_from()

static SMARTCARD_DEVICE* cast_device_from ( DEVICE *  device,
const char *  fkt,
const char *  file,
size_t  line 
)
static

◆ DeviceServiceEntry()

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:

◆ smartcard_complete_irp()

UINT smartcard_complete_irp ( SMARTCARD_DEVICE smartcard,
IRP *  irp,
BOOL *  handled 
)
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:

◆ smartcard_context_free()

void smartcard_context_free ( void *  pCtx)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smartcard_context_new()

static void* smartcard_context_new ( void *  smartcard,
SCARDCONTEXT  hContext 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smartcard_context_thread()

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:

◆ smartcard_free()

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:

◆ smartcard_free_()

static UINT smartcard_free_ ( SMARTCARD_DEVICE smartcard)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smartcard_free_irp()

static void smartcard_free_irp ( void *  obj)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smartcard_init()

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:

◆ smartcard_irp_request()

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:

◆ smartcard_operation_queue_free()

static void smartcard_operation_queue_free ( void *  obj)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smartcard_process_irp()

static UINT smartcard_process_irp ( SMARTCARD_DEVICE smartcard,
IRP *  irp,
BOOL *  handled 
)
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:

◆ smartcard_release_all_contexts()

static void smartcard_release_all_contexts ( SMARTCARD_DEVICE smartcard)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smartcard_thread_func()

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

◆ sSmartcard

SMARTCARD_DEVICE* sSmartcard = NULL
static