hard-drive

Mount and unmount hard drives

▼魔方 西西 提交于 2019-12-01 09:22:41
How can I mount and unmount hard drives (platform independent, so no using Runtime to execute a hard-coded command) in the Java Programming Language? The answer is "Yes And No". You could not mount or unmount devices in java because each OS has their own methods to do this. BUT... you can provide java api that use adapter pattern for native interface. You should do some things: create Java interfaces that support mount/unmount commands create classes that implements interfaces as native methods create native implementations of this commands in C or other language. One implemantation for OS

Mount and unmount hard drives

醉酒当歌 提交于 2019-12-01 06:43:25
问题 How can I mount and unmount hard drives (platform independent, so no using Runtime to execute a hard-coded command) in the Java Programming Language? 回答1: The answer is "Yes And No". You could not mount or unmount devices in java because each OS has their own methods to do this. BUT... you can provide java api that use adapter pattern for native interface. You should do some things: create Java interfaces that support mount/unmount commands create classes that implements interfaces as native

How can I get the system drive letter?

丶灬走出姿态 提交于 2019-12-01 02:57:42
How would I find the driver letter of the main hard disk on a Windows Operating system? That is, the drive with Program Files , System32 , and so on. There's an environment variable called SystemDrive which is set to the system drive (surprisingly enough). The getenv() call is how you can get to it. char *sysDrive = getenv ("SystemDrive"); if (sysDrive == NULL) { // vote me down. } else { // vote me up and use it. } This page lists a whole slew of environment variables available if you can't rely on specific directories existing on the system drive. Alternatively, use the Windows API call,

How to obtain direct access to raw HD data in C?

此生再无相见时 提交于 2019-11-30 23:43:10
I need to do a complete format on a USB stick (FAT16 or FAT32), put a file on the drive, then delete it and recover the file using a C program. Could anyone give me a hint on what should I use to accomplish this? I understand the layouts of the FAT16/32 filesystems, the problem is that I don't know how to access the raw HD data using C (since I can't use things like fopen or mmap because the file isn't there anymore). wallyk This is highly operating system specific. For Linux, you would open the raw device /dev/sdxx . Note that there are privilege hoops to manage. For Windows, you would use

How can I get the system drive letter?

孤人 提交于 2019-11-30 22:59:27
问题 How would I find the driver letter of the main hard disk on a Windows Operating system? That is, the drive with Program Files , System32 , and so on. 回答1: There's an environment variable called SystemDrive which is set to the system drive (surprisingly enough). The getenv() call is how you can get to it. char *sysDrive = getenv ("SystemDrive"); if (sysDrive == NULL) { // vote me down. } else { // vote me up and use it. } This page lists a whole slew of environment variables available if you

What is the easiest way in C# to check if hard disk is SSD without writing any file on hard disk?

纵然是瞬间 提交于 2019-11-30 08:43:32
I need to check in C# if a hard disk is SSD (Solid-state drive), no seek penalty? I used: ManagementClass driveClass = new ManagementClass("Win32_DiskDrive"); ManagementObjectCollection drives = driveClass.GetInstances(); But its only gives Strings that contain SSD in the properties, I can't depend on that? I Need a direct way to check that? WMI will not be able to determine this easily. There is a solution here that's based on the same algorithm Windows 7 uses to determine if a disk is SSD (more on the algorithm here: Windows 7 Enhancements for Solid-State Drives , page 8 and also here:

Know how fast a Hard Drive is in Delphi

送分小仙女□ 提交于 2019-11-30 07:21:11
I am writing a diagnosis program (like everest, but simpler) and I need to know how fast a HardDrive is. I wanna know things such as: 1 - Bytes per second (read) 2 - Bytes per second (write) 3 - S.M.A.R.T data I guess I can use WMI to query such thing, but i have no idea how. It does not matter if I need to buy a component or get a opensource one. I also know that Windows Perfmoon is able to do that, but I cannot use it. Rafael to obtain the S.M.A.R.T data you can use the WMI or the Windows API. using the WMI the WMI classes to obtain S.M.A.R.T data are MSStorageDriver_ATAPISmartData

Converting HDD Serial # VB6 code into VB.NET code

守給你的承諾、 提交于 2019-11-30 07:15:02
问题 I've got a cool piece of code taken from a VC++ project which gets complete information of the hard disk drive WITHOUT using WMI (since WMI has got its own problems) I ask those of you who are comfortable with API functions to try to convert this VB6 code into VB (or C#) .NET and help A LOT of people who are in great need of this utility class. I've spent lots of time and searched the entire net to find ways to get the actual model and serial number of HDD and eventually found this one, if

How do I detected whether a hard drive is connected via USB?

我们两清 提交于 2019-11-29 15:42:09
问题 I am trying to write a little backup program for friends and family and want it to be as simple to use a possible. I don't want to have to ask the user where to backup their data to, I just want to search for and use the first USB hard drive connected to the computer. Obtaining the unique ID of the hard drive would probably be a good idea too, just as a double check for next time the backup runs. 回答1: I know your question is tagged Win32, but this is quite simple with .NET: foreach (IO

Reading Data from a Physical Hard Drive

不羁的心 提交于 2019-11-29 13:06:17
I am trying to develop a program that goes and finds 2 connected unformatted physical drives and read bytes. The program currently runs in the administrator mode since that's the only way I guess the program can see unformatted hard drives. I am using visual studio 2015 and it runs in windows 7 machine. The problem is that it can only read multiples of 512 (512 is the sector size). Currently the unformatted hard drives are located in disk 2 and 3 slots (they are both SSDs). It first reads 512 bytes (works without an issue) and doesn't do any more reads if it's a formatted hard drive. If it's