Dear Sir,
I use PXA27X, PSM 3.8 and WINCE 5.0 to develop my project.
I try to save registry before system go into suspend. But it have some
problem.
The following is my test.
Test 1 :
I add RegFlushKey function in XXX_PowerDown();
But system sometime will hang up.
Original :
PowerDown(DWORD dwContext)
{
}
After:
PowerDown(DWORD dwContext)
{
RegFlushKey(HKEY_LOCAL_MACHINE);
RegFlushKey(HKEY_CLASSES_ROOT);
RegFlushKey(HKEY_CURRENT_USER);
RegFlushKey(HKEY_USERS);
}
Test 2:
I add RegFlushKey function in PM Driver , platform.cpp , Line 676.
But system sometime will hang up.
Original :
if((dwNewStateFlags & (POWER_STATE_SUSPEND | POWER_STATE_OFF |
POWER_STATE_CRITICAL | POWER_STATE_RESET)) != 0)
{
fSuspendSystem = TRUE;
}
After :
if((dwNewStateFlags & (POWER_STATE_SUSPEND | POWER_STATE_OFF |
POWER_STATE_CRITICAL | POWER_STATE_RESET)) != 0)
{
RegFlushKey(HKEY_LOCAL_MACHINE);
RegFlushKey(HKEY_CLASSES_ROOT);
RegFlushKey(HKEY_CURRENT_USER);
RegFlushKey(HKEY_USERS);
fSuspendSystem = TRUE;
}
Test 3:
I add RegFlushKey function in PM Driver , platform.cpp , Line 880.
But system sometime will hang up.
Original :
if(fSuspendSystem) {
// clear activity flags
ResetEvent(ghevUserActive);
ResetEvent(ghevSignalUserActivity);
ResetEvent(ghevSystemActive);
ResetEvent(ghevSignalSystemActivity);
// set a flag to notify the resume thread that this was
a controlled
// suspend
gfSystemSuspended = TRUE;
PMLOGMSG(ZONE_PLATFORM || ZONE_RESUME, (_T("%s: calling
PowerOffSystem()\r\n"), pszFname));
PowerOffSystem(); // sets a flag in the kernel
for the scheduler
Sleep(0); // so we force the scheduler to
run
After:
if(fSuspendSystem) {
// clear activity flags
ResetEvent(ghevUserActive);
ResetEvent(ghevSignalUserActivity);
ResetEvent(ghevSystemActive);
ResetEvent(ghevSignalSystemActivity);
// set a flag to notify the resume thread that this was
a controlled
// suspend
gfSystemSuspended = TRUE;
RegFlushKey(HKEY_LOCAL_MACHINE);
RegFlushKey(HKEY_CLASSES_ROOT);
RegFlushKey(HKEY_CURRENT_USER);
RegFlushKey(HKEY_USERS);
PMLOGMSG(ZONE_PLATFORM || ZONE_RESUME, (_T("%s: calling
PowerOffSystem()\r\n"), pszFname));
PowerOffSystem(); // sets a flag in the kernel
for the scheduler
Sleep(0); // so we force the scheduler to
run
Test4 :
I add RegFlushKey function in PM Driver , platform.cpp , Line 800.
But system sometime will hang up.
Original:
if(fSuspendSystem) {
......
......
......
FileSystemPowerFunction(FSNOTIFY_POWER_OFF);
gfFileSystemsAvailable = FALSE;
After:
if(fSuspendSystem) {
......
......
......
RegFlushKey(HKEY_LOCAL_MACHINE);
RegFlushKey(HKEY_CLASSES_ROOT);
RegFlushKey(HKEY_CURRENT_USER);
RegFlushKey(HKEY_USERS);
FileSystemPowerFunction(FSNOTIFY_POWER_OFF);
gfFileSystemsAvailable = FALSE;
Do anyone have idea about this issue ?
BR,
dirwdirw.tw