FreeRDP
test-scard.cpp File Reference
#include <iostream>
#include <string>
#include <sstream>
#include <locale>
#include <codecvt>
#include <comdef.h>
#include <winscard.h>

Functions

static std::string scope2str (DWORD scope)
 
static std::string err2str (LONG code)
 
static std::wstring err2wstr (LONG code)
 
static bool test_valid (SCARDCONTEXT context)
 
static bool test_list_readers_a (SCARDCONTEXT context)
 
static bool test_list_readers_w (SCARDCONTEXT context)
 
static bool test_list_reader_groups_a (SCARDCONTEXT context)
 
static bool test_list_reader_groups_w (SCARDCONTEXT context)
 
static bool test_introduce_forget_reader_groups_a (SCARDCONTEXT context)
 
static bool test_introduce_forget_reader_groups_w (SCARDCONTEXT context)
 
static bool test_introduce_forget_reader_a (SCARDCONTEXT context)
 
static bool test_introduce_forget_reader_w (SCARDCONTEXT context)
 
static bool test_list_cards_a (SCARDCONTEXT context)
 
static bool test_list_cards_w (SCARDCONTEXT context)
 
static bool test_cache_a (SCARDCONTEXT context)
 
static bool test_cache_w (SCARDCONTEXT context)
 
static bool test_reader_icon_a (SCARDCONTEXT context)
 
static bool test_reader_icon_w (SCARDCONTEXT context)
 
static bool test_locate_cards_a (SCARDCONTEXT context)
 
static bool test_locate_cards_w (SCARDCONTEXT context)
 
static bool test_locate_cards_by_atr_a (SCARDCONTEXT context)
 
static bool test_locate_cards_by_atr_w (SCARDCONTEXT context)
 
static bool test_devicetype_id_a (SCARDCONTEXT context)
 
static bool test_devicetype_id_w (SCARDCONTEXT context)
 
static bool test_transmitcount (SCARDHANDLE handle)
 
static bool test_status_a (SCARDHANDLE handle)
 
static bool test_status_w (SCARDHANDLE handle)
 
static bool test_get_attrib (SCARDCONTEXT context, SCARDHANDLE handle)
 
static bool test_set_attrib (SCARDCONTEXT context, SCARDHANDLE handle)
 
int main ()
 

Variables

static const WCHAR * listW []
 
static const char * listA []
 

Function Documentation

◆ err2str()

static std::string err2str ( LONG  code)
static
Here is the caller graph for this function:

◆ err2wstr()

static std::wstring err2wstr ( LONG  code)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( )
Here is the call graph for this function:

◆ scope2str()

static std::string scope2str ( DWORD  scope)
static
Here is the caller graph for this function:

◆ test_cache_a()

static bool test_cache_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_cache_w()

static bool test_cache_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_devicetype_id_a()

static bool test_devicetype_id_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_devicetype_id_w()

static bool test_devicetype_id_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_get_attrib()

static bool test_get_attrib ( SCARDCONTEXT  context,
SCARDHANDLE  handle 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_introduce_forget_reader_a()

static bool test_introduce_forget_reader_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_introduce_forget_reader_groups_a()

static bool test_introduce_forget_reader_groups_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_introduce_forget_reader_groups_w()

static bool test_introduce_forget_reader_groups_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_introduce_forget_reader_w()

static bool test_introduce_forget_reader_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_list_cards_a()

static bool test_list_cards_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_list_cards_w()

static bool test_list_cards_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_list_reader_groups_a()

static bool test_list_reader_groups_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_list_reader_groups_w()

static bool test_list_reader_groups_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_list_readers_a()

static bool test_list_readers_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_list_readers_w()

static bool test_list_readers_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_locate_cards_a()

static bool test_locate_cards_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_locate_cards_by_atr_a()

static bool test_locate_cards_by_atr_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_locate_cards_by_atr_w()

static bool test_locate_cards_by_atr_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_locate_cards_w()

static bool test_locate_cards_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_reader_icon_a()

static bool test_reader_icon_a ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_reader_icon_w()

static bool test_reader_icon_w ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_set_attrib()

static bool test_set_attrib ( SCARDCONTEXT  context,
SCARDHANDLE  handle 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_status_a()

static bool test_status_a ( SCARDHANDLE  handle)
static
Here is the caller graph for this function:

◆ test_status_w()

static bool test_status_w ( SCARDHANDLE  handle)
static
Here is the caller graph for this function:

◆ test_transmitcount()

static bool test_transmitcount ( SCARDHANDLE  handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_valid()

static bool test_valid ( SCARDCONTEXT  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ listA

const char* listA[]
static
Initial value:
= { nullptr, "SCard$AllReaders\000", "SCard$DefaultReaders\000",
"SCard$LocalReaders\000", "SCard$SystemReaders\000" }

◆ listW

const WCHAR* listW[]
static
Initial value:
= { nullptr, L"SCard$AllReaders\000", L"SCard$DefaultReaders\000",
L"SCard$LocalReaders\000", L"SCard$SystemReaders\000" }

FreeRDP: A Remote Desktop Protocol Implementation Smartcard API test program

This simple program can be used to trigger calls for (almost) the entire SCARD API. Compile on windows, connect with FreeRDP via RDP with smartcard redirection enabled and run this test program on the windows machine.

Copyright 2020 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2020 Thincast Technologies GmbH

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.