Yubico Forum
https://forum.yubico.com/

YubiClientAPI.dll hang up
https://forum.yubico.com/viewtopic.php?f=16&t=655
Page 1 of 1

Author:  koga [ Mon Apr 04, 2011 2:12 am ]
Post subject:  YubiClientAPI.dll hang up

We use YubiClientAPI.dll to get serial number.

IUnkown::Release() method is hang up when yubikey is not inserted.

following is our code snippet:
Code:
IYubiClient yubiClient;
ycRETCODE nRet;
HRESULT hr = CoCreateInstance(
            CLSID_YubiClient, 0,
            CLSCTX_ALL,
            IID_IYubiClient,
            reinterpret_cast<void **>(&yubiClient;)
);

if ( m_pcomYubiClient->GetisInserted() == ycRETCODE_OK ) {
    nRet = m_yubiClient->GetreadSerial(ycCALL_BLOCKING);
    if (nRet == ycRETCODE_OK ) {
        ....
    }
}

yubiClient->Release();   // <-- Hanging up

return nRet;



Is that misuse of objet? How can I release object?
Thanks,

koga

Author:  Jakob [ Tue Apr 05, 2011 9:38 pm ]
Post subject:  Re: YubiClientAPI.dll hang up

It seems like you've found is a potential race issue here. When the instance is created, the worker thread monitoring the key status may not have started yet, thereby causing the main thread to hang.

Can you please try to add a short delay between the CoCreateInstance and the actual call and see if that cures your problem ?

Does the supplied MFC test container works as expected ?

Thanks for your help,

JakobE
Hardware- and firmware guy @ Yubico

Author:  koga [ Tue Apr 19, 2011 6:28 am ]
Post subject:  Re: YubiClientAPI.dll hang up

Thanks for reply.

If we call GetreadSerial without IsInserted, same problem has happen.
And I don't know how long time I should add a delay.

So I decide to use IsInserted of YubiKCom.dll until new library is released.
That solution is working well, for now.

Regards,

koga

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/