Skip to content

Commit

Permalink
Merge branch 'master' into Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
radi-sh committed Mar 1, 2017
2 parents 320b27b + 254973b commit 5485fad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
7 changes: 6 additions & 1 deletion BdaSpecials/IT35/TVTestRemocon/CCOMProc-x3U4Remocon.cpp
Expand Up @@ -39,7 +39,12 @@ CCOMProc::CCOMProc(void)

CCOMProc::~CCOMProc(void)
{
TerminateThread();
if (hThread) {
::SetEvent(hTerminateRequest);
::WaitForSingleObject(hThread, 1000);
::CloseHandle(hThread);
hThread = NULL;
}
if (hThreadInitComp) {
::CloseHandle(hThreadInitComp);
hThreadInitComp = NULL;
Expand Down
7 changes: 6 additions & 1 deletion BdaSpecials/IT35/WinSCard-x3U4/CCOMProc-x3U4.cpp
Expand Up @@ -42,7 +42,12 @@ CCOMProc::CCOMProc(void)

CCOMProc::~CCOMProc(void)
{
TerminateThread();
if (hThread) {
::SetEvent(hTerminateRequest);
::WaitForSingleObject(hThread, 1000);
::CloseHandle(hThread);
hThread = NULL;
}
if (hThreadInitComp) {
::CloseHandle(hThreadInitComp);
hThreadInitComp = NULL;
Expand Down
15 changes: 13 additions & 2 deletions BdaSpecials/IT35/WinSCard-x3U4/WinSCard-x3U4.cpp
Expand Up @@ -21,7 +21,7 @@ static const WCHAR LIST_READERS_W[] = L"Plex PX-x3U4 Card Reader 0\0";
static BYTE IFSD = 254; // IFD側の最大受信可能ブロックサイズ

static BOOL l_bInitialized = FALSE;

static DWORD l_dwEstablishedContext = 0;
static HANDLE l_hStartedEvent = NULL;
static HMODULE l_hModule = NULL;
static HANDLE l_hSemaphore = NULL;
Expand Down Expand Up @@ -327,7 +327,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
break;

case DLL_PROCESS_DETACH:
COMProc.TerminateThread();
CloseAllHandle();
if (l_hStartedEvent) {
try {
Expand Down Expand Up @@ -408,6 +407,9 @@ LONG WINAPI SCardDisconnect_(SCARDHANDLE hCard, DWORD dwDisposition)

LONG WINAPI SCardEstablishContext_(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
{
l_dwEstablishedContext++;
OutputDebug(L"SCardEstablishContext: Count=%d.\n", l_dwEstablishedContext);

*phContext = DUMMY_SCARDCONTEXT;

return SCARD_S_SUCCESS;
Expand Down Expand Up @@ -469,6 +471,15 @@ LONG WINAPI SCardListReadersW_(SCARDCONTEXT hContext, LPCWSTR mszGroups, LPWSTR

LONG WINAPI SCardReleaseContext_(SCARDCONTEXT hContext)
{
if (l_dwEstablishedContext)
l_dwEstablishedContext--;
OutputDebug(L"SCardReleaseContext: Count=%d.\n", l_dwEstablishedContext);

if (!l_dwEstablishedContext) {
COMProc.TerminateThread();
CloseAllHandle();
}

return SCARD_S_SUCCESS;
}

Expand Down
3 changes: 3 additions & 0 deletions doc/History-IT35.txt
Expand Up @@ -16,3 +16,6 @@
【2017-02-27】
・TVTestプラグインが32bit版のTVTestに認識されなかった問題を修正

【2017-03-01】
・TVTestを終了してもプロセスが残ったままになる問題を修正

0 comments on commit 5485fad

Please sign in to comment.