Don't know the meaning .. check this out here
- Nicolas
Wednesday, July 22, 2009
SDK, DTK, DRK: WTF?!
Posted by
Nicolas BESSON [MVP]
0
comments
Labels: SDK, Windows Mobile
Thursday, July 2, 2009
Change the Screen Rotation in your application
Windows Embedded CE devices on their side can also have screen rotation enabled, but as they are usually for industrial purposes, this feature is not necessarily enabled.
On both version, when user have to do screen rotation the ChangeDisplaySettingsEx function is used. The sample code below shows up the steps to perform screen rotation.
BOOL RotateScreen(int iRotationAngle)
{
int iAngle;
// Check if rotation angle is a multiple of 90 degres
if ((iRotationAngle % 90) != 0)
{
return FALSE;
}
// Screen rotation is a bit field value
// 0 = 0, 1 = 90, 2 = 180, 4 = 270
iAngle = iRotationAngle / 90;
if( iAngle == 3 )
iAngle = 0x4;
//
DEVMODE devMode;
memset (&devMode, 0, sizeof (devMode));
devMode.dmSize = sizeof (devMode);
devMode.dmFields = DM_DISPLAYQUERYORIENTATION;
// Retrieve the supported screen rotation angles
if (DISP_CHANGE_SUCCESSFUL != ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_TEST, NULL))
{
return FALSE;
}
// Check if required screen rotation is supported
if (iAngle == 0 || iAngle & devMode.dmDisplayOrientation)
{
memset(&devMode, 0, sizeof (devMode));
devMode.dmSize = sizeof (devMode);
devMode.dmFields = DM_DISPLAYORIENTATION;
devMode.dmDisplayOrientation = iAngle;
if (DISP_CHANGE_SUCCESSFUL != ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_RESET, NULL))
{
return FALSE;
}
else return TRUE;
}
return FALSE;
}
Thanks to Alban for his help.
- Nicolas
Posted by
Nicolas BESSON [MVP]
0
comments
Labels: Windows CE 6.0, Windows Mobile
State and Notifications Broker API
The Provider:
The provider create in registry one entry per state managed, and is in charge of the update of those entries when states changed. Usually system states are defined in HKEY_CURRENT_USER\System\State and HKEY_LOCAL_MACHINE\System\State, and user defined (or applicative) states are located in HKEY_CURRENT_USER\Software\State and HKEY_LOCAL_MACHINE\Software\State. The snapi.h header file defines most of the system states notifications for various system functionalities like Phone, Mails, SMS Appointment, Battery, Screen Rotation ... and custom entries should be managed by your own.
The Client:
The client register to a state defined in registry by the Provider, and get notified by the operating system while value changed. Different notifications mechanism can be used :
- Application activation : can start a client application while registry content changed (or state changed)
- Message Queue : signal a state notification through a Message Queue
- Window message : signal a state notification via a Windows Message loop (WindowProc)
- Callback : signal a state notification using a call back function
The client should register for state notification using one of the following function depending on the type of notification required (RegistryNotifyApp, RegistryNotifyWindow, RegistryNotifyCallback or RegistryNotifyMsgQueue). When state change notification is received the client should read the value using the regular regsitry functions access, or RegistryGetDWORD or RegistryGetString. While notification is no longer required, the client have to call RegistryCloseNotification to close the notification.
No specific action is required by the provider except to update the registry values while internal application transition should generate external state notifications.
You can find a usage sample in the Windows Mobile SDK sample source code of the Battery Statistic :
%ProgramFiles%\Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\battstat
- Nicolas
Posted by
Nicolas BESSON [MVP]
3
comments
Labels: Windows CE 6.0, Windows Mobile
Tuesday, June 16, 2009
Windows Mobile Local Authentication PlugIn

LAP Implementation
A LAP is a signed DLL share the following entry points :
- InitLAP : Call by the system to initialise the LAP while loaded.
- DeinitLAP : Call while LAP is unloaded
- VerifyUserStart : Call to start the GUI of the LAP
- VerifyUser : Call to validate the user, with or without a GUI. This functions returns while the user has been authenticated successfully or fails. Multiple calls to this function can be done by the system. Options parameter specifies how the user have to be validated.
- VU_NO_UI : while the system needs to validate the user, without displaying a window to the user.
- VerifyUserStop : Call to destroy the GUI and clean up.
- VerifyUserToTop : Call to bring to top the LAP Window.
- LAPCreateEnrollmentConfigDialog : Used to display configuration window to configure the pass-phrase of the LAP
To implement your own LAP you can start from scratch or use the sample LAP provided with the Windows Mobile SDK :
- for pocket PC : %ProgramFiles%\Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\LAP
- for smart phone : %ProgramFiles%\Windows Mobile 6 SDK\Samples\Smartphone\CPP\win32\LAP
The Local Authentication Subsystem (LASS) is in charge of the management of the LAP display and user validation.
To define a new LAP, add a new key in the registry :
[HKEY_LOCAL_MACHINE\Comm\Security\LASSD\LAP\myLAP]
"Dll"="myLAPDll.dll"
To select the current active LAP set the
[HKEY_LOCAL_MACHINE\Comm\Security\LASSD\LAP]
"ActiveLap"="myLAP"
LAP Configuration
For security reason this pass-phrase should not be saved in the registry as a clear string, but should be encrypted using a custom algorithm or the Windows MobileCryptoAPI.
Validate a User in your application
- ValidateUser is a blocking call to the LASS service, and give a way to provide parameters to the LAP, like an AE Key (specific security policy id), options (like VU_NO_UI to check the user without prompting any Window). Functions will return only after user authentication.
APP A;
HWND hMyWindow;
VerifyAndCallSecureFunction()
{
DWORD LastError;
GUID AEKeyForFoo = ...;
if (VerifyUser(&AEKeyForFoo,"App A",hMyWindow,
VU_UNTIL_SUCCESS,0)) // Call into LASS;
// This will
CallSecureFunction() // call into active LAP
// and show LAP-specific UI
else
TellUserVerificationFailed(GetLastError()));
// display your own UI
}
- SHDeviceLockAndPrompt is a non blocking call, but will require user authentication for any activity on the device.
- Nicolas
Posted by
Nicolas BESSON [MVP]
0
comments
Labels: Windows Mobile
Tuesday, June 9, 2009
CERegEditor : an alternative to Remote Registry Editor
Found a great atlternative to the Remote Registry Editor, without the requirement of the installation of a Visual Studio Smart Device component. Useful for non developper's guys...
One of my favorite feature is the registry comparison, between two snapshots.
Check out this cool application here.
- Nicolas
Posted by
Nicolas BESSON [MVP]
3
comments
Labels: General
Easy way to componentize modules
Since Windows CE 4.2, Mike Hall is maintaining a power toy application helping to componentize your applications, drivers to integrate them inside your catalog views. This application is now available under the MSDN Code Gallery.
Big thanks to Mike for this CEFileWiz application helping beginners for an easy and quick understanding of the requirements for a componentized module.
- Nicolas
Posted by
Nicolas BESSON [MVP]
0
comments
Labels: Microsoft, Windows CE 4.2, Windows CE 5.0, Windows CE 6.0
Wednesday, June 3, 2009
Get Ready for Windows Mobile 6.5
- Nicolas
Posted by
Nicolas BESSON [MVP]
0
comments
Labels: SDK, Windows Mobile
