重启PPC系统

#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); 



调用:

   KernelIoControl(IOCTL_HAL_REBOOT,   NULL,   0,   NULL,   0,   NULL);  


//补充下
来自蓝色理想

关闭(suspend)
方法1:
//虚拟关机键
::keybd_event(VK_OFF, 0, 0, 0);
::keybd_event(VK_OFF, 0, KEYEVENTF_KEYUP, 0);

方法2:
//调用未公开函数PowerOffSystem()
extern "C" __declspec(dllimport) void PowerOffSystem();


重起(soft reset)
//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)

//注意!!!使用此段代码会将您的Pocket PC的用户数据全部清空,
//请勿非法使用,用者后果自负.

#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);
}

你可能感兴趣的:(系统)