Results 1 to 5 of 5

Thread: Using GetDriveType API to detect USB Hard Disk

  1. #1
    Join Date
    Mar 2011
    Posts
    70

    Using GetDriveType API to detect USB Hard Disk

    Yesterday, I try to use GetDriveType API to detect the type of drive. For doing this task I decided to use the DRIVE_REMOVABLE or DRIVE_FIXED etc. Then when I started to use DRIVE_FIXED for detecting the USB Hard Disk then it should not detect this USB hard disk. I have not use the other DRIVE_REMOVABLE to get the USB hard disk. How can I solve this type of complicated trouble? Thanks in advance for any type of help.

  2. #2
    Join Date
    May 2008
    Posts
    1,275

    Re: Using GetDriveType API to detect USB Hard Disk

    For solving swuhc type of problem you need executable code. Then follow the below code. This code will be help to perform troubleshooting on the GetDriveType. The code is to be :
    if(GetDriveType(Exe_name)== DRIVE_CDROM || GetDriveType(Exe_name)== DRIVE_REMOVABLE)
    {
    print("Not from the local disk");
    }
    Then execute this in the directory. Then first go to the start. Then hit run and type "\\ip_address\exe_name". Then execute this and it will be help to you for solving the problem.

  3. #3
    Join Date
    Aug 2008
    Posts
    1,238

    Re: Using GetDriveType API to detect USB Hard Disk

    Before executing this code you need to add the header files onto this. The important header file on this program is to be the "Winbase.h" . this file is to be contains some information and this are the code. This is actually the macro and it help to set the configuration of the drive. The macro of this is to be
    #define DRIVE_UNKNOWN 0
    #define DRIVE_FIXED 3
    #define DRIVE_REMOVABLE 2
    #define DRIVE_CDROM 5
    #define DRIVE_REMOTE 4
    #define DRIVE_NO_ROOT_DIR 1
    #define DRIVE_RAMDISK 6
    This is help to set the configuration of the drive and this will be help to solve the problem.

  4. #4
    Join Date
    Nov 2009
    Posts
    796

    Re: Using GetDriveType API to detect USB Hard Disk

    I think this is the internal setting problem. The DRIVE_REMOVABLE or DRIVE_FIXED will only detect the current hard disk. Hence there will be possibility that it should be avoid such USB type of connecting hard disk devices. Hence you need to make the USB Device partition. This partition will be making some affect. Then it could be possible that it avoid such kind of problem. Then try to use the DRIVE_REMOVABLE. This will solve your problem.

  5. #5
    Join Date
    May 2009
    Posts
    1,191

    Re: Using GetDriveType API to detect USB Hard Disk

    You need to find out that a device is USB device. Then you can open its handle and throw IOCTL queries using DeviceIoControl() method. This will be help to you for solving such kind of problem. This is the inbuilt method and it really help to solve such kind of complicated task. Then use this DeviceIoControl () method which is present on the drive system. Then apply this and it will be help to you for solving such kind of trouble. This is the alternative way to solve such problem.

Similar Threads

  1. Replies: 7
    Last Post: 31-03-2012, 08:34 AM
  2. Replies: 7
    Last Post: 05-09-2011, 07:54 AM
  3. Windows XP & BIOS only detect 1TB of 2TB hard disk
    By Margaret Cake in forum Operating Systems
    Replies: 5
    Last Post: 10-04-2011, 07:27 PM
  4. Dell Inspiro 1150 cannot detect hard disk
    By Glinda in forum Portable Devices
    Replies: 4
    Last Post: 25-03-2011, 03:23 AM
  5. My External Hard disk can detect in my Xp Sp2 but cannot see in my computer
    By william.james82 in forum Hardware Peripherals
    Replies: 4
    Last Post: 02-02-2011, 07:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,116,799.19128 seconds with 16 queries