WlxGetOption Documentation

This addin was contributed by Jiøí Kutálek.

Environment: Visual C++

GINA's WlxGetOption function is not well documented on MSDN. I need to write GINA using smartcards, so I wanted to get information about the smartcards inserted during logon. Simply said, I want to use WlxGetOption to get some information. But what parameters have the function? When you look into the MSDN, you'll see something like:

BOOL WlxGetOption( HANDLE hWlx, DWORD Option, ULONG_PTR* Value);

where hWlx is the Winlogon handle. Option is one of these:

  • WLX_OPTION_USE_CTRL_ALT_DEL
  • WLX_OPTION_CONTEXT_POINTER
  • WLX_OPTION_USE_SMART_CARD
  • WLX_OPTION_SMART_CARD_PRESENT
  • WLX_OPTION_SMART_CARD_INFO
  • WLX_OPTION_DISPATCH_TABLE_SIZE

Value = current value of the option

I don't think "current value of the option" is the exact definition. There are six options; does each option has the same type of current value? After experimenting, I found the the sense of the "Value" parameter:

The "Value" type always points to DWORD.

  1. When one of these {WLX_OPTION_USE_CTRL_ALT_DEL, WLX_OPTION_USE_SMART_CARD, WLX_OPTION_SMART_CARD_PRESENT} options is used, the return value is BOOLEAN:
      DWORD dwX = 0;
      g_pWlxFuncs->WlxGetOption( g_hWlx,
                                 WLX_OPTION_USE_SMART_CARD,
                                 &dwX))
      if (dwX)
      {
        ASSERT(dwX==1);
        LOG("User can log on using smartcard");
      }
      else
      {
        ASSERT(dwX==0);
        LOG("User cannot use smartcard");
      }
    
    I found no differences between these options {WLX_OPTION_USE_SMART_CARD, WLX_OPTION_SMART_CARD_PRESENT}. It always returns the same values. Option WLX_OPTION_USE_CTRL_ALT_DEL always returns TRUE(?).

  2. When the WLX_OPTION_CONTEXT_POINTER option is used, the return value is a pointer to the GINA context. (This context pointer is the value often used as an input parameter for GINA's function, such as WlxDisplaySASNotice, WlxLoggedOutSAS, and so forth...)

  3. When the WLX_OPTION_SMART_CARD_INFO option is used, the return value is a pointer to the WLX_SC_NOTIFICATION_INFO structure. This structure is defined in the newer version of WinWlx.h as:
      typedef struct _WLX_SC_NOTIFICATION_INFO {
        PWSTR   pszCard ;
        PWSTR   pszReader ;
        PWSTR   pszContainer ;
        PWSTR   pszCryptoProvider ;
      } WLX_SC_NOTIFICATION_INFO, * PWLX_SC_NOTIFICATION_INFO ;
    
    If the smartcard is not acceptable, the return value is NULL:
      dwX = 0;
      PWLX_SC_NOTIFICATION_INFO pInfo = NULL;
      g_pWlxFuncs->WlxGetOption( g_hWlx,
                                    WLX_OPTION_SMART_CARD_INFO,
                                    &dwX) 
      if (dwX==0) LOG("Smart card is not acceptable");
      else
      {
        pInfo = (PWLX_SC_NOTIFICATION_INFO)dwX;
        LOG_FORMAT1("Card = %ws",pInfo->pszCard);
        LOG_FORMAT1("Reader = %ws",pInfo->pszReader);
        LOG_FORMAT1("Container = %ws",pInfo->pszContainer);
        LOG_FORMAT1("CSP = %ws",pInfo->pszCryptoProvider);
      }
    
    The pszContainer value was allways NULL in my experiments(?).
    WlxGetOption ret
    
  4. When the WLX_OPTION_DISPATCH_TABLE_SIZE option is used, the return value is a dispatch table sized in bytes.

The code was tested on Windows 2000, and dispatch version WLX_VERSION_1_3. I hope this article will save time for someone who wants to use WlxGetOption and looks for documentation about it. If you have some other experiences or suggestions, please add your comment.



Comments

  • awGthH RK cB jio InMX xO

    Posted by SUhVPyoUki on 05/20/2013 06:10am

    buy tramadol online cod overnight tramadol online apotheke - tramadol experiences

    Reply
  • NULL returned for WLX_OPTION_SMART_CARD_INFO

    Posted by Legacy on 10/29/2003 12:00am

    Originally posted by: chan

    Hi,
    
    

    Your info was really helpful to proceed.

    When i called the WlxGetOption with WLX_OPTION_SMART_CARD_INFO parameter, the third parameter had value 0.You have mentioned that this means "Smart card is not acceptable".

    What could be the problem and any suggestions to re ctify this.

    My smart card is working fine with MSGINA cert logon.

    Thanks a lot,
    Chan

    Reply
  • WlxGetOption Documentation

    Posted by Legacy on 09/16/2003 12:00am

    Originally posted by: Milan Spalek

    Great - your comments are very helpful 4 me! DEKUJU!!!
    

    Reply
  • Problem with Smart Cards on WIn XP

    Posted by Legacy on 09/06/2003 12:00am

    Originally posted by: bfadi

    Hi
    I made an new GINA.dll that use smart card for windows logon.
    It worke fine on Win2K but in XP it did not work. I could not get the message SAS_SC_INSERT !

    I put the folowing : SetOption(USE_SC,1)... But it did not work also.
    I found on the web that some people say that if the XP is not domain joined it will not support Smart Card logon !

    Please do you have any solution ?
    Thanks

    Reply
  • Great!! Thanks

    Posted by Legacy on 08/06/2002 12:00am

    Originally posted by: Giuseppe Amato

    Thankyou for this article...

    I'm writing a Smartcard enabled GINA replacement (based on the Ginastub MSDN example).
    It's making me crazy, because everything is bad documented!(or not documented at all!)

    tanks again
    Giuseppe Amato

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds