解决方案 »

  1.   

    用API Monitor监视Explorer.exe?
      

  2.   

    补充:
    下面是XP方式安全删除硬件,在WIN7下是失败的。
    下面2种方式都成功了,但是我不知道系统调用的那些命令
      

  3.   

    怎么做,能得到什么数据?
    应该能得到写了哪些注册表和调用了哪些API
      

  4.   

    怎么做,能得到什么数据?
    应该能得到写了哪些注册表和调用了哪些API
    能具体点吗?
    我下载了API MONITOR,然后挂载了explorer.exe。接着不知道做什么了。删除U盘点动作,api monitor也没有啥明显的变化指示。
      

  5.   

    ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.chs/kmdf_d/hh/KMDF_d/Ch4_DFPnPPackage_41654846-fa49-4f33-a16c-68b3d0badbbe.xml.htm
      
    Windows Driver Kit: Kernel-Mode Driver Framework 
    A User Unplugs a DeviceWhile a system is running, a user can remove a device in one of two ways: by orderly removal, which means that the user informs the system that the device is about to be removed (for example, by using the Unplug or Eject Hardware program); or by surprise removal, which means that the user unplugs the device without informing the system. If the bus supports surprise removal (for example, USB), the device's drivers must be able to handle the device's sudden disappearance.Orderly Removal
    The user requests removal by using the system's Unplug or Eject Hardware program, by disabling the device by using Device Manager, or by pushing an ejectable device's eject button. The framework allows the device to be removed or disabled, unless the driver has:Called WdfDeviceSetSpecialFileSupport and a special file is open on the device. 
    Called WdfDeviceSetStaticStopRemove. 
    Supplied an EvtDeviceQueryRemove callback function, and the callback function has vetoed the removal. For each function and filter driver that supports the device, the framework does the following, in sequence, one driver at a time, starting with the driver that is highest in the driver stack:If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoSuspend callback function. 
    The framework stops all of the device's power-managed I/O queues. 
    If the hardware and driver support DMA, the framework calls the driver's EvtDmaEnablerSelfManagedIoStop, EvtDmaEnablerFlush, and EvtDmaEnablerDisable callback functions (if they exist) for each DMA channel that was created. 
    The framework calls the driver's EvtDeviceD0ExitPreInterruptsDisabled callback function (if it exists), and then calls the driver's EvtInterruptDisable callback function (if it exists) for each interrupt so that the driver can disable device interrupts. 
    The framework calls the driver's EvtDeviceD0Exit callback function (if it exists). 
    If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoFlush callback function. 
    The framework calls the driver's EvtDeviceReleaseHardware callback function (if it exists), passing it the list of hardware resources that the PnP manager has assigned to the device. 
    If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoCleanup callback function. The bus driver is the driver in the stack that is called last. When the framework calls the bus driver's EvtDeviceD0Exit callback function, the callback function sets the power state of the device (a child device of the bus) to D3. Surprise Removal
    A user unplugs a device unexpectedly. The bus driver for the device's bus discovers that the device is missing and calls WdfChildListUpdateChildDescriptionAsMissing. For each function and filter driver that supports the device, the framework does the following, in sequence, one driver at a time, starting with the driver that is highest in the driver stack:The framework calls the driver's EvtDeviceSurpriseRemoval callback function (if it exists). 
    If the device was in its working (D0) state when it was unplugged, the framework stops all of the device's power-managed I/O queues. 
    If the device was in its working (D0) state when it was unplugged, and if the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoSuspend callback function. 
    If the hardware and driver support DMA, the framework calls the driver's EvtDmaEnablerSelfManagedIoStop, EvtDmaEnablerFlush, and EvtDmaEnablerDisable callback functions (if they exist) for each DMA channel that was created. 
    The framework calls the driver's EvtDeviceD0ExitPreInterruptsDisabled and EvtInterruptDisable callback functions (if they exist) so that the driver can disable device interrupts. 
    The framework calls the driver's EvtDeviceD0Exit callback function (if it exists). 
    The framework calls the driver's EvtDeviceReleaseHardware callback function (if it exists), passing the list of hardware resources that the PnP manager has assigned to the device. 
    If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoFlush callback function. 
    If the driver is using self-managed I/O, the framework calls the driver's EvtDeviceSelfManagedIoCleanup callback function. © 2007 Microsoft Corporation
    Send feedback on this topic
    Windows Driver Kit
    Built on August 15, 2007Build machine: CAPEBUILD
      

  6.   

    肯定不能用代码处理。因为是U盘里的程序发起的,用程序移除的话肯定会提示设备正在使用的。所以只能调用WIN自带的程序
      

  7.   

    肯定不能用代码处理。因为是U盘里的程序发起的,用程序移除的话肯定会提示设备正在使用的。所以只能调用WIN自带的程序程序在执行这个功能时,把自身复制到临时文件夹下,启动新进程,前一个退出。