none
What is the best way to reboot the system using system function in an application? RRS feed

  • Question

  • Dear Developers,

    Greetings!!!!

    As, i would like to reboot my WinCE 7 based system with an application. I am using one system defined function SetSystemPowerState. Below is the sample code -

    DWORD result;
    	result = SetSystemPowerState(NULL, POWER_STATE_BOOT,0);
    	if(result){
    		DEBUGMSG(TRUE,(TEXT("The system is going to boot\r\n")));
    	}
    	else{
    
    		DEBUGMSG(TRUE,(TEXT("ERROR: While trying to reboot the system :%d\r\n"),GetLastError()));
    	}

    But, when I run my application I got the following debug messages -

     100418 PID:4740016 TID:319004e CePerf.dll is absent - performance data will not be recorded
     100422 PID:2cc0652 TID:234063a OSAXST1: >>> Loading Module 'coredll.dll' (0x9E411740) at address 0x40010000-0x40165000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
     100423 PID:2cc0652 TID:234063a OSAXST1: >>> Loading Module 'System_Reboot_DEBUG.exe' (0x9E4C379C) at address 0x00010000-0x00016000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
    PB Debugger Loaded 'System_Reboot_DEBUG.exe', no matching symbolic information found.
     100435 PID:2cc0652 TID:234063a OSAXST1: >>> Loading Module 'locale.dll' (0x9E412C00) at address 0x40170000-0x401B1000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
     100526 PID:2cc0652 TID:234063a OSAXST1: >>> Loading Module 'normalize.dll' (0x9E412E3C) at address 0x401E0000-0x401FF000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
     100535 PID:2cc0652 TID:234063a CePerf.dll is absent - performance data will not be recorded
     100537 PID:400002 TID:db0006 PM: DEBUGCHK failed in file d:\bt\2034\public\common\oak\drivers\pm\pdd\default\pwsdef.cpp at line 424 
     100538 PID:400002 TID:db0006 DefaultPowerStateManager::PlatformMapPowerStateHint: returning 2
     100539 PID:2cc0652 TID:234063a The system is going to boot
     100539 PID:2cc0652 TID:234063a Dll list:
     100543 PID:2cc0652 TID:234063a OSAXST1: <<< Unloading Module 'coredll.dll' (0x9E411740) at address 0x40010000-0x40165000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
     100543 PID:2cc0652 TID:234063a OSAXST1: <<< Unloading Module 'normalize.dll' (0x9E412E3C) at address 0x401E0000-0x401FF000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
     100544 PID:2cc0652 TID:234063a OSAXST1: <<< Unloading Module 'locale.dll' (0x9E412C00) at address 0x40170000-0x401B1000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
     100545 PID:2cc0652 TID:234063a OSAXST1: <<< Unloading Module 'System_Reboot_DEBUG.exe' (0x9E4C379C) at address 0x00010000-0x00016000 in Process 'System_Reboot_DEBUG.exe' (0x9E4C379C)
    PB Debugger Unloaded symbols for 'System_Reboot_DEBUG.exe'

    But, the system does not boot. Any conclusion with the above observations???


    Thursday, April 2, 2015 5:11 AM

All replies

  • Hi,

    for x86 platforms - try SetSystemPowerState (NULL, POWER_STATE_RESET, POWER_FORCE) instead.

    Default reboot routine is located @ WINCE700\platform\common\src\x86\common\ioctl\reboot.c, but custom BSP may port it to itself.

    Good luck.

    Thursday, April 2, 2015 8:20 AM
  • Dear iShust,

    Thanks for reply but I am using Arm arch.

    Thursday, April 2, 2015 10:29 AM
  • That will require that you, the BSP developer, develop code in the OAL to actually implement rebooting.

    But I would try POWER_STATE_RESET first.


    Bruce Eitman (eMVP) Senior Engineer Bruce.Eitman AT Eurotech DOT com My BLOG http://geekswithblogs.net/bruceeitman Eurotech Inc. www.Eurotech.com

    • Proposed as answer by Keshava GN Tuesday, May 19, 2015 10:41 AM
    Thursday, April 2, 2015 12:49 PM
    Moderator
  • Dear Developers,

    Greetings!!

    @Bruce, Thanks for your complement, yes this can be the way to actually implement rebooting but in my query it is mentioned that .....funciton in an application??

    Friday, April 3, 2015 3:23 AM
  • Using SetSystemPowerState (NULL, POWER_STATE_RESET, POWER_FORCE) will finally call the  KernelLibIoControl((HANDLE)KMOD_OAL, IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL)

    you have to implement IOCTL_HAL_REBOOT Kernel IOCTL in OAL part of your BSP.


    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp

    Friday, April 3, 2015 6:26 AM
  • Dear Vinoth,

    Thanks for reply!!

    Is reset and reboot both are same. If yes, then okay and if not then please specify the way to reboot the system rather then reset the system????

    Friday, April 3, 2015 6:36 AM
  • yes. reset can be done though various methods depends on the processor and board . you have to implement the above mentioned IOCTL to perform the reboot through resetting your processor/hardware.

    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp

    Friday, April 3, 2015 8:19 AM
  • As I stated, and I believe rather clearly, you - the BSP developer - will need to implement the code to cause a reboot, if that is what you want to do. Reboot is usually not developed by Microsoft or the silicon vendors.


    Bruce Eitman (eMVP) Senior Engineer Bruce.Eitman AT Eurotech DOT com My BLOG http://geekswithblogs.net/bruceeitman Eurotech Inc. www.Eurotech.com

    Friday, April 3, 2015 12:43 PM
    Moderator