Skip to content

Commit e114fb0

Browse files
authored
Merge pull request #17 from Arcidev/travis
Fixed travis config and fixed linux build. Closes #6
2 parents aa28e02 + 9c3accf commit e114fb0

File tree

7 files changed

+26
-21
lines changed

7 files changed

+26
-21
lines changed

.travis.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@ language: cpp
22

33
os:
44
- linux
5+
6+
dist:
7+
- xenial
58

69
compiler:
710
- gcc
811

912
before_install:
10-
- git clone git://anonscm.debian.org/pcsclite/PCSC.git
11-
- cd PCSC
12-
install:
13-
- ./bootstrap
14-
- ./configure
15-
- make
16-
- sudo apt install cmake
17-
script:
18-
- cmake CMakeLists.txt cmake-build-debug/
19-
- cd cmake-build-debug/
13+
- sudo apt-get update
14+
- sudo apt-get install libpcsclite-dev
15+
script:
16+
- mkdir cmake-build-debug
17+
- cd cmake-build-debug
18+
- cmake ..
2019
- make
21-
- cd ..
22-
- cd WinscardTests/
23-
- cmake CMakeLists.txt cmake-build-debug/
24-
- cd cmake-build-debug/
20+
- cd ../WinscardTests/
21+
- mkdir cmake-build-debug
22+
- cd cmake-build-debug
23+
- cmake ..
2524
- make
2625
- ./WinscardTests

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project(APDUPlay)
33

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

6-
include_directories(/usr/local/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})
6+
include_directories(/usr/local/include/PCSC/ /usr/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})
77

88
set(SOURCE_FILES Shared/status.cpp Shared/status.H Shared/globals.h Winscard/CommonFnc.cpp Winscard/CommonFnc.h
99
Winscard/Resource.h Winscard/stdafx.cpp Winscard/stdafx.h

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PC/SC APDU inspection and manipulation tool (APDUPlay)
44
[![Latest release](https://img.shields.io/github/release/crocs-muni/apduplay.svg)](https://github.com/crocs-muni/apduplay/releases/latest)
55

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

99
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.
1010

Shared/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ static errno_t(*type_path_split)(const char_type*, char_type*, size_t, char_type
7878
typedef wchar_t WCHAR;
7979
typedef wchar_t* LPWSTR;
8080
typedef const wchar_t* LPCWSTR;
81+
typedef unsigned char boolean;
82+
#define GetLastError() errno
8183
#ifndef TRUE
8284
#define TRUE 1
8385
#endif

Winscard/Winscard.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ SCard LONG STDCALL SCardConnect(
780780
}
781781

782782
// Detect remote cards (now only via reader prefix) and assign virtual card handle
783+
#if defined(_WIN32)
783784
string_type readerName = szReader;
784785
if (readerName.find(theApp.m_remoteConfig.remoteReaderPrefix) != -1) {
785786
theApp.m_nextRemoteCardID++;
@@ -788,12 +789,15 @@ SCard LONG STDCALL SCardConnect(
788789
status = theApp.Remote_SCardConnect(&(theApp.m_remoteConfig), szReader);
789790
}
790791
else {
792+
#endif
791793
// Standard physical reader
792794
status = (*Original_SCardConnect)(hContext, szReader, dwShareMode, dwPreferredProtocols, phCard, pdwActiveProtocol);
793795
string_type message;
794796
message = string_format(_CONV("SCardConnect(hContext:0x%x,%s,hCard:0x%x) called\n"), hContext, szReader, *phCard);
795797
LogWinscardRules(message);
798+
#if defined(_WIN32)
796799
}
800+
#endif
797801

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

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

@@ -2952,7 +2956,7 @@ void GetDesktopPath(char_type* path)
29522956
string_type stringPath = "/home/";
29532957
stringPath += login;
29542958
stringPath += "/Desktop/APDUPlay/";
2955-
type_copy(rulesFilePath, stringPath.c_str());
2959+
type_copy(path, stringPath.c_str());
29562960
#else
29572961
char_type appData[MAX_PATH];
29582962
SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, appData);

WinscardTests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(WinscardTests)
44
set(CMAKE_CXX_STANDARD 11)
55
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wl,--no-as-needed -ldl")
66

7-
include_directories(/usr/local/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})
7+
include_directories(/usr/local/include/PCSC/ /usr/include/PCSC/ ${CMAKE_CURRENT_SOURCE_DIR})
88

99

1010
set(SOURCE_FILES

WinscardTests/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ std::string BytesToHex(BYTE* data, size_t dataLen) {
125125
std::stringstream ss;
126126
char oneByte[3];
127127
for (size_t i = 0; i < dataLen; ++i) {
128-
sprintf_s(oneByte, sizeof(oneByte), "%.2x", data[i]);
128+
snprintf(oneByte, sizeof(oneByte), "%.2x", data[i]);
129129
ss << oneByte;
130130
}
131131
return ss.str();

0 commit comments

Comments
 (0)