用ExitWindowsEx(EWX_SHUTDOWN,0)和ExitWindowsEx(EWX_POWEROFF,0)都能关机,它们有什么区别吗?
或者说哪个更好一些,百度和谷歌上没找着,CSDN上也没发现,请教各位大牛了,谢谢!

解决方案 »

  1.   

    EWX_POWEROFF
    0x00000008
     Shuts down the system and turns off the power. The system must support the power-off feature. The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Res section.
    ---------------------------------
    EWX_SHUTDOWN
    0x00000001
     Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Res section.Specifying this flag will not turn off the power even if the system supports the power-off feature. You must specify EWX_POWEROFF to do this.Windows XP SP1:  If the system supports the power-off feature, specifying this flag turns off the power. 
      

  2.   

    正巧,我前天试过hook了explorer.exe里的ExitWindowsEx()函数.
    发现在开始菜单里用正常操作关机时调用ExitWindowsEx时,第一个参数是9,
    也就里是等于
    EWX_SHUTDOWN + EWX_POWEROFF
      

  3.   

    呵呵,一楼很强,二楼也很历害。看来EWX_SHUTDOWN + EWX_POWEROFF是最好的关机项了。
      

  4.   

    怀疑!!!
    因为第一个参数只是一个,不是几个参数吧,因为文档说了,只能选择之一啊!!“The shutdown type. This parameter must include one of the following values. ”