Vassili Philippov (vasja@spbteam.com), September 03, 2001.
Pocket PC has a built-in password protection that allows locking a device with a password. This article describes how to set a system password and "require password when device is turned on" flag.
Pocket PC has a build-in password represented with a string. Default password dialog allows entering only 4 characters password that consists of digitals (0..9). But you can set any string as a password if you write your own password prompt and a password applet in Control Panel.
There is also a "require password when device is turned on" flag. We will call it "password active" flag for short. If this flag is set then the device cannot be turned on without entering a password.
The easiest way for changing password setting is to use STPasswordManager library. This library wraps working with coredll.dll and registry. All you need is to create an instance of CSTPasswordManager class and call necessary methods. Like:
If you want to work with low-level password setting then you have to use functions defined in coredll.dll library. These are:
Here are signatures for these functions:
To use them you have to load coredll.dll library using LoadLibrary function, then take the function address using GetProcAddress function and typecast this address to the function type defined using necessary signature. Here is a sample code for that:
Pocket PC also stores information about "password active" flag in registry in HKEY_CURRENT_USER\ControlPanel\Owner\PowrPass value. So this flag is stored in two different locations: somewhere in inaccessible memory and in registry. You have to update both these locations.
Although it's undocumented you can change the system password and "password active" flag. The easiest way is to use STPasswordManager library that encapsulates all necessary functionality.