diff --git a/virtualsmartcard/win32/BixVReader/PipeReader.cpp b/virtualsmartcard/win32/BixVReader/PipeReader.cpp index c7569ef..6060709 100644 --- a/virtualsmartcard/win32/BixVReader/PipeReader.cpp +++ b/virtualsmartcard/win32/BixVReader/PipeReader.cpp @@ -49,8 +49,6 @@ void PipeReader::init(wchar_t *section) { } bool PipeReader::CheckATR() { - //SectionLocker lock(dataSection); - if (pipe==NULL) return false; DWORD read=0; @@ -72,8 +70,6 @@ bool PipeReader::CheckATR() { return true; } bool PipeReader::QueryTransmit(BYTE *APDU,int APDUlen,BYTE **Resp,int *Resplen) { - //SectionLocker lock(dataSection); - if (pipe==NULL) return false; DWORD command=2; @@ -112,8 +108,6 @@ bool PipeReader::QueryTransmit(BYTE *APDU,int APDUlen,BYTE **Resp,int *Resplen) } bool PipeReader::QueryATR(BYTE *ATR,DWORD *ATRsize,bool reset) { - //SectionLocker lock(dataSection); - if (pipe==NULL) return false; DWORD command=reset ? 0 : 1; @@ -150,7 +144,7 @@ DWORD PipeReader::startServer() { swprintf(temp,L"\\\\.\\pipe\\%s",pipeEventName); HANDLE _eventpipe=CreateNamedPipe(temp,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,PIPE_UNLIMITED_INSTANCES,0,0,0,&sa); wchar_t log[300]; - swprintf(log,L"[BixVReader]Pipe created:%s:%08Ix",pipeName,_pipe); + swprintf(log,L"[BixVReader]Pipe created:%s:%p",pipeName,_pipe); OutputDebugString(log); while (true) { @@ -220,7 +214,6 @@ DWORD PipeReader::startServer() { while (!waitInsertIpr.empty()) { CComPtr ipr = waitInsertIpr.back(); OutputDebugString(L"[BixVReader]cancel Wait Remove"); - SectionLocker lock(device->m_RequestLock); if (ipr->UnmarkCancelable()==S_OK) { OutputDebugString(L"[BixVReader]Wait Insert Unmarked"); ipr->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_CANCELLED), 0); diff --git a/virtualsmartcard/win32/BixVReader/TcpIpReader.cpp b/virtualsmartcard/win32/BixVReader/TcpIpReader.cpp index b252830..a611926 100644 --- a/virtualsmartcard/win32/BixVReader/TcpIpReader.cpp +++ b/virtualsmartcard/win32/BixVReader/TcpIpReader.cpp @@ -25,7 +25,6 @@ void TcpIpReader::init(wchar_t *section) { } bool TcpIpReader::CheckATR() { - //SectionLocker lock(dataSection); if (AcceptSocket==NULL) return false; int read=0; @@ -46,7 +45,6 @@ bool TcpIpReader::CheckATR() { return true; } bool TcpIpReader::QueryTransmit(BYTE *APDU,int APDUlen,BYTE **Resp,int *Resplen) { - //SectionLocker lock(dataSection); if (AcceptSocket==NULL) return false; DWORD command=2; @@ -90,7 +88,6 @@ bool TcpIpReader::QueryTransmit(BYTE *APDU,int APDUlen,BYTE **Resp,int *Resplen) } bool TcpIpReader::QueryATR(BYTE *ATR,DWORD *ATRsize,bool reset) { - //SectionLocker lock(dataSection); if (AcceptSocket==NULL) return false; int read=0; @@ -141,7 +138,6 @@ DWORD TcpIpReader::startServer() { if (ret > 0) break; if (ret<0) { - wchar_t log[100]; DWORD err=WSAGetLastError(); swprintf(log,L"[BixVReader]wsa err:%x",err); OutputDebugString(log); @@ -257,7 +253,6 @@ DWORD TcpIpReader::startServer() { while (!waitInsertIpr.empty()) { CComPtr ipr = waitInsertIpr.back(); OutputDebugString(L"[BixVReader]cancel Wait Remove"); - SectionLocker lock(device->m_RequestLock); if (ipr->UnmarkCancelable()==S_OK) { OutputDebugString(L"[BixVReader]Wait Insert Unmarked"); ipr->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_CANCELLED), 0); @@ -311,7 +306,6 @@ void TcpIpReader::shutdown() { state=SCARD_ABSENT; breakSocket=true; { - //SectionLocker lock(dataSection); closesocket(eventsocket); closesocket(socket); } diff --git a/virtualsmartcard/win32/BixVReader/VpcdReader.cpp b/virtualsmartcard/win32/BixVReader/VpcdReader.cpp index 827de44..8dbe921 100644 --- a/virtualsmartcard/win32/BixVReader/VpcdReader.cpp +++ b/virtualsmartcard/win32/BixVReader/VpcdReader.cpp @@ -138,7 +138,6 @@ void VpcdReader::signalRemoval(void) { SectionLocker lock(device->m_RequestLock); while (!waitInsertIpr.empty()) { CComPtr ipr = waitInsertIpr.back(); - SectionLocker lock(device->m_RequestLock); if (ipr->UnmarkCancelable()==S_OK) { ipr->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_CANCELLED), 0); } diff --git a/virtualsmartcard/win32/BixVReader/sectionLocker.cpp b/virtualsmartcard/win32/BixVReader/sectionLocker.cpp index a2ed5fd..2792ed7 100644 --- a/virtualsmartcard/win32/BixVReader/sectionLocker.cpp +++ b/virtualsmartcard/win32/BixVReader/sectionLocker.cpp @@ -8,9 +8,8 @@ SectionLocker::SectionLocker(CRITICAL_SECTION &critsection,char *function,int li Object=object; DWORD start=GetTickCount(); if (TryEnterCriticalSection(section)==0) { - OutputDebugStringA("[BixVReader]RACE!"); char logBuffer[500]; - sprintf(logBuffer,"[BixVReader]Richiesto da:Function:%s,Line:%i,Object:%Ix,Lock:%Ix",Function,Line,Object,section); + sprintf(logBuffer,"[BixVReader]Locking:Function:%s,Line:%i,Object:%p,Lock:%p",Function,Line,Object,section); OutputDebugStringA(logBuffer); ShowMe=section; EnterCriticalSection(section); @@ -23,7 +22,7 @@ SectionLocker::SectionLocker(CRITICAL_SECTION &critsection,char *function,int li SectionLocker::~SectionLocker() { if (section==ShowMe) { char logBuffer[500]; - sprintf(logBuffer,"[BixVReader]Posseduto da:Function:%s,Line:%i,Object:%Ix,Lock:%Ix",Function,Line,Object,section); + sprintf(logBuffer,"[BixVReader]Unlocking:Function:%s,Line:%i,Object:%p,Lock:%p",Function,Line,Object,section); OutputDebugStringA(logBuffer); ShowMe=NULL; }