A program to modify msgina.dll in order to inactivate the Lock Workstation button in the Windows NT Security (Ctrl-Alt-Del) dialog.
Copyright (C) 1997 by
This program is free software under the GNU General Public License. See the file LICENSE for details. The latest version of NOLOCKWS can be found at http://wwwthep.physik.uni-mainz.de/~frink/nt.html.
Especially for large PC pools in universities or schools it is very annoying when users lock their NT workstations, leave, and forget to come back. Subsequent users have the choice of resetting the PC or calling an administrator who can unlock the workstation. While lots of Windows NT settings can be changed through the registry, disabling the Lock Workstation button in the Windows NT Security (Ctrl-Alt-Del) dialog seems to be forgotten.
Some time ago, I suggested a method how to overcome this: load msgina.dll from the \winnt\system32 directory with a resource editor (which come with most C++ compilers for Windows) and modify the window style attributes of the Lock Workstation button in dialog #1000 or #1650 (this is the Windows NT Security dialog) for NT 3.51 or 4.0 resp.
However, this is cumbersome, dangerous (a corrupt msgina.dll may prevent the system from booting properly), and not everybody has a resource compiler to hand. Therefore I decided to write a program that automates this task. This is the second BETA version intended for a broader testing than I can do.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
For short, the main aspects of the GNU General Public License are in my personal interpretation which may not be 100% accurate (I am a physicist, not a lawyer):
Let me briefly explain how the program works. Source code is included, so you may examine it on your own and modify it under the restrictions of the GNU General Public License. If you had problems when you first run NOLOCKWS, read on, it may help you to understand the failure. If you did not have any problems yet and if you are not interested in the technical backgrounds, you can safely skip this section and go directly to the Usage section.
The Windows NT Security dialog with the Lock Workstation button is contained as dialog resource #1000 (NT 3.51) or #1650 (NT 4.0) resp. in %systemroot%\system32\msgina.dll. First, NOLOCKWS tries to detect the language of this file with the GetFileVersionInfo() and VerQueryValue(..., "\\VarFileInfo\\Translation", ...) API calls. Currently, Danish, Dutch, English, Finnish, French, German, Italian, Norwegian, Portuguese, Spanish and Swedish are implemented (Portuguese may have a problem with code page conversion). Then, NOLOCKWS scans msgina.dll for the text on the Lock Workstation button, which it knows for these languages. For the English version, this is Lock &Workstation in Unicode (16 bit), the '&' in front of the 'W' denotes the accelerator key Alt-W (the letter which is underlined in the dialog). NOLOCKWS makes sure that this text appears only once in msgina.dll. If so, it is most likely part of a ControlData structure, which appears for each control element in the dialog and is defined in the resource file format documentation found in \doc\filefrmt\resfmt.txt on the Win32 SDK CD as follows:
struct ControlData {
DWORD lStyle; // 0x50010001L for the LW button
DWORD lExtendedStyle; // 0x00000000L for the LW button
WORD x; // x position in pixel
WORD y; // y position in pixel
WORD cx; // width in pixel
WORD cy; // height in pixel
WORD wId; // control id for the LW button
// (1007 for NT 3.51, 1651 for NT 4.0)
[Name or Ordinal] ClassId; // 2 WORDs: 0xFFFF (Ordinal), 0x8000 (Button)
[Name or Ordinal] Text; // English: Lock &Workstation, in Unicode
WORD nExtraStuff; // ???
};
A WORD occupies two bytes, a DWORD four bytes, so the
lStyle field, which defines the button's window style attributes, can
be found 2*4+5*2+2*2=22 bytes ahead of the Text field.
By default, lStyle is WS_CHILD | WS_VISIBLE | WS_TABSTOP |
BS_DEFPUSHBUTTON = 0x40000000L | 0x10000000L | 0x00010000L | 0x00000001L =
0x50010001L (other buttons have the BS_DEFPUSHBUTTON flag
cleared).
To disable the button, the WS_DISABLED flag (0x08000000L)
has to be set, i.e. the window attributes have to be modified to
0x58010001L (alternatively it would be possible to hide the button by
clearing the WS_VISIBLE = 0x10000000L flag). The modified file cannot
immediately replace the original one, since it is in use. Therefore, the
original file has to be renamed to something else, afterwards the modified
file can be saved as msgina.dll. The changes become active at the
next reboot.
If you are using Novell's IntraNetware Client for Windows NT, you have to modify nwginar.dll in %systemroot%\system32\nls\english, because msgina.dll is no longer used. NOLOCKWS detects Novell through the registry entry HLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\GinaDLL.
Again: This program is still in BETA state and is distributed WITHOUT ANY WARRANTY. Before you use this program, make a backup of all your important data, create an Emergency Repair Disk (with RDISK /S), and have your three NT Setup disks and the CD to hand, since it is possible that an unexpected failure may leave your system in an unusable state (although I have not experienced any problems yet and have received only positive feedback on version 0.9).
On successful completion, NOLOCKWS will have created a backup of the unmodified msgina.dll called msgina.bak (nwginar.bak resp.) in the same directory. If this file already exists (when you run the program for the second time), NOLOCKWS will prompt you to rename (switch to File Manager/Explorer, rename it, switch back to NOLOCKWS, then choose retry) or delete it.
If you are afraid of directly modifying important Windows NT system files, but have experience using the registry editor RegEdt32, you may want to try a different method of modifying and installing msgina.dll:
I hope this never happens, these are just some untested ideas, because it has not been necessary yet:
As a proper GPL program, NOLOCKWS comes with source code. Therefore it should be easy to compile it on any NT platform. Adjust the /machine: qualifiers in the .mak makefile and link with your C runtime library, kernel32.lib, user32.lib, advapi32.lib and version.lib. I have compiled it for Intel x86 with Microsoft Visual C++ 4.2 (Cygnus' gcc for GNU-Win32 lacks <conio.h>), and for DEC Alpha with VC++ 4.1, both under NT 4.0. You should have received both binary versions. They should run under NT 3.5/3.51 as well.
Since NOLOCKWS more or less simply scans msgina.dll for a text sequence and modifies a byte near this sequence where it expects the window attributes for the Lock workstation button (instead of using high level API calls like UpdateResource()), it relies heavily on an unchanged resource format. A quote from the resfmt.txt file states: "Microsoft is NOT committing to stay with these formats by releasing this document." So, the resource file format might change in newer (>4.0) versions of Windows NT (e.g. 64 bit NT 5.0 for axp), and NOLOCKWS will fail. Try it very carefully on these versions! It is possible that NOLOCKWS will be obsolete for newer NT versions if Microsoft reacts on customer requests.
NOLOCKWS runs fine on NT 4.0 Server and Workstation U.S. (x86) and NT 4.0 WS U.S. (axp). I have successfully modified U.S. msgina.dlls from NT 3.51 x86 and axp, which indicated an identical resource format. Further, I have tested it with Danish, Dutch, English, Finnish, French, German, Italian, Norwegian, Portuguese, Spanish and Swedish msgina.dlls from NT 3.51 on a U.S. NT 4.0 system. Portuguese may not work on a pure Portuguese system due to code page conversion problems (if Portuguese uses code page 860).
To do: More tests, especially on international versions (I need the text in your local language. Please help me, see section 7). Or implement language detection with LoadResource.
This program does not run on Windows 95! (Why should it?)
| nolockws.exe | precompiled binary file for Intel x86 |
| a_nolockws.exe | precompiled binary file for DEC Alpha |
| nolockws.c | source code | nolockws.mak | makefile for VC++ (adjust the /machine qualifiers for non-x86) |
| LICENSE | GNU General Public License |
| readme.1st | first instructions |
| readme.html | this documentation |
| changes.html | summary of what has changed between versions |
If you have any suggestions, ideas for improvements, problems or anything else concerning the program or the documentation, send an e-mail to Alexander.Frink@Uni-Mainz.DE or snailmail to Alexander Frink, Hermann Schauss Str. 8, D-65232 Taunusstein, Germany.
A short list of possible improvements I have collected: