Yubico Forum

...visit our web-store at store.yubico.com
It is currently Tue Jan 30, 2018 8:09 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Apr 04, 2011 2:12 am 
Offline

Joined: Tue Oct 19, 2010 9:37 am
Posts: 5
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


Top
 Profile  
Reply with quote  

Share On:

Share on Facebook FacebookShare on Twitter TwitterShare on Tumblr TumblrShare on Google+ Google+

PostPosted: Tue Apr 05, 2011 9:38 pm 
Offline
Site Admin
Site Admin

Joined: Wed May 28, 2008 7:04 pm
Posts: 263
Location: Yubico base camp in Sweden - Now in Palo Alto
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 19, 2011 6:28 am 
Offline

Joined: Tue Oct 19, 2010 9:37 am
Posts: 5
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group