WinUSB "Safely Remove Hardware" list

Discussion in 'Windows Vista Drivers' started by Mac, Jun 4, 2009.

  1. Mac

    Mac Guest

    Hi,

    Does anyone know how to make a device that uses a WinUSB driver NOT be
    displayed in the "Safely Remove Hardware" list?

    Thanks

    MAC
     
    Mac, Jun 4, 2009
    #1
    1. Advertisements

  2. In WDM, it is SurpriseRemovalOk bit in DEVICE_CAPABILITIES.

    Look for similar things in UMDF.
     
    Maxim S. Shatskih, Jun 4, 2009
    #2
    1. Advertisements

  3. Mac

    Mac Guest

    Thanks Max.

    I tried adding the following to the INF file but I have not had success to
    date?

    HKR,,"SurpriseRemovalOK",0x00010001,1
    HKR,,"Removable",0x00010001,1
    HKR,,"RemovalPolicy",0x00010001,3
     
    Mac, Jun 4, 2009
    #3
  4. where in in the INF did you put these directives?
     
    Doron Holan [MSFT], Jun 5, 2009
    #4
  5. Mac

    Mac Guest

    Hi,

    I put those directives in the [Dev_AddReg] section.

    I read a post online and that is the reason I tried that.

    I should add I am using the WinUSB as the function driver.

    Is there a way to modify the "Capabilities" value from the INF file. (If I
    do this manually the device is removed from the list!

    Thanks.

    MAC
     
    Mac, Jun 8, 2009
    #5
  6. what section refers to Dev_AddReg via the AddReg directive? this must be
    eventually referenced by the .HW section in the INF. you might as well just
    post the entire INF at this point

    d

    --

    This posting is provided "AS IS" with no warranties, and confers no rights.


     
    Doron Holan [MSFT], Jun 8, 2009
    #6
  7. Mac

    Mac Guest

    Hi Doron,

    As you can probably tell I am quite new to driver development.

    Yes, the Dev_AddReg section is called by the .HW section.

    See the full INF file below.

    Do you know if it is even possible to remove a device from the "Safely
    Remove Hardware" list if it is using WinUSB as the function driver?

    ##################################################
    ; Adapted from the example INF in the Microsoft document "How to Use WinUSB
    to Communicate with a USB Device"

    [Version]
    Signature = "$Windows NT$"
    Class = USB
    ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
    Provider = %ProviderName%
    DriverVer=02/07/2008,1.0.0
    ;CatalogFile=MyCatFile.cat

    ; ========== Manufacturer/Models sections ===========

    [Manufacturer]
    %ProviderName% = MyDevice_WinUSB,NTx86,NTamd64

    [MyDevice_WinUSB.NTx86]
    %USB\MyDevice.DeviceDesc% =USB_Install, USB\VID_####&PID_####

    [MyDevice_WinUSB.NTamd64]
    %USB\MyDevice.DeviceDesc% =USB_Install, USB\VID_####&PID_####

    ; =================== Installation ===================

    [USB_Install]
    Include=winusb.inf
    Needs=WINUSB.NT

    [USB_Install.Services]
    Include=winusb.inf
    AddService=WinUSB,0x00000002,WinUSB_ServiceInstall

    [WinUSB_ServiceInstall]
    DisplayName = %WinUSB_SvcDesc%
    ServiceType = 1
    StartType = 3
    ErrorControl = 1
    ServiceBinary = %12%\WinUSB.sys

    [USB_Install.Wdf]
    KmdfService=WINUSB, WinUsb_Install
    UmdfServiceOrder=WINUSB

    [WinUSB_Install]
    KmdfLibraryVersion=1.7

    [USB_Install.HW]
    AddReg=Dev_AddReg

    [Dev_AddReg]
    HKR,,DeviceInterfaceGUIDs,0x10000,"{MY_GUID}"

    [USB_Install.CoInstallers]
    AddReg=CoInstallers_AddReg
    CopyFiles=CoInstallers_CopyFiles

    [CoInstallers_AddReg]
    HKR,,CoInstallers32,0x00010000,"WinUSBCoInstaller.dll","WUDFUpdate_01007.dll","WdfCoInstaller01007.dll,WdfCoInstaller"

    [CoInstallers_CopyFiles]
    WinUSBCoInstaller.dll
    WdfCoInstaller01007.dll
    WUDFUpdate_01007.dll

    [DestinationDirs]
    CoInstallers_CopyFiles=11

    ; ================= Source Media Section =====================

    [SourceDisksNames]
    1 = %DISK_NAME%,,,\i386
    2 = %DISK_NAME%,,,\amd64

    [SourceDisksFiles.x86]
    WinUSBCoInstaller.dll=1
    WdfCoInstaller01007.dll=1
    WUDFUpdate_01007.dll=1

    [SourceDisksFiles.amd64]
    WinUSBCoInstaller.dll=2
    WdfCoInstaller01007.dll=2
    WUDFUpdate_01007.dll=2

    ; Copy Files section
    ;------------------------------------------------------------------------------
    [_CopyFiles_sys]
    winusb.sys

    ;*************************************************
    *****************************
    ; Destination Directories
    ;------------------------------------------------------------------------------
    [DestinationDirs]
    DefaultDestDir = 12 ; %SystemRoot%\system32\drivers
    _CopyFiles_sys = 12

    ; =================== Strings ===================

    [Strings]
    ProviderName="MCM"
    USB\MyDevice.DeviceDesc="MTest"
    WinUSB_SvcDesc="WinUSB Demo"
    DISK_NAME="My Install Disk"

    #######################################################
     
    Mac, Jun 8, 2009
    #7
  8. it looks like you are installing a umdf driver as ewll, or at least
    partially. also, I don't not see the sections adding the SurpriseRemovalOK
    value in the inf

    d

    --

    This posting is provided "AS IS" with no warranties, and confers no rights.


     
    Doron Holan [MSFT], Jun 9, 2009
    #8
  9. Mac

    Mac Guest

    Hi,

    Thank you for your reply.

    I am using WinUSB.dll as the UMDF driver (if that makes sense?) Much like
    this MS example:

    http://www.microsoft.com/whdc/connect/usb/winusb_howto.mspx

    I have been trying a few things so I did not show the Surprise Removal
    directive I tried.

    Here is what it looked like:

    [Dev_AddReg]
    HKR,,DeviceInterfaceGUIDs,0x10000,"{MY_GUID}"
    HKR,,"SurpriseRemovalOK",0x00010001,1
    HKR,,"Removable",0x00010001,1
    HKR,,"RemovalPolicy",0x00010001,3

    I appreciate your efforts.

    Thanks.

    MAC
     
    Mac, Jun 9, 2009
    #9
  10. winusb.dll cannot be a umdf driver by itself. there are two modes that you
    can use winusb. the first is to use it in conjunction with umdf and use the
    umdf wdf usb io targets. the 2nd is to talk to the device directly from
    your app using winusb.dll

    d
     
    Doron Holan [MSFT], Jun 11, 2009
    #10
  11. Mac

    Mac Guest

    Thank you.

    I am using the winusb.dll from my application. (2nd option)

    Is there a way to setup the INF file such that the device is not in the
    "Safely Remove Hardware" list?

    Thanks,

    MAC
     
    Mac, Jun 11, 2009
    #11
  12. Mac

    Mac Guest

    I still looking for a solution for this.

    If anyone has any ideas please help!!

    Thanks.

    MAC
     
    Mac, Jun 19, 2009
    #12
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.