Skip to content

Commit

Permalink
Merge pull request #17 from Arcidev/travis
Browse files Browse the repository at this point in the history
Fixed travis config and fixed linux build. Closes #6
  • Loading branch information
petrs committed Sep 23, 2018
2 parents aa28e02 + 9c3accf commit e114fb0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
27 changes: 13 additions & 14 deletions .travis.yml
Expand Up @@ -2,25 +2,24 @@ language: cpp

os:
- linux

dist:
- xenial

compiler:
- gcc

before_install:
- git clone git://anonscm.debian.org/pcsclite/PCSC.git
- cd PCSC
install:
- ./bootstrap
- ./configure
- make
- sudo apt install cmake
script:
- cmake CMakeLists.txt cmake-build-debug/
- cd cmake-build-debug/
- sudo apt-get update
- sudo apt-get install libpcsclite-dev
script:
- mkdir cmake-build-debug
- cd cmake-build-debug
- cmake ..
- make
- cd ..
- cd WinscardTests/
- cmake CMakeLists.txt cmake-build-debug/
- cd cmake-build-debug/
- cd ../WinscardTests/
- mkdir cmake-build-debug
- cd cmake-build-debug
- cmake ..
- make
- ./WinscardTests
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -3,7 +3,7 @@ project(APDUPlay)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include_directories(/usr/local/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(/usr/local/include/PCSC/ /usr/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})

set(SOURCE_FILES Shared/status.cpp Shared/status.H Shared/globals.h Winscard/CommonFnc.cpp Winscard/CommonFnc.h
Winscard/Resource.h Winscard/stdafx.cpp Winscard/stdafx.h
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -4,7 +4,7 @@ PC/SC APDU inspection and manipulation tool (APDUPlay)
[![Latest release](https://img.shields.io/github/release/crocs-muni/apduplay.svg)](https://github.com/crocs-muni/apduplay/releases/latest)

Windows DLL: [![Build status](https://ci.appveyor.com/api/projects/status/ktwde29drhtw7jml?svg=true)](https://ci.appveyor.com/project/petrs/apduplay)
Linux SO: [![Build Status](https://travis-ci.org/crocs-muni/apduplay.svg?branch=master)](https://travis-ci.org/crocs-muni/apduplay)
Linux SO: [![Build Status](https://travis-ci.org/crocs-muni/APDUPlay.svg?branch=master)](https://travis-ci.org/crocs-muni/APDUPlay)

The APDUPlay project allows you to log, modify, redirect and visualize smartcard communication realized via PC/SC interface (winscard.dll library). The functionality is achieved by custom "stub" library (provided by APDUPlay) which intercepts and redirects the communication to original winscard.dll (provided by Microsoft) or remote socket proxy. The project supports applications running on Windows Vista, 7, 8, 10 and Linux both 32- and 64-bit.

Expand Down
2 changes: 2 additions & 0 deletions Shared/globals.h
Expand Up @@ -78,6 +78,8 @@ static errno_t(*type_path_split)(const char_type*, char_type*, size_t, char_type
typedef wchar_t WCHAR;
typedef wchar_t* LPWSTR;
typedef const wchar_t* LPCWSTR;
typedef unsigned char boolean;
#define GetLastError() errno
#ifndef TRUE
#define TRUE 1
#endif
Expand Down
10 changes: 7 additions & 3 deletions Winscard/Winscard.cpp
Expand Up @@ -780,6 +780,7 @@ SCard LONG STDCALL SCardConnect(
}

// Detect remote cards (now only via reader prefix) and assign virtual card handle
#if defined(_WIN32)
string_type readerName = szReader;
if (readerName.find(theApp.m_remoteConfig.remoteReaderPrefix) != -1) {
theApp.m_nextRemoteCardID++;
Expand All @@ -788,12 +789,15 @@ SCard LONG STDCALL SCardConnect(
status = theApp.Remote_SCardConnect(&(theApp.m_remoteConfig), szReader);
}
else {
#endif
// Standard physical reader
status = (*Original_SCardConnect)(hContext, szReader, dwShareMode, dwPreferredProtocols, phCard, pdwActiveProtocol);
string_type message;
message = string_format(_CONV("SCardConnect(hContext:0x%x,%s,hCard:0x%x) called\n"), hContext, szReader, *phCard);
LogWinscardRules(message);
#if defined(_WIN32)
}
#endif

// Store mapping between card handle and reader (used in card remoting)
theApp.cardReaderMap[*phCard] = szReader;
Expand Down Expand Up @@ -2862,7 +2866,7 @@ int initialize()
load_func(hOriginal, "SCardConnect");
if (!Original_SCardConnect) {
error = dlerror();
LogDebugString(_CONV("Could not find SCardConnect procedure address: %s\n", error);
fprintf(stderr, "Could not find SCardConnect procedure address: %s\n", error);
return FALSE;
}

Expand All @@ -2871,7 +2875,7 @@ int initialize()
load_func(hOriginal, "SCardStatus");
if ((!Original_SCardStatus)) {
error = dlerror();
LogDebugString(_CONV("Could not find SCardStatus procedure address: %s\n", error);
fprintf(stderr, "Could not find SCardStatus procedure address: %s\n", error);
return FALSE;
}

Expand Down Expand Up @@ -2952,7 +2956,7 @@ void GetDesktopPath(char_type* path)
string_type stringPath = "/home/";
stringPath += login;
stringPath += "/Desktop/APDUPlay/";
type_copy(rulesFilePath, stringPath.c_str());
type_copy(path, stringPath.c_str());
#else
char_type appData[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, appData);
Expand Down
2 changes: 1 addition & 1 deletion WinscardTests/CMakeLists.txt
Expand Up @@ -4,7 +4,7 @@ project(WinscardTests)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wl,--no-as-needed -ldl")

include_directories(/usr/local/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(/usr/local/include/PCSC/ /usr/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})


set(SOURCE_FILES
Expand Down
2 changes: 1 addition & 1 deletion WinscardTests/main.cpp
Expand Up @@ -125,7 +125,7 @@ std::string BytesToHex(BYTE* data, size_t dataLen) {
std::stringstream ss;
char oneByte[3];
for (size_t i = 0; i < dataLen; ++i) {
sprintf_s(oneByte, sizeof(oneByte), "%.2x", data[i]);
snprintf(oneByte, sizeof(oneByte), "%.2x", data[i]);
ss << oneByte;
}
return ss.str();
Expand Down

0 comments on commit e114fb0

Please sign in to comment.