HOWTO: Password Protecting Screen Savers without ScrnSave.lib

Last reviewed: March 12, 1998
Article ID: Q182382
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)
  • Microsoft Windows NT versions 3.50, 3.51, 4.0
  • Microsoft Windows 95

SUMMARY

The ScrnSave.lib static library provides the "standard" Windows 95 Screen Saver password, not Windows itself. The "standard" Windows 95 Screen Saver password is not available to Screen Savers that are not written to use ScrnSave.lib. Screen Savers that are not written to use ScrnSave.lib need to implement independent password authentication, encryption, and storage.

Windows NT ignores the password handling within the Screen Saver and uses the user's system password.

MORE INFORMATION

The ScrnSave.lib library provides password protection for Screen Savers that use it. Windows 95 Screen Savers that are not written with ScrnSave.lib need to provide independent password handling. To do this, Screen Savers need to provide a Password Change dialog box.

The Password Change dialog box is displayed when the Screen Saver is started with a "/a <HWND>" argument, where <HWND> is an unsigned decimal number representing the HWND of the owner window of the password dialog box. If no HWND is passed in the Password Change dialog box, the foreground window should own the Password Change dialog box.

When the Screen Saver runs it should check the HKEY_CURRENT_USER/ REGSTR_PATH_SCREENSAVE/REGSTR_VALUE_USESCRPASSWORD (REGSTR_PATH_SCREENSAVE and REGSTR_VALUE_USESCRPASSWORD can be found in regstr.h) registry key if it needs to use the Screen Saver's password protection. If the Screen Saver does need to use its password protection, it needs to prevent the user from switching to other applications without giving the password. To do this the Screen Saver needs to call:

   int prev;

   SystemParametersInfo(SPI_SCREENSAVERRUNNING,TRUE,&prev,0);

This prevents the user from using ALT+TAB to switch to another application or CTRL+ALT+DELETE to kill the Screen Saver.

When the user hits a key or moves the mouse, the Screen Saver confirms the password. If the password is validated, the Screen Saver calls the following to re-enable task switching:

   int prev;

   SystemParametersInfo(SPI_SCREENSAVERRUNNING,FALSE,&prev,0);
Version           : WIN95;WINNT:3.50,3.51,4.0
Platform          : Win95 winnt
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 12, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.