分类: 嵌入式
2011-02-13 17:43:12
PCLock
is a system to allow a user to use his/ her mobile disk to logon to Microsoft® Windows® operating systems. It works as a SmartCard and the user does not need to know the password to logon. All information required to logon is kept in a file in the mobile disk (User.Info). This file contains some information about the mobile disk. Copying the file to another disk does not work. User logs on to Windows by inserting the disk and logs out by removing the disk (optional).
PCLock
is designed around the Win32 Winlogon. Winlogon is a component of the Microsoft® Windows NT®/Windows® 2000/Windows® XP operating system that provides interactive logon support. Winlogon is designed around an interactive logon model that consists of three components (as shown in Figure 1 below): the Winlogon executable program, a Graphical Identification, and authentication dynamic-link library (DLL)-referred to as the GINA-and any number of network providers.
Winlogon handles interface functions that are independent of authentication policy. The GINA is a replaceable DLL component that is loaded by Winlogon. The GINA implements the authentication policy of the interactive logon model, and is expected to perform all identification and authentication user interactions. For example, replacement GINA DLLs can implement smart card, retinal-scan, or other authentication mechanisms in place of the standard Windows NT/Windows 2000 user name and password authentication. Network provider DLL is not used in our case.
Each client requires a security key at the time of setup. This key should be the same for a group of PCs. Several groups can exist but user can login only on the same group. If there is only one group (all PCs use the same key) everyone can login to every PC. The security key is kept with Windows. This key is required while creating the authentication disk. Every disk contains Windows user information and this is checked using Local Security Authority (LSA) of Windows.
The KeyGen
application is used to create User.Info file on mobile disk. The file created for a disk is unique and does not work on any other disk. The user can only use the disk as storage. Any change or format of the disk can cause the file invalid. KeyGen
requires a security key while creating the disk that must be similar to the security key that is used while setting up the client. Validity of a disk can be checked using KeyGen
. Windows user information is not checked here. Wrong information about logon causes a popup dialog box to appear asking for username and password. It is possible to use a domain. But this feature is not tested. All information on the disk is encrypted but it should be kept securely. Anyone having the disk can logon to client systems.
When the computer boots up, the Winlogon initializes and negotiates with GINA. The GINA shows a dialog box and waits for the user to insert his/ her mobile disk (Figure 2).
When a removable device is inserted into or replaced from a computer, a system wide WM_DEVICECHANGE
message is broadcasted by the OS. The WM_DEVICECHANGE
device message notifies an application of a change to the hardware configuration of a device or the computer. The GINA checks for a valid user information file. If found, it logs on to Windows using LogonUser
API. The DevMon
application monitors the WM_DEVICECHANGE
message and if it finds no valid disk inserted into the system it sends a logout request to the Winlogon. If the application fails to quit properly, this may fail. Force termination of an application may cause data loss. So force is not applied. Users are suggested to logout the system manually from start button. DevMon
is a helper application and it is optional.
The application has four parts:
KeyGen
application DevMon
application Setup
application Now let me give a short description for each of them.
This is the heart of the project. It is used by Windows to interact with the user to manage a user session. It is a DLL with predefined functions. We make our GINA implementation to be used with mobile disk. Here I show the WlxLoggedOutSAS
function that shows a dialog box (Figure 2) and waits for the user to insert the mobile disk that can be used to login that user.
|
The dialog procedure is as follows:
|
This application is used to monitor the mobile disk. If the user removes a mobile disk, the system sends WM_DEVICECHANGE
message to the application. Now we check if it is the disk used to login user and if true
, end user session by calling ExitWindows
API.
|
We need to check if a valid disk is still present on system to make sure the actual logon disk is removed.
|
This application is used to generate userinfo file on mobile disk. It takes input from the user. It shows a combo box of all users to select from. To enumerate users in a combo box, we use the following function.
|
It stores both previous applications (excluding KeyGen
) in its resource section. It extracts those on the client machine and creates registry settings as appropriate. Please refer to source code for details.
Use setup.exe to install on the client PC. Please be careful while entering the security key. If this key is wrong, you may not logon to Windows locally even if you are the administrator.
Use KeyGen
application to create the authentication disk. You may use this tool on any computer. But you can check the disk validity only where the PCLock
is installed. Provide valid Windows logon user information when asked for. If you change the password on client computer, the user is asked for valid information when he/she inserts his/her disk. Invalid security key on the disk will cause logon failure. Remove the user.info file from root of mobile disk and the disk is no more valid. Do NOT format the disk or change the label of the disk. If you copy the same file it may not work. The user.info file is only valid for a single disk. The disk information is kept on the disk. You cannot copy the file to another disk even it is from the same manufacturer.
Logon to an administrator account and use setup.exe to uninstall PCLock
. You need to provide the security key. After uninstall, restart the computer and run setup.exe again for optional clean up.
This article, along with any associated source code and files, is licensed under