📄 readme.txt
字号:
Q314989 - Let Me In: Pocket PC Password User Interface Redirect Sample
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Windows CE Platform SDK for Pocket PC 2002
Microsoft Windows CE Platform SDK for Pocket PC
--------------------------------------------------------------------------------
OVERVIEW
-------
This articles describes what you need to implement a custom password
applet (redirect) for a Pocket PC device, and sample code to demonstrate the
concepts.
NOTE: The power-on password functionality may not function predictably
on some devices. This is because the original equipment manufacturer of the
device may change the Startui component in some ways, which may change its
behavior or your ability to modify the component.
The "Let Me In" sample replaces the standard Pocket PC password user interface
with a doodle grid. You can specify a pattern connecting the grid points by
drawing on the grid in the settings applet. Once enabled, the pattern must be
entered when the device is powered-on before any other tasks can be performed.
Creating a Password Applet Redirect
-----------------------------------
To create a password applet replacement, follow these steps:
1. Create a DLL project that outputs a module named Password.cpl.
2. Implement and export the CPlApplet() function to create the new Control
Panel applet. Use the CheckPassword function, the SetPassword function, and
SetPasswordActive function to set the platform password settings. Use
this password for two things that must be considered:
a. The ActiveSync desktop component can request this password when
the device tries to connect.
b. The device can request this password at power-on before any other
operations can be performed.
3. Implement and export the PromptForPasswd() function. This function
displays the power-on password interface.
4. Create a .cpl file association in the device registry. This is required
for some other critical registry keys to work correctly:
[HKCR\.cpl]
(default) = "cplfile"
[HKCR\cplfile\Shell\Open\Command]
(default) = "\Windows\ctlpnl.exe %1"
Microsoft also recommends the following optional keys for completeness:
[HKCR\cplfile]
(default) = "<description>"
[HKCR\cplfile\DefaultIcon]
(default) = "<module-name>,<icon-resource-id>"
5. Set the location of the redirect password module in the device registry.
[HKLM\ControlPanel\Password]
"Redirect" = "\windows\password.cpl"
NOTE: You must name the module "password.cpl" for the module to be
backward compatible with earlier versions of the Pocket PC platform.
7. NEW TO POCKET PC 2002: set the password request timeout policy in the
device registry:
[HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Shell]
"ActivePeriod"=DWORD:<minutes>
This minutes value determines how long the device must be off continuously
before power-on prompts for the password again. A value of 0 (zero) indicates
that the device should always prompt for the password. The control panel
applet can provide a user interface to make this user configurable.
NOTE: If this value is not 0 (zero), and you fail to leave the device off
for the specified period of time, the password dialog does not appear when
you resume the device.
Special Functions
-----------------
SetPassword
This Pocket PC function sets the system password to a new string.
BOOL SetPassword(
LPWSTR lpszOldPassword,
LPWSTR lpszNewPassword );
Parameters
lpszOldPassword
The current device password. This determines
whether the user or application has permission to call this
function. Specify NULL if there currently is no password set.
lpszNewPassword
The desired new password. Specify NULL to remove
the current password without setting a new one.
Return Values
TRUE indicates that the change of password was successful.
FALSE indicates that the change of password was not successful.
SetPasswordActive
This Pocket PC function enables or disables the password.
BOOL SetPasswordActive(
BOOL bActive,
LPWSTR lpszPassword );
Parameters
bActive
TRUE enables the password.
FALSE disables the password.
lpszPassword
The current device password. This determines
whether the user or application has permission to call this function.
Return Values
TRUE indicates that activating the password was successful.
FALSE indicates that activating the password was not successful.
When active, this password can be used by the Startui component
and ActiveSync to control access to the device. In the case of
ActiveSync, this function results in a password prompt that
appears on the desktop. The Startui component prompts for this
password if the power-on password is enabled by means of the
following registry setting:
[HKCU\ControlPanel\Owner]
"PowrPass"=REG_BINARY:<flag-byte>
A flag-byte value of 0x01 enables the power-on prompt. A value
of 0x00 disables the power-on prompt.
GetPasswordActive
This Pocket PC function indicates whether the current password
is active.
BOOL GetPasswordActive( void );
Return Values
TRUE indicates that the password is active.
FALSE indicates that the password is not active.
PromptForPasswd
This function is implemented by the password redirect module and
is called by the operating system to prompt the user for a password.
LPTSTR PromptForPasswd(
HWND hwndParent,
BOOL fTightSecurity );
Parameters
hwndParent
The handle of the parent window. Make any password window
a descendant of this window.
fTightSecurity
Always set this to TRUE. This parameter is
currently reserved.
Return Values
A password string that will be validated by the operating system.
This string must be allocated with LocalAlloc and will be freed by
the operating system.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -