How to restart the system under WinCE

Source: Internet
Author: User
Address: http://blog.sina.com.cn/s/blog_6215c3760100fc2s.html

Kerneliocontrol is an undisclosed function. Therefore, we need to declare that many undisclosed methods are used in the following example. Therefore, we need to declare them before use: # define ctl_code (devicetype, function, method, access) (devicetype) <16) | (ACCESS)
<14) | (function) <2) | (method ))
# Define file_device_hal 0x00000101
# Define method_buffered 0
# Define file_any_access 0
# Define Ioctl_hal_reboot Ctl_code (file_device_hal, 15, Method_buffered, File_any_access) 
   
 Extern "C" _ Declspec (dllimport) Bool Kerneliocontrol ( 
 DWORD Dwiocontrolcode,   
 Lpvoid Lpinbuf,   
 DWORD Ninbufsize,   
 Lpvoid Lpoutbuf,   
 DWORD Noutbufsize,   
 Lpdword Lpbytesreturned );


Call:

  Kerneliocontrol (ioctl_hal_reboot, Null, 0, Null, 0, Null ); 

// Supplement

Close (suspend)
Method 1:
// Virtual shut-down key
: Keybd_event (vk_off, 0, 0, 0 );
: Keybd_event (vk_off, 0, keyeventf_keyup, 0 );

Method 2: Call this function and shut down directly. Haha, be careful before calling it!
// Call the undisclosed function poweroffsystem ()
Extern "C" _ declspec (dllimport) void poweroffsystem ();


Soft Reset: the method mentioned at the beginning of the article.
// Soft reset the device
# Include

# Define ioctl_hal_reboot ctl_code (file_device_hal, 15, method_buffered, file_any_access)

Extern "C" _ declspec (dllimport) bool kerneliocontrol (
 DWORD dwiocontrolcode,
 Lpvoid lpinbuf,
 DWORD ninbufsize,
 Lpvoid lpoutbuf,
 DWORD noutbufsize,
 Lpdword lpbytesreturned );

Bool resetpocketpc ()
{
 Return kerneliocontrol (ioctl_hal_reboot, null, 0, null, 0, null );
}

Hard reset)

// Note !!! Using this code will clear all user data in your Pocket PC,
// Do not use it illegally.

# Include

# Define ioctl_hal_reboot ctl_code (file_device_hal, 15, method_buffered, file_any_access)

Extern "C" _ declspec (dllimport) void setcleanrebootflag (void );

Extern "C" _ declspec (dllimport) bool kerneliocontrol (
 DWORD dwiocontrolcode,
 Lpvoid lpinbuf,
 DWORD ninbufsize,
 Lpvoid lpoutbuf,
 DWORD noutbufsize,
 Lpdword lpbytesreturned );

Bool hardresetpocketpc ()
{
 Setcleanrebootflag ();
 Return kerneliocontrol (ioctl_hal_reboot, null, 0, null, 0, null );
}

-------------------------------------------------------------

Close (suspend)

Method 1:
// Virtual shut-down key
: Keybd_event (vk_off, 0, 0, 0 );
: Keybd_event (vk_off, 0, keyeventf_keyup, 0 );

Method 2:
// Call the undisclosed function poweroffsystem ()
Extern "C" _ declspec (dllimport) void poweroffsystem ();


Soft Reset)
// Soft reset the device
# Include<Winioctl. h> 〉

# Define ioctl_hal_reboot ctl_code (file_device_hal, 15, method_buffered, file_any_access)

Extern "C" _ declspec (dllimport) bool kerneliocontrol (
 DWORD dwiocontrolcode,
 Lpvoid lpinbuf,
 DWORD ninbufsize,
 Lpvoid lpoutbuf,
 DWORD noutbufsize,
 Lpdword lpbytesreturned );

Bool resetdevice ()
{
 Return kerneliocontrol (ioctl_hal_reboot, null, 0, null, 0, null );
}

 

Hard reset)

// Note !!! Using this code will clear all user data in your Pocket PC,
// Do not use it illegally.

# Include<Winioctl. h> 〉

# Define ioctl_hal_reboot ctl_code (file_device_hal, 15, method_buffered, file_any_access)

Extern "C" _ declspec (dllimport) void setcleanrebootflag (void );

Extern "C" _ declspec (dllimport) bool kerneliocontrol (
 DWORD dwiocontrolcode,
 Lpvoid lpinbuf,
 DWORD ninbufsize,
 Lpvoid lpoutbuf,
 DWORD noutbufsize,
 Lpdword lpbytesreturned );

Bool hardresetdevice ()
{
 Setcleanrebootflag ();
 Return kerneliocontrol (ioctl_hal_reboot, null, 0, null, 0, null );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.