EVC编程实现WinCE重启

代码如下:
#include <windows.h>
#include "winioctl.h"

BOOL KernelIoControl(DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, 
                              LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned);

#define IOCTL_HAL_GET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_REBOOT          CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_COLDBOOT        CTL_CODE(FILE_DEVICE_HAL, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)

//#define IOCTL_HAL_COLDBOOT      CTL_CODE(FILE_DEVICE_HAL, 4017, METHOD_BUFFERED, FILE_ANY_ACCESS) 
                                                //Unitech PA600II mobile 6.1 测试 OK (2009-09-09) 

void WINAPI Reboot (int nBootMode)
{
    int   inVal;
    BYTE  outBuf[1024];
    DWORD bytesReturned;

    //KernelIoControl(IOCTL_HAL_COLDBOOT, &inVal, 4, outBuf, 1024, &bytesReturned);
    if(nBootMode == 0)
        KernelIoControl(IOCTL_HAL_REBOOT, &inVal, 4, outBuf, 1024, &bytesReturned);   //热启动
    else
        KernelIoControl(IOCTL_HAL_COLDBOOT, &inVal, 4, outBuf, 1024, &bytesReturned); //冷启动
}

你可能感兴趣的:(WinCE)