hard-drive

To protect software by accessing harddisk serial no [closed]

非 Y 不嫁゛ 提交于 2019-12-04 12:46:20
I want to get the VB.NET or VB code to access the hard disk serial no when starting the program. It's to help me to protect my own software from people who try to pirate copies. In c#, but you get the idea. You'll want to use System.Management for this: string driveLetter = Environment.SystemDirectory.Substring(0, 2); string sn = new System.Management.ManagementObject("Win32_LogicalDisk.DeviceID=\"" + driveLetter + "\"").GetPropertyValue("VolumeSerialNumber").ToString(); As others have pointed out, this might not be the best way to handle this. However, that's your business. I can't offer you

Listing physical drives installed on my computer [duplicate]

独自空忆成欢 提交于 2019-12-04 11:47:33
This question already has answers here : Closed 7 years ago . Possible Duplicate: How to list physical disks? What is the "best way" (fastest) C++ way to List physical drives installed on my computer? Is there a boost library to do that? use GetLogicalDriveStrings() to retrieve all the available logical drives. #include <windows.h> #include <stdio.h> DWORD mydrives = 100;// buffer length char lpBuffer[100];// buffer for drive string storage int main() { DWORD test = GetLogicalDriveStrings( mydrives, lpBuffer); printf("The logical drives of this machine are:\n\n"); for(int i = 0; i<100; i++)

Disk seek time measurement method

两盒软妹~` 提交于 2019-12-04 11:18:33
I write a script to measure seek times on a HDD and a small change in how its done results in dramatically different times. First cycle makes jumps within an area at beginning of the disk. Second cycle selects random areas (of same size) on disk where seeks are performed. This approach is clearly different but I dont understand why it would change results? Notice that for large areas measurements converge for both methods. Bytes* methods just format numbers nicely (1024 <-> "1KB"). Script must be run under root. Disk is sdb, by default. import sys, os, time, random #---------------------------

html or java script code to create a text file in hard disk

大兔子大兔子 提交于 2019-12-04 06:16:00
问题 Please someone give me a code to create a text file in hard drive Result should be a html file, when double click html file it need to create a text file in a given path in hard drive(local). Thank you. 回答1: Javascript in a regular HTML page in a browser is not allowed direct access to a path of your choice on the hard disk for security reasons. The, somewhat experimental, FileSystem APIs in newer browsers offering some capabilities to a sandboxed file system, but you will have to see if your

Accessing hard disk

时光毁灭记忆、已成空白 提交于 2019-12-03 21:32:36
How does the CPU manage to address the distant memory locations on a several hundred giga bytes of hard disk with registers and data bus of 32 bits only. Anirudh Ramanathan RAM is directly mapped into the processor's address/data bus. Hard drives are not. They interface to a disk controller (IDE, SATA, SCSI, etc). The disk controller copies data to/from RAM in smaller blocks where the CPU works with it. There are various addressing schemes for Hard-disks as well, such as LBA, CHS etc, which themselves run into limitations from time to time. Hence, the processor only needs to access the caches

Why is average disk seek time one-third of the full seek time?

馋奶兔 提交于 2019-12-03 17:22:33
I have read in many books and papers, considering disk performance, that the average seek time is roughly one-third of the full seek time, but no one really offers any explanation about that. Where does this come from? The average is calculated mathematically using calculus. We use the very basic formula for calculation of average. Average seek time = (Sum of all possible seek times)/(Total no. of possible seek times) The disk is assumed to have N number of tracks, so that these are numbered from 1...N The position of the head at any point of time can be anything from 0 to N (inclusive). Let

Volume to physical drive

北慕城南 提交于 2019-12-03 15:03:32
QueryDosDevice(L"E:", DeviceName, MAX_PATH); (E: is a SD card) DeviceName is "\Device\HarddiskVolume3" How do I "convert" it to something like "\\.\PHYSICALDRIVE1" Volumes are made up of one or more partitions, which reside on disks. So, E: doesn't necessarily map to a single disk in the system (think software RAID). The way you map volumes to the PhysicalDrive names in Win32 is to first open the volume and then send IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS. This will give you a structure that has one DISK_EXTENT entry for every partition that the volume spans: typedef struct _VOLUME_DISK_EXTENTS

Howto get hardware information in Linux using C++

♀尐吖头ヾ 提交于 2019-12-03 12:40:53
I need to get specifications of hard disk on both Win and *nix machines. I used <hdreg.h> on Linux like this: static struct hd_driveid hd; int device; if ((device = open("/dev/sda", O_RDONLY | O_NONBLOCK)) < 0) { cerr << "ERROR: Cannot open device /dev/sda \n"; exit(1); } if (!ioctl(device, HDIO_GET_IDENTITY, &hd)) { cout << hd.model << endl; cout << hd.serial_no << endl; cout << hd.heads << endl; } I need hd_driveid to tell me some more information about disk. I want to know: Number of partitions Specifications of each partition (format, label, flags, size, start point, number of tracks etc.)

How many threads for reading and writing to the hard disk?

房东的猫 提交于 2019-12-03 12:03:37
i am developing an application that gathers a list with all the files of the hard drive and also afterwards it does write files to the hard drive. I want to ask : what is the optimum number of concurrent threads that will do this task ? I mean how many threads should i have that read the hard drive without making the hard drive to get slow because so many threads are reading it concurrently. Thank you ! At first, I say one! It actually depends whether the data to read need complex computations for being elaborated. In this case, it could be convenient to instantiate more than one thread to

How to programatically prevent Windows from hard disk drive spin down?

喜夏-厌秋 提交于 2019-12-03 09:44:52
问题 My program performs a task on the hard disk free space. The task is quite long, it takes 1-2 hours . The problem is that on laptop the hard disk may be turned off after few minutes when the user is inactive. How do I programmatically prevent Windows from hard disk spin down (power off) ? 回答1: To prevent the system from entering idle mode you may try to use the SetThreadExecutionState function. This function informs the system that the application is in use and allows you to specify the thread