RE: Custom GINA logon failing for Remote Desktop sessions

来源:百度文库 编辑:神马文学网 时间:2024/06/03 15:17:01
Windows XP and remote desktop is known as Single User Terminal Server, the
behavior of MSGINA is slightly different from when a user physically logs
onto a console session.
When you logon to an XP machine via remote desktop, the logon initially
happens in a dummy session. The user will type in their credentials and
WlxLoggedOutSAS()
will be called. At this point, the function
WlxGetConsoleSwitchCredentials() will be called and the information typed
by the user in the remote session will be used to fill in the
WLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 structure. After this happens, the
WlxLoggedOutSAS() in the console session, different Winlogon/MSGINA
(from the remote session) will be called and the logon type returned by
WlxLoggedOutSAS() will be WLX_SAS_TYPE_AUTHENTICATED. The console session
will
then call the function QuerySwitchConsoleCredentials() to obtain the
authentication information that was type by the remote session user. The
console session MSGINA
will use this information to do an autologon. If the logon succeeds, it
will redirect the console session to the remote session and the MSGINA that
is running is the console session one and NOT the remote/dummy session.
You need to detect the WLX_SAS_TYPE_AUTHENTICATED and when you receive
this, you know the logon was done via a remote session and do everything
from the console session MSGINA and NOT from the dummy session. You
shouldn‘t collect password in this case, since MSGINA calls the function
QuerySwitchConsoleCredentials() to obtain the authentication information
installed of passing it to WlxLoggedOutSAS. In the dummy session when
WlxLoggedOutSAS() is called which is going to be called before the
WlxLoggedOutSAS() in the console session, you should call
GetSystemMetrics() with SM_REMOTESESSION, if you are in a remote session
you should ignore this and wait for the WlxLoggedOutSAS() in the console
session which returns a logon type of WLX_SAS_TYPE_AUTHENTICATED.